Skip to content

Commit

Permalink
fix client log config (#12040)
Browse files Browse the repository at this point in the history
  • Loading branch information
shalk authored Apr 29, 2024
1 parent da3e88b commit b016e79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void testLoadConfiguration() {
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit b016e79

Please sign in to comment.