Return to Snippet

Revision: 3865
at September 24, 2007 20:59 by thebugslayer


Updated Code
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
	<appender name="STDOUT"
			class="ch.qos.logback.core.ConsoleAppender">
		<layout class="ch.qos.logback.classic.PatternLayout">
			<pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
		</layout>
	</appender>

	<!--Basic file appender<appender name="FILE"
		class="ch.qos.logback.core.FileAppender">
		<layout class="ch.qos.logback.classic.PatternLayout">
			<pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
		</layout>
		<File>sample-log.txt</File>
	</appender>-->

        <!--Daily rolling file appender -->
	<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<File>logFile.log</File>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<FileNamePattern>logFile.%d{yyyy-MM-dd}.log</FileNamePattern>
		</rollingPolicy>

		<layout class="ch.qos.logback.classic.PatternLayout">
			<Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
		</layout>
	</appender>
	
	
	<logger name="deng.mysimpleapp">
		<level value="debug" />
	</logger>
	
	<root>
		<level value="error" />
		<appender-ref ref="STDOUT" />
		<appender-ref ref="FILE" />
	</root>
</configuration>

Revision: 3864
at September 24, 2007 20:50 by thebugslayer


Updated Code
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
	<appender name="STDOUT"
			class="ch.qos.logback.core.ConsoleAppender">
		<layout class="ch.qos.logback.classic.PatternLayout">
			<pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
		</layout>
	</appender>

	<!--Basic file appender<appender name="FILE"
		class="ch.qos.logback.core.FileAppender">
		<layout class="ch.qos.logback.classic.PatternLayout">
			<pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
		</layout>
		<File>sample-log.txt</File>
	</appender>-->

        <!--Daily rolling file appender -->
	<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<File>logFile.log</File>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<FileNamePattern>logFile.%d{yyyy-MM-dd}.log</FileNamePattern>
		</rollingPolicy>

		<layout class="ch.qos.logback.classic.PatternLayout">
			<Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
		</layout>
	</appender>
	
	
	<logger name="chapter2">
		<level value="info" />
	</logger>
	
	<root>
		<level value="debug" />
		<appender-ref ref="STDOUT" />
		<appender-ref ref="FILE" />
	</root>
</configuration>

Revision: 3863
at September 24, 2007 20:47 by thebugslayer


Initial Code
<?xml version="1.0" encoding="UTF-8" ?>

<configuration>

	<appender name="STDOUT"
		class="ch.qos.logback.core.ConsoleAppender">
		<layout class="ch.qos.logback.classic.PatternLayout">
			<pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
		</layout>
	</appender>

	<appender name="FILE"
		class="ch.qos.logback.core.FileAppender">
		<layout class="ch.qos.logback.classic.PatternLayout">
			<pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>
		</layout>
		<File>sample-log.txt</File>
	</appender>
	
	<logger name="chapter2">
		<level value="info" />
	</logger>

	<root>
		<level value="debug" />
		<appender-ref ref="STDOUT" />
		<appender-ref ref="FILE" />
	</root>
</configuration>

Initial URL

                                

Initial Description
ch.qos.logback
      logback-classic
      0.9.8

Initial Title
logback.xml configuration with STDOUT and Daily Rolling FILE appender

Initial Tags
java

Initial Language
Java