fix client log config (#12040)

This commit is contained in:
shalk(xiao kun) 2024-04-29 09:34:53 +08:00 committed by GitHub
parent da3e88b3d4
commit b016e79dfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 4 deletions

View File

@ -108,6 +108,11 @@
<AppenderRef ref="ASYNC_REMOTE"/>
</Logger>
<Logger name="com.alibaba.nacos.shaded.io.grpc" level="${nacosClientProperty:com.alibaba.nacos.config.log.level:-info}"
additivity="false">
<appender-ref ref="ASYNC-REMOTE"/>
</Logger>
<Logger name="com.alibaba.nacos.client.config" level="${nacosClientProperty:com.alibaba.nacos.config.log.level:-info}"
additivity="false">
<AppenderRef ref="ASYNC_CONFIG"/>

View File

@ -106,7 +106,7 @@ public class Log4J2NacosLoggingAdapterTest {
loggerContext = (LoggerContext) LogManager.getContext(false);
contextConfiguration = loggerContext.getConfiguration();
Map<String, LoggerConfig> nacosClientLoggers = contextConfiguration.getLoggers();
assertEquals(5, nacosClientLoggers.size());
assertEquals(6, nacosClientLoggers.size());
for (Map.Entry<String, LoggerConfig> loggerEntry : nacosClientLoggers.entrySet()) {
String loggerName = loggerEntry.getKey();
Assert.assertTrue(loggerName.startsWith(NACOS_LOGGER_PREFIX));

View File

@ -20,6 +20,8 @@
<nacosClientProperty scope="context" name="logRetainCount" source="JM.LOG.RETAIN.COUNT" defaultValue="7"/>
<nacosClientProperty scope="context" name="logFileSize" source="JM.LOG.FILE.SIZE" defaultValue="10MB"/>
<nacosClientProperty scope="context" name="nacosConfigLogLevel" source="com.alibaba.nacos.config.log.level" defaultValue="info"/>
<nacosClientProperty scope="context" name="nacosLogLevel" source="com.alibaba.nacos.log.level" defaultValue="info"/>
<nacosClientProperty scope="context" name="nacosNamingLogLevel" source="com.alibaba.nacos.naming.log.level" defaultValue="info"/>
<appender name="CONFIG_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
@ -99,12 +101,12 @@
<appender-ref ref="ASYNC-CONFIG"/>
</logger>
<Logger name="com.alibaba.nacos.common.labels" level="${nacosConfigLogLevel}"
<Logger name="com.alibaba.nacos.common.labels" level="${nacosLogLevel}"
additivity="false">
<appender-ref ref="ASYNC-REMOTE"/>
</Logger>
<Logger name="com.alibaba.nacos.common.remote.client" level="${nacosConfigLogLevel}"
<Logger name="com.alibaba.nacos.common.remote.client" level="${nacosLogLevel}"
additivity="false">
<appender-ref ref="ASYNC-REMOTE"/>
</Logger>
@ -119,7 +121,7 @@
<appender-ref ref="ASYNC-CONFIG"/>
</logger>
<logger name="com.alibaba.nacos.client.naming" level="${nacosConfigLogLevel}"
<logger name="com.alibaba.nacos.client.naming" level="${nacosNamingLogLevel}"
additivity="false">
<appender-ref ref="ASYNC-NAMING"/>
</logger>