yangy0000 commented on code in PR #14538: URL: https://github.com/apache/kafka/pull/14538#discussion_r1357779469
########## connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Loggers.java: ########## @@ -0,0 +1,213 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.kafka.connect.runtime; + +import org.apache.kafka.common.utils.Time; +import org.apache.kafka.connect.runtime.rest.entities.LoggerLevel; +import org.apache.log4j.Level; +import org.apache.log4j.LogManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.TreeMap; + +/** + * Manges logging levels on a single worker. Supports dynamic adjustment and querying + * of logging levels. + * <p> + * This class is thread-safe; concurrent calls to all of its public methods from any number + * of threads are permitted. + */ +public class Loggers { + + private static final Logger log = LoggerFactory.getLogger(Loggers.class); + + /** + * Log4j uses "root" (case-insensitive) as name of the root logger. + */ + private static final String ROOT_LOGGER_NAME = "root"; + + private final Time time; + private final Map<String, Long> lastModifiedTimes; + + public Loggers(Time time) { + this.time = time; + this.lastModifiedTimes = new HashMap<>(); + } + + /** + * Retrieve the current level for a single logger. Review Comment: nit: how about use " 3rd person declarative" for java doc? ref: https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html "The description is in 3rd person declarative rather than 2nd person imperative." -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
