spring-boot-1612: make console and file output configurable
1 disable the file output unless LOG_FILE is set 2 make the console optional fixes: gh-1612pull/1780/head
parent
ba40f13370
commit
f9566ed30f
@ -0,0 +1,13 @@
|
|||||||
|
handlers =java.util.logging.ConsoleHandler
|
||||||
|
.level = INFO
|
||||||
|
|
||||||
|
java.util.logging.ConsoleHandler.formatter = org.springframework.boot.logging.java.SimpleFormatter
|
||||||
|
java.util.logging.ConsoleHandler.level = ALL
|
||||||
|
|
||||||
|
org.hibernate.validator.internal.util.Version.level = WARNING
|
||||||
|
org.apache.coyote.http11.Http11NioProtocol.level = WARNING
|
||||||
|
org.crsh.plugin.level = WARNING
|
||||||
|
org.apache.tomcat.util.net.NioSelectorPool.level = WARNING
|
||||||
|
org.apache.catalina.startup.DigesterFactory.level = SEVERE
|
||||||
|
org.apache.catalina.util.LifecycleBase.level = SEVERE
|
||||||
|
org.eclipse.jetty.util.component.AbstractLifeCycle.level = SEVERE
|
@ -0,0 +1,20 @@
|
|||||||
|
handlers =java.util.logging.FileHandler,java.util.logging.ConsoleHandler
|
||||||
|
.level = INFO
|
||||||
|
|
||||||
|
# File Logging
|
||||||
|
java.util.logging.FileHandler.pattern = %t/spring.log
|
||||||
|
java.util.logging.FileHandler.formatter = org.springframework.boot.logging.java.SimpleFormatter
|
||||||
|
java.util.logging.FileHandler.level = ALL
|
||||||
|
java.util.logging.FileHandler.limit = 10485760
|
||||||
|
java.util.logging.FileHandler.count = 10
|
||||||
|
|
||||||
|
java.util.logging.ConsoleHandler.formatter = org.springframework.boot.logging.java.SimpleFormatter
|
||||||
|
java.util.logging.ConsoleHandler.level = ALL
|
||||||
|
|
||||||
|
org.hibernate.validator.internal.util.Version.level = WARNING
|
||||||
|
org.apache.coyote.http11.Http11NioProtocol.level = WARNING
|
||||||
|
org.crsh.plugin.level = WARNING
|
||||||
|
org.apache.tomcat.util.net.NioSelectorPool.level = WARNING
|
||||||
|
org.apache.catalina.startup.DigesterFactory.level = SEVERE
|
||||||
|
org.apache.catalina.util.LifecycleBase.level = SEVERE
|
||||||
|
org.eclipse.jetty.util.component.AbstractLifeCycle.level = SEVERE
|
@ -0,0 +1,17 @@
|
|||||||
|
handlers =java.util.logging.FileHandler
|
||||||
|
.level = INFO
|
||||||
|
|
||||||
|
# File Logging
|
||||||
|
java.util.logging.FileHandler.pattern = %t/spring.log
|
||||||
|
java.util.logging.FileHandler.formatter = org.springframework.boot.logging.java.SimpleFormatter
|
||||||
|
java.util.logging.FileHandler.level = ALL
|
||||||
|
java.util.logging.FileHandler.limit = 10485760
|
||||||
|
java.util.logging.FileHandler.count = 10
|
||||||
|
|
||||||
|
org.hibernate.validator.internal.util.Version.level = WARNING
|
||||||
|
org.apache.coyote.http11.Http11NioProtocol.level = WARNING
|
||||||
|
org.crsh.plugin.level = WARNING
|
||||||
|
org.apache.tomcat.util.net.NioSelectorPool.level = WARNING
|
||||||
|
org.apache.catalina.startup.DigesterFactory.level = SEVERE
|
||||||
|
org.apache.catalina.util.LifecycleBase.level = SEVERE
|
||||||
|
org.eclipse.jetty.util.component.AbstractLifeCycle.level = SEVERE
|
@ -0,0 +1,20 @@
|
|||||||
|
log4j.rootCategory=INFO, CONSOLE
|
||||||
|
|
||||||
|
PID=????
|
||||||
|
LOG_PATH=${java.io.tmpdir}
|
||||||
|
LOG_FILE=${LOG_PATH}/spring.log
|
||||||
|
LOG_PATTERN=[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${PID} %5p [%t] --- %c{1}: %m%n
|
||||||
|
|
||||||
|
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
|
||||||
|
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.CONSOLE.layout.ConversionPattern=${LOG_PATTERN}
|
||||||
|
|
||||||
|
|
||||||
|
log4j.category.org.hibernate.validator.internal.util.Version=WARN
|
||||||
|
log4j.category.org.apache.coyote.http11.Http11NioProtocol=WARN
|
||||||
|
log4j.category.org.crsh.plugin=WARN
|
||||||
|
log4j.category.org.apache.tomcat.util.net.NioSelectorPool=WARN
|
||||||
|
log4j.category.org.apache.catalina.startup.DigesterFactory=ERROR
|
||||||
|
log4j.category.org.apache.catalina.util.LifecycleBase=ERROR
|
||||||
|
log4j.category.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR
|
@ -0,0 +1,25 @@
|
|||||||
|
log4j.rootCategory=INFO, CONSOLE, FILE
|
||||||
|
|
||||||
|
PID=????
|
||||||
|
LOG_PATH=${java.io.tmpdir}
|
||||||
|
LOG_FILE=${LOG_PATH}/spring.log
|
||||||
|
LOG_PATTERN=[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${PID} %5p [%t] --- %c{1}: %m%n
|
||||||
|
|
||||||
|
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
|
||||||
|
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.CONSOLE.layout.ConversionPattern=${LOG_PATTERN}
|
||||||
|
|
||||||
|
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
|
||||||
|
log4j.appender.FILE.File=${LOG_FILE}
|
||||||
|
log4j.appender.FILE.MaxFileSize=10MB
|
||||||
|
log4j.appender.FILE.layout = org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.FILE.layout.ConversionPattern=${LOG_PATTERN}
|
||||||
|
|
||||||
|
log4j.category.org.hibernate.validator.internal.util.Version=WARN
|
||||||
|
log4j.category.org.apache.coyote.http11.Http11NioProtocol=WARN
|
||||||
|
log4j.category.org.crsh.plugin=WARN
|
||||||
|
log4j.category.org.apache.tomcat.util.net.NioSelectorPool=WARN
|
||||||
|
log4j.category.org.apache.catalina.startup.DigesterFactory=ERROR
|
||||||
|
log4j.category.org.apache.catalina.util.LifecycleBase=ERROR
|
||||||
|
log4j.category.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR
|
@ -0,0 +1,20 @@
|
|||||||
|
log4j.rootCategory=INFO,FILE
|
||||||
|
|
||||||
|
PID=????
|
||||||
|
LOG_PATH=${java.io.tmpdir}
|
||||||
|
LOG_FILE=${LOG_PATH}/spring.log
|
||||||
|
LOG_PATTERN=[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${PID} %5p [%t] --- %c{1}: %m%n
|
||||||
|
|
||||||
|
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
|
||||||
|
log4j.appender.FILE.File=${LOG_FILE}
|
||||||
|
log4j.appender.FILE.MaxFileSize=10MB
|
||||||
|
log4j.appender.FILE.layout = org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.FILE.layout.ConversionPattern=${LOG_PATTERN}
|
||||||
|
|
||||||
|
log4j.category.org.hibernate.validator.internal.util.Version=WARN
|
||||||
|
log4j.category.org.apache.coyote.http11.Http11NioProtocol=WARN
|
||||||
|
log4j.category.org.crsh.plugin=WARN
|
||||||
|
log4j.category.org.apache.tomcat.util.net.NioSelectorPool=WARN
|
||||||
|
log4j.category.org.apache.catalina.startup.DigesterFactory=ERROR
|
||||||
|
log4j.category.org.apache.catalina.util.LifecycleBase=ERROR
|
||||||
|
log4j.category.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR
|
@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Configuration status="WARN">
|
|
||||||
<Properties>
|
|
||||||
<Property name="PID">????</Property>
|
|
||||||
<Property name="LOG_PATTERN">[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n</Property>
|
|
||||||
</Properties>
|
|
||||||
<Appenders>
|
|
||||||
<Console name="Console" target="SYSTEM_OUT" follow="true">
|
|
||||||
<PatternLayout pattern="${LOG_PATTERN}"/>
|
|
||||||
</Console>
|
|
||||||
</Appenders>
|
|
||||||
<Loggers>
|
|
||||||
<Logger name="org.hibernate.validator.internal.util.Version" level="warn" />
|
|
||||||
<Logger name="org.apache.coyote.http11.Http11NioProtocol" level="warn" />
|
|
||||||
<Logger name="org.crsh.plugin" level="WARN" />
|
|
||||||
<Logger name="org.apache.tomcat.util.net.NioSelectorPool" level="warn" />
|
|
||||||
<Logger name="org.apache.catalina.startup.DigesterFactory" level="error" />
|
|
||||||
<Logger name="org.apache.catalina.util.LifecycleBase" level="error" />
|
|
||||||
<Logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="error" />
|
|
||||||
|
|
||||||
<Root level="info">
|
|
||||||
<AppenderRef ref="Console"/>
|
|
||||||
</Root>
|
|
||||||
</Loggers>
|
|
||||||
</Configuration>
|
|
@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Configuration status="WARN">
|
|
||||||
<Properties>
|
|
||||||
<Property name="PID">????</Property>
|
|
||||||
<Property name="LOG_PATH">/tmp</Property>
|
|
||||||
<Property name="LOG_FILE">${sys:LOG_PATH}/spring.log</Property>
|
|
||||||
<Property name="LOG_PATTERN">[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n</Property>
|
|
||||||
</Properties>
|
|
||||||
<Appenders>
|
|
||||||
<Console name="Console" target="SYSTEM_OUT" follow="true">
|
|
||||||
<PatternLayout pattern="${LOG_PATTERN}"/>
|
|
||||||
</Console>
|
|
||||||
<RollingFile name="File" fileName="${sys:LOG_FILE}"
|
|
||||||
filePattern="logs/$${date:yyyy-MM}/app-%d{yyyy-MM-dd-HH}-%i.log.gz">
|
|
||||||
<PatternLayout>
|
|
||||||
<Pattern>${LOG_PATTERN}</Pattern>
|
|
||||||
</PatternLayout>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
|
||||||
</Policies>
|
|
||||||
</RollingFile>
|
|
||||||
</Appenders>
|
|
||||||
<Loggers>
|
|
||||||
<Logger name="org.hibernate.validator.internal.util.Version" level="warn" />
|
|
||||||
<Logger name="org.apache.coyote.http11.Http11NioProtocol" level="warn" />
|
|
||||||
<Logger name="org.crsh.plugin" level="warn" />
|
|
||||||
<Logger name="org.apache.tomcat.util.net.NioSelectorPool" level="warn" />
|
|
||||||
<Logger name="org.apache.catalina.startup.DigesterFactory" level="error" />
|
|
||||||
<Logger name="org.apache.catalina.util.LifecycleBase" level="error" />
|
|
||||||
<Logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="error" />
|
|
||||||
|
|
||||||
<Root level="info">
|
|
||||||
<AppenderRef ref="Console"/>
|
|
||||||
</Root>
|
|
||||||
</Loggers>
|
|
||||||
</Configuration>
|
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF8"?>
|
||||||
|
<included>
|
||||||
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||||
|
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||||
|
|
||||||
|
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t{14}]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex"/>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||||
|
<charset>utf8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="CONSOLE" />
|
||||||
|
</root>
|
||||||
|
</included>
|
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF8"?>
|
||||||
|
<included>
|
||||||
|
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||||
|
<property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}"/>
|
||||||
|
<property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } [%t] --- %-40.40logger{39} : %m%n%wex"/>
|
||||||
|
<appender name="FILE"
|
||||||
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${FILE_LOG_PATTERN}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<file>${LOG_FILE}</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_FILE}.%i</fileNamePattern>
|
||||||
|
</rollingPolicy>
|
||||||
|
<triggeringPolicy
|
||||||
|
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||||
|
<MaxFileSize>10MB</MaxFileSize>
|
||||||
|
</triggeringPolicy>
|
||||||
|
</appender>
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="FILE" />
|
||||||
|
</root>
|
||||||
|
</included>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF8"?>
|
||||||
|
<configuration>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/basic-console.xml"/>
|
||||||
|
</configuration>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF8"?>
|
||||||
|
<configuration>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/basic-file.xml"/>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/basic-console.xml"/>
|
||||||
|
</configuration>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF8"?>
|
||||||
|
<configuration>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/basic-file.xml"/>
|
||||||
|
</configuration>
|
@ -1,18 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
This file is the default logback configuration for Spring Boot. To use the same
|
|
||||||
defaults and add custom logger levels you can copy this file and add additional
|
|
||||||
overrides, e.g:
|
|
||||||
|
|
||||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||||
<logger name="org.springframework.web" level="DEBUG"/>
|
|
||||||
...
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
Loading…
Reference in New Issue