Async log

This commit is contained in:
hongqiaowei
2021-10-11 09:36:27 +08:00
parent 38c994007e
commit c7650fa774
2 changed files with 8 additions and 4 deletions

View File

@@ -182,9 +182,12 @@ import we.log.LogSendAppender;
)
@EnableDiscoveryClient
public class FizzBootstrapApplication {
private static final Logger LOGGER = LoggerFactory.getLogger(FizzBootstrapApplication.class);
public static void main(String[] args) {
System.setProperty("log4j2.contextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
SpringApplication springApplication = new SpringApplication(FizzBootstrapApplication.class);
springApplication.setApplicationContextClass(CustomReactiveWebServerApplicationContext.class);
FizzAppContext.appContext = springApplication.run(args);

View File

@@ -6,19 +6,20 @@
</properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level [%-29t] %c{1}.%M:%L %m %ex%n"/>
<!--<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level [%-29t] %30c{1}.%41M:%4L %m %ex%n"/>-->
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %30c{1}.%41M:%4L %m %ex%n"/>
</Console>
<LogSend name="LogSend">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %level %logger{36} - %msg%n"/>
</LogSend>
</Appenders>
<Loggers>
<Root level="warn">
<Root level="warn" includeLocation="true">
<AppenderRef ref="Console"/>
<AppenderRef ref="LogSend"/>
</Root>
<!-- suppress the warn 'No URLs will be polled as dynamic configuration sources.' -->
<logger name="com.netflix.config.sources.URLConfigurationSource" level="ERROR"/>
<Logger name="we" level="info"/>
<logger name="com.netflix.config.sources.URLConfigurationSource" level="ERROR" includeLocation="true"/>
<Logger name="we" level="info" includeLocation="true"/>
</Loggers>
</Configuration>