mxsm commented on code in PR #5033: URL: https://github.com/apache/rocketmq/pull/5033#discussion_r1018576064
########## logging/src/main/java/org/apache/rocketmq/logging/dynamic/ProcessUnitFactory.java: ########## @@ -0,0 +1,73 @@ +/* + * 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.rocketmq.logging.dynamic; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * service factory + */ +public class ProcessUnitFactory { + + private static final Map<String, ProcessUnitFactory> pufMap = new ConcurrentHashMap<String, ProcessUnitFactory>(); + + /** + * service serverId + */ + private String serverId = null; + + /** + * Construct service factory + * + * @param serverId -- 服务serverId + */ + public ProcessUnitFactory(String serverId) { + this.serverId = serverId; + } + + /** + * 获取服务工厂 + * + * @param serverId -- 服务serverId + * @return -- 服务工厂 + */ Review Comment: Chinese comments need to be removed ########## logging/src/test/java/org/apache/rocketmq/logging/dynamic/ChangeLogLevelProcessUnitTest.java: ########## @@ -0,0 +1,32 @@ +package org.apache.rocketmq.logging.dynamic; + +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.impl.StaticLoggerBinder; + +public class ChangeLogLevelProcessUnitTest { + Logger logger = LoggerFactory.getLogger(ChangeLogLevelProcessUnitTest.class); + + String serverId = "logback-loglevel-test"; + + @Test + public void setLogLevelTest() { + logger.debug("test start"); + logger.debug("type:{}", StaticLoggerBinder.getSingleton().getLoggerFactoryClassStr()); + AbstractProcessUnitImpl process = ProcessUnitFactory.newInstance(serverId).getChangeLogLevelProcess(); + logger.debug("frame:{}", process.logFrameworkType); + + process.setDefaultLevel("ERROR"); + String a = null; + process.setLogLevel(a); + logger.debug("now is debug"); + process.setLogLevel("INFO");//改成INFO Review Comment: Chinese comments need to be removed -- 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]
