Does Log4j offers setting up output for the same class/package - INFO to
console and DEBUG to file?
Ian Mills - 11 Feb 2006 09:21 GMT
> Does Log4j offers setting up output for the same class/package - INFO to
> console and DEBUG to file?
I would suggest you look at the log4j newsgroups but as far as I know
you can setup two appenders, one for writing to a file and one for
writing to the console, and then set different logging levels on each.
ossie.moore@gmail.com - 12 Feb 2006 06:03 GMT
You can do that and so much more. Example.. for both the default logger
and for any particular class, you can setup multiple loggers, at
different levels.
Example...
Say you have a program doing something odd and you want to debug a
particular class. You could set the default logger to "INFO" for
Console, "WARN" for file. Then, add an entry for the suspect class to
log at "DEBUG" for Console. This way, you'd see DEBUG messages on the
console for that particular class. Heck, you could even send DEBUG
level logging for a particular class to say syslog while having another
class send DEBUG to another file. You can also vary the format of the
log messages from appender to appender.