控制台输出带缩略、对齐和彩色,文件输出信息比较完整。
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
<Properties>
<property name="APP_NAME">my-app</property>
<property name="LOG_HOME">/home/logs/${APP_NAME}</property>
<property name="LOG_NAME">${APP_NAME}.log</property>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT" follow="true">
<PatternLayout pattern="%clr{%d{HH:mm:ss.SSS}}{faint} %clr{%5p} %clr{[%16.16t]}{faint} %4L %clr{%-32.32c{1.}}{cyan} %clr{%-16.16M}{cyan} %clr{:}{faint} %msg%xEx%n"/>
</Console>
<RollingFile name="RollingFile" fileName="${LOG_HOME}/${LOG_NAME}"
filePattern="${LOG_HOME}/${LOG_NAME}.%d{yyyyMMdd}.log">
<PatternLayout pattern="[%d{yyyy-MM-dd HH:mm:ss}] %-5level %class{36} %L %M - %msg%xEx%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="org.apache.catalina.startup.DigesterFactory" level="error"/>
<Logger name="org.apache.catalina.util.LifecycleBase" level="error"/>
<Logger name="org.apache.coyote.http11.Http11NioProtocol" level="warn"/>
<logger name="org.apache.sshd.common.util.SecurityUtils" level="warn"/>
<Logger name="org.apache.tomcat.util.net.NioSelectorPool" level="warn"/>
<Logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="error"/>
<Logger name="org.hibernate.validator.internal.util.Version" level="warn"/>
<logger name="org.springframework.boot.actuate.endpoint.jmx" level="warn"/>
<Root level="INFO">
<AppenderRef ref="Console"/>
<AppenderRef ref="RollingFile"/>
</Root>
</Loggers>
</Configuration>
网友评论