Last active
October 21, 2015 01:51
-
-
Save chenrui333/1f147b520635e73936ca to your computer and use it in GitHub Desktop.
logback.xml sample config
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.xml sample config |
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
<plugin> | |
<groupId>org.mortbay.jetty</groupId> | |
<artifactId>jetty-maven-plugin</artifactId> | |
<configuration> | |
<systemProperties> | |
<force>true</force> | |
<!--hook up with logback config for testing--> | |
<systemProperty> | |
<name>org.eclipse.jetty.util.log.Log</name> | |
<value>org.eclipse.jetty.util.log.Slf4jLog</value> | |
</systemProperty> | |
<systemProperty> | |
<name>logback.configurationFile</name> | |
<value>src/main/resources/logback.xml</value> | |
</systemProperty> | |
<systemProperty> | |
<name>spring.profiles.active</name> | |
<value>qa</value> | |
</systemProperty> | |
<systemProperty> | |
<name>env.name</name> | |
<value>qa</value> | |
</systemProperty> | |
</systemProperties> | |
<jettyXml>src/test/resources/jetty/jetty-env.xml</jettyXml> | |
<jvmArgs> | |
-Xms512m -Xmx2048m | |
-Xdebug -Xnoagent -Djava.compiler=NONE | |
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9191 | |
</jvmArgs> | |
<webApp> | |
<contextPath>/clmanager</contextPath> | |
</webApp> | |
<stopPort>9999</stopPort> | |
<stopKey>foo</stopKey> | |
<!-- the following option will grab provided dependecies (like | |
ojdbc.jar) and put it on jetty's classpath --> | |
<useProvidedScope>true</useProvidedScope> | |
<scanIntervalSeconds>5</scanIntervalSeconds> | |
</configuration> | |
</plugin> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder> | |
<charset>UTF-8</charset> | |
<Pattern>%d %-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern> | |
</encoder> | |
</appender> | |
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<file>clmanager.log</file> | |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
<!-- daily rollover. Make sure the path matches the one in the file element or else | |
the rollover logs are placed in the working directory. --> | |
<fileNamePattern>clmanager_%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> | |
<maxFileSize>5MB</maxFileSize> | |
</timeBasedFileNamingAndTriggeringPolicy> | |
<!-- keep 30 days' worth of history --> | |
<maxHistory>30</maxHistory> | |
</rollingPolicy> | |
<encoder> | |
<charset>UTF-8</charset> | |
<pattern>%d %-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> | |
</encoder> | |
</appender> | |
<logger name="com.xyz.abc" level="debug" additivity="false"> | |
<appender-ref ref="STDOUT"/> | |
<appender-ref ref="FILE"/> | |
</logger> | |
<root level="info"> | |
<appender-ref ref="STDOUT"/> | |
</root> | |
</configuration> |
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
<slf4j.version>1.7.12</slf4j.version> | |
<logback.version>1.1.3</logback.version> | |
<!--logging dependencies--> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-api</artifactId> | |
<version>${slf4j.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>ch.qos.logback</groupId> | |
<artifactId>logback-classic</artifactId> | |
<version>${logback.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>ch.qos.logback</groupId> | |
<artifactId>logback-core</artifactId> | |
<version>${logback.version}</version> | |
</dependency> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment