Rework logging to prevent double initialization
Prior to this commit LoggingSystem initialization would happen multiple times. Once to configure "quiet" logging, and again to configure correct settings once the Application was initialized. This could cause problems if `logging.groovy` logback files were used. The logging system is now only initialized once (when possible) by following these steps: - Standard logging initialization occurs via the actual logging implementation used (e.g. logback will load a logback.xml file if it exists) - beforeInitization() is called to prevent early log output. Implementations now either use a Filter or simply set the root logging level. - initialize() is called with an optional log configuration file (e.g a custom logback.xml location) and an optional log output file (the default is null indicating console only output). The initialize() method will attempt to prevent double initialization by checking if a standard configuration file exists. Double initialization now only occurs in the following situations: - The user has a standard configuration file (e.g. classpath:logback.xml) but also specifies a logging.config property. Double initialization is required since the specified configuration file supersedes the default. - The user has a standard configuration file (e.g. classpath:logback.xml) and specifies a logging.file property. Double initialization is required since the standard configuration may use a ${LOG_FILE} reference. In addition this commit removes the `logging.console` option and now assumes that logging either occurs only to console or to both the console and a file. This restriction helps simplify the LoggingSystem implementations. If file only logging is required a custom logback.xml can be used. Fixes gh-1091 See gh-1612, gh-1770pull/1815/head
parent
d17b7c8195
commit
cf24af0bfb
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
<!-- logger name="org.springframework.web" level="DEBUG"/-->
|
||||
<!-- logger name="org.springframework.jdbc" level="DEBUG"/-->
|
||||
<!-- logger name="org.springframework.jms" level="DEBUG"/-->
|
||||
</configuration>
|
@ -1,13 +0,0 @@
|
||||
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
|
@ -1,20 +0,0 @@
|
||||
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
|
@ -1,10 +0,0 @@
|
||||
handlers =
|
||||
.level = INFO
|
||||
|
||||
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
|
@ -1,17 +0,0 @@
|
||||
log4j.rootCategory=INFO, CONSOLE
|
||||
|
||||
PID=????
|
||||
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
|
@ -1,25 +0,0 @@
|
||||
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
|
@ -1,20 +1,31 @@
|
||||
log4j.rootCategory=INFO,FILE
|
||||
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.apache.coyote.http11.Http11NioProtocol=WARN
|
||||
log4j.category.org.apache.sshd.common.util.SecurityUtils
|
||||
log4j.category.org.apache.tomcat.util.net.NioSelectorPool=WARN
|
||||
log4j.category.org.crsh.plugin=WARN
|
||||
log4j.category.org.crsh.ssh=WARN
|
||||
log4j.category.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR
|
||||
log4j.category.org.hibernate.validator.internal.util.Version=WARN
|
||||
log4j.category.org.springframework.boot.actuate.autoconfigure.CrshAutoConfiguration=WARN
|
||||
log4j.category.org.springframework.boot.actuate.endpoint.jmx=WARN
|
||||
log4j.category.org.thymeleaf=WARN
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
log4j.rootCategory=INFO
|
||||
|
||||
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.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,37 +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"/>
|
||||
<AppenderRef ref="File"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
@ -1,33 +1,38 @@
|
||||
<?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>
|
||||
<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="File"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
<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>
|
||||
<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.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.crsh.plugin" level="warn" />
|
||||
<logger name="org.crsh.ssh" 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.autoconfigure.CrshAutoConfiguration" level="warn"/>
|
||||
<logger name="org.springframework.boot.actuate.endpoint.jmx" level="warn"/>
|
||||
<logger name="org.thymeleaf" level="warn"/>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console" />
|
||||
<AppenderRef ref="File" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
@ -1,21 +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>
|
||||
<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">
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
@ -1,27 +1,29 @@
|
||||
<?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>
|
||||
</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>
|
||||
<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.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.crsh.plugin" level="warn" />
|
||||
<logger name="org.crsh.ssh" 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.autoconfigure.CrshAutoConfiguration" level="warn"/>
|
||||
<logger name="org.springframework.boot.actuate.endpoint.jmx" level="warn"/>
|
||||
<logger name="org.thymeleaf" level="warn"/>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||
</configuration>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<included>
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
<charset>utf8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
</included>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base-file.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
</configuration>
|
@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base-file.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/file-appender.xml"/>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<root level="INFO">
|
||||
</root>
|
||||
</configuration>
|
@ -1,4 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
</configuration>
|
||||
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.logging;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Base for {@link LoggingSystem} tests.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
public abstract class AbstractLoggingSystemTests {
|
||||
|
||||
@Before
|
||||
public void deleteTempLog() {
|
||||
new File(tmpDir() + "/spring.log").delete();
|
||||
}
|
||||
|
||||
@After
|
||||
public void clear() {
|
||||
System.clearProperty("LOG_FILE");
|
||||
System.clearProperty("PID");
|
||||
}
|
||||
|
||||
protected final String tmpDir() {
|
||||
String path = StringUtils.cleanPath(System.getProperty("java.io.tmpdir"));
|
||||
if (path.endsWith("/")) {
|
||||
path = path.substring(0, path.length() - 1);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +1,17 @@
|
||||
<?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">${sys:LOG_FILE} %d{yyyy-MM-dd HH:mm:ss.SSS}] service%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>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
<Properties>
|
||||
<Property name="PID">????</Property>
|
||||
<Property name="LOG_PATTERN">${sys:LOG_FILE} %d{yyyy-MM-dd HH:mm:ss.SSS}] service%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>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
Loading…
Reference in New Issue