How about using two categories
Category catUser = Category.getInstance(className.class.getName() +
".user");
Category catSystem = Category.getInstance(className.class.getName() +
".system");
Then you could set different appenders to the different categories.
You could log user events like this:
catUser.info("this is a user message");
and system events:
catSystem.info("this is a system event");
my2cents
Mark Russell
PNC
412-768-9603
"Sam Newman"
<sam.newman@stam To: "LOG4J Users Mailing List"
<[EMAIL PROTECTED]>
plets.com> cc:
Subject: Re: Multiple Appenders
07/25/01 05:47
AM
Please respond
to "LOG4J Users
Mailing List"
My understanding is that a priority level applies to the category, not the
appenders. What about using 2 categories for the same hierarchy (I asume
root), and then attach the FileAppender to one, and the SMTPAppender to the
other?
I actually want to use 2 categories for the same classes hierarchy myself.
What I'm after is for user generated events to go to one set of appenders,
and system stuff to go to another set of appenders. Is there any problems
anyone can see with using 2 categories in this way (bearing in ind one
class
could generate both user and system log entries)?
sam
----- Original Message -----
From: "Naresh Sharma" <[EMAIL PROTECTED]>
To: "log4j mailing list" <[EMAIL PROTECTED]>
Sent: Wednesday, July 25, 2001 10:43 PM
Subject: Multiple Appenders
> Hello Everybody,
>
> I have 2 appenders FileAppender and SMTPAppender now I wish that debug,
> info and warn priority messages to be sent to the file specified with
> FileAppender but Error and fatel priority message should be logged by
> SMTPAppender. Is this possible with Log4J?
>
>
> Thanks
> Naresh
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]