Log4j - setting for logging everying grobally
The following example show how to configure log4j configuration file(log4j.properties) to log all messages.
Main point is that rootLogger has to be configured.
1
2
3
4
5
6
7
8
9
10
11
12
log4j.rootLogger=DEBUG, CONSOLE, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=e:\\tmp\\test.log
log4j.appender.R.MaxFileSize=7000KB
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t (%F:%L) - %m%n
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n