Jeroen,

Thanks for more details.

If you set the level of your TraceLogger logger to a very high value, say
"FATAL", then this will effectively block almost all of the trace messages
from TraceLogger and all of its "children".  Log4j supports hierarchical
settings for logger names.  So, settings to "TraceLogger" affect any logger
named "TraceLogger.XXX" where 'XXX' can be any string.

In your code, if you check if the level is enabled (ie isDebugEnabled(),
etc) before logging the message, then this will effectively stop a message
from being logged and conserve computational effort at the source.

Let me know if this is not what you were looking for.
-Mark

> -----Original Message-----
> From: Frissaer, Jeroen [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 24, 2002 1:38 AM
> To: 'Log4J Users List'
> Subject: RE: Stopping logger
> 
> 
> Mark,
> 
> Sorry for not making myself clear.  Here is what I mean:
> I have set the root category to the NullAppender.
> Then I have created two Loggers in my XML properties file : 
> EventLogger and
> TraceLogger that each refer to their own appender.
> 
> In my Java Classes I create loggers with names likes this:
> EventLogger.NameOfClass
> TraceLogger.NameOfClass
> 
> So all these loggers inherit from the EventLogger or the TraceLogger.
> 
> What I want to know is, if it is possible to block for example the
> TraceLogger logger and with this all his children (TraceLogger.Child1,
> TraceLogger.com.Child2, ...), without blocking my EventLogger 
> logger and his
> children (EventLogger.Child1, EventLogger.com.org.Child2, 
> ...) and without
> having to use a NullAppender because this will still invoke 
> computational
> effort.
> 
> Hope this explains it more clearly and thanks for your answers.
> Jeroen
> 
> 
> -----Original Message-----
> From: Mark Womack [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 23, 2002 8:32 PM
> To: 'Log4J Users List'
> Subject: RE: Stopping logger
> 
> 
> Jeroen,
> 
> When you say "children" from EventLogger or TraceLogger, what 
> do you mean?
> When you create the trace instance in your classes, what do 
> you pass in as
> the logger name?  The class name?  Can you give some examples 
> of names that
> are passed?
> 
> -Mark
> 
> > -----Original Message-----
> > From: Frissaer, Jeroen [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 23, 2002 8:45 AM
> > To: Log4j Mailing List (E-mail)
> > Subject: Stopping logger
> > 
> > 
> > Hi everyone,
> > 
> > I'm using a whole bunch of loggers that are children from 
> > EventLogger or
> > TraceLogger.
> > How can I for example stop the logging activity of all 
> > loggers that inherit
> > from the EventLogger?
> > 
> > I know you can shut down logging entirely for all loggers, 
> > but that is not
> > what I want because than also my loggers that inherit from 
> > TraceLogger will
> > be blocked.  I can also reference the EventLogger to a 
> > NullAppender but this
> > will still incure some computational cost for every log 
> > statement made.
> > 
> > Is there a way to stop all functioning of all loggers that 
> > inherit from some
> > base logger without touching all other loggers and without spending
> > "computational energy"??
> > 
> > Thanks in advance
> > Jeroen
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to