Rainer Jung wrote:
SNIP

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager] is the name of a logger, in this case the name of the logger associated with the context /manager in host localhost in Engine Catalina.

Most loggers get their names from class names, but context loggers are special cases.

OK - I think I got that. So I imagine if we grep the tomcat code for 'org.apache.catalina.core.ContainerBase.[Catalina].[localhost]' I'll find some Logging initialization lines that use that string as the name of their logger?
Loggers usually check their configured log level before calling the log method (for FINE/FINEST, resp. DEBUG/TACE).

CASE A:
OK - So if I'm logging with myLogger and I say myLogger.warn('This is a 
warning'); and the logger's level is set to OFF, then the logger will do 
minimal work in terms of passing the record to the handler?  The reason I 
mention it is because the below seems to indicate a different approach (CASE B).

The way this is done, is that the developer using the logger checks with an if statement, if the level is at least the one the message has.

CASE B:
So the tomcat developer has to write something like:

if (myLogger.getLevel() >= Level.WARNING)
{
myLogger.warn('This is a warning'); }

That way, the message doesn't need to be concatenated as a string when the configured level will not generate the message.

I'm just thinking about how I would implement Logger.warn...  I think I would 
do it like this:

public warn(String message)
{
  if (this.level > Level.WARNING)
{
//Now do work to put together a concatenated message
}
//Otherwise this loggers level is not really set to high enough
//so we just return     
}

Seems like a plausible way to implement, that way if statements are not needed 
outside of the logger.  Just want to make sure I'm not missing something...?

This is especially important for debug messages. The developer has no possibility to check the handlers level in the code, because the handler as an object is more in the realm of the administrator).

From what I understand the developer could do something like List<Handler> 
handlers = myLogger.getHandlers() and check their levels that way.  Hope I don't seem 
non appreciative of your help.  I rarely use logging myself, so I'm just trying to 
make sure I understand everything correctly?

It seems that the only rational for tweaking the level of the loggers in the 
logging configuration is to make the logging calls even less expensive?  So for 
example I could do:

Logger myLogger = LogManager.createLogger(the.name.of.this.class);
myLogger.setLevel = Level.WARNING;

Because I know that I'll only be doing myLogger.warn('This is really severe');  
type messages.  Then if someone wanted to make my logging calls really 
efficient they could just set the level of my logger to SEVERE and since I only 
make warn calls on myLogger, all the calls will be as efficient as possible 
with Java logging...without removing the logging statement completely that is?

Given that the tomcat logging documentation does not go into tweaking the log levels of 
all the loggers, I assume that this is something that would yield very little utility?  
To be honest I'm still scratching my head on why I'd want to muck around with the 
Facility Specific Properties...Maybe the documentation just mentioned them to say 
"Here - See - You can Muck!" and then didn't say anything else because theres 
no point in mucking...?

SNIP

Thanks again,
- Ole


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to