What is the easiest way to get started with log4j configuration?
+4
A:
Put a file named log4j.properties
in the root of your classpath:
log4j.rootLogger = ALL, Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.conversionPattern=%m%n
Nothing else is needed. Log4j will discover it and configure itself.
flybywire
2010-01-24 18:29:31
+4
A:
It's worth reading the manual (at the risk of stating the obvious). There are a ton of configuration options, and once you learn and understand what's possible, then you can implement some very powerful logging systems.
Brian Agnew
2010-01-24 18:34:45
+5
A:
The absolute easiest way is to visit the log4j pages at apache and read the short introduction. They have a sample log4j.configuration ready to be copied and pasted.
Andreas_D
2010-01-24 19:00:07