Created
May 25, 2019 09:39
-
-
Save peter-y/5a15fb8956819ea4c7ca0838d281372e to your computer and use it in GitHub Desktop.
logback 的配置模板
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> | |
<configuration scan="true" scanPeriod="10 seconds"> | |
<!-- Simple file output --> | |
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder --> | |
<encoder> | |
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
</encoder> | |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
<!-- rollover daily --> | |
<fileNamePattern>logs/template-server-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
<timeBasedFileNamingAndTriggeringPolicy | |
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
<!-- or whenever the file size reaches 64 MB --> | |
<maxFileSize>64 MB</maxFileSize> | |
</timeBasedFileNamingAndTriggeringPolicy> | |
</rollingPolicy> | |
<!-- Safely log to the same file from multiple JVMs. Degrades performance! --> | |
<prudent>true</prudent> | |
</appender> | |
<!-- Console output --> | |
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder --> | |
<encoder> | |
<pattern>%-5level %logger{36} - %msg%n</pattern> | |
</encoder> | |
<!-- Only log level INFO and above --> | |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |
<level>WARN</level> | |
</filter> | |
</appender> | |
<!-- Enable FILE and STDOUT appenders for all log messages. | |
By default, only log at level INFO and above. --> | |
<root level="INFO"> | |
<appender-ref ref="FILE" /> | |
<appender-ref ref="STDOUT" /> | |
</root> | |
<!-- For loggers in the these namespaces, log at all levels. --> | |
<logger name="user" level="ALL" /> | |
<!-- To log pedestal internals, enable this and change ThresholdFilter to DEBUG | |
<logger name="pedestal" level="ALL" /> | |
--> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment