Tag: log4j/slf4j

log4j - xml config

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>

	<!-- declare output to console -->
	<appender name="console" class="org.apache.log4j.ConsoleAppender">
		<layout class="org.apache.log4j.PatternLayout">
			<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
		</layout>
	</appender>

	<!-- declare output to file -->
	<appender name="file" class="org.apache.log4j.RollingFileAppender">
		<param name="append" value="false" />
		<param name="maxFileSize" value="10MB" />
		<param name="maxBackupIndex" value="10" />
		<param name="file" value="${catalina.home}/logs/myStruts1App.log" />
		<layout class="org.apache.log4j.PatternLayout">
			<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
		</layout>
	</appender>

	<!-- set common log level -->
	<root>
		<level value="ERROR" />
		<appender-ref ref="console" />
		<appender-ref ref="file" />
	</root>

	<!-- set log level for custom packages -->
	<logger name="org.iblogger.lbn">
		<level value="DEBUG"/>
	</logger>

</log4j:configuration>