On Oct 9, 2005, at 2:11 AM, Zsolt wrote:
Hi, I use 1.2.12. I would like to define two loggers. The first one should contain everything, the second only the errors. How can I do that? Zsolt
log4j-user would be the appropriate mailing list for that. [email protected] is for discussion on matters that affect more than one of the Logging Services projects. If you have follow up, please repost to that mailing list and not [EMAIL PROTECTED]
I don't have time to discuss the scenario at the moment, but I might start you down the right path and rereading the Short Intro or other documentation might make more sense.
It would be uncommon and undesirable to have separate loggers for different severities (info, warn, debug, etc). Loggers typically correspond to implementation classes (for example, com.example.gui.SomeWidget) or some particular topic (database, security). Think of a logger as a topic of conversation and the level as the tone of voice of speaker.
It would be common to have multiple appenders attached to the same logger but differing in the threshold of messages they process. A way to think of it would be if court reporter and a newspaper writer were listening to the same testimony in a court of law. The court reporter would attempt to write down everything that was said, the newspaper writer would only take notes when he thought the testimony was interesting and would discard most of the things he heard.
In your situation, I would suggest attaching two appenders (like a listener to a conversation) to the root logger and setting the threshold of one of the appenders to ERROR.
