25 March 2011

log4j.properties log to console example

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.rootLogger=debug , stdout

in line  log4j.rootLogger=debug , stdout
debug you can replace to any log4j levels
 stdout is name of appender which you can change to any.