Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

log4j two levels at once

Thread view: 
Rey - 10 Feb 2006 22:27 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.