tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject Re: [Logging] Facility Specific Properties
Date Mon, 23 Jun 2008 16:53:59 GMT
SNIP

> Close to that. Since "Catalina" and "localhost" are names of elements in 
> server.xml, and those names can be changed, this logger name is 
> generated dynamically. So you won't find it verbosely in the code. Look 
> at method logName() in ContainerBase.java.

Thanks for the tip - I will do.

> No, the call log.info(SOMETHING) will need to calculae something, before 
> it really calls the error method of the logger, which then immediately 
> might notice, that the configured log level doesn't allow handling an 
> info message.
> 
> Now SOMETHING is quite often not a simple string, but e.g. a localised 
> message, an exception text, a string concatenation containing some 
> variable data etc. Java will first calculate SOMETHING, before it jumps 
> into the logger method. If you have a lot of debug log statements, which 
> get called during every request, it will have a noticeable impact on 
> performnce.

OK - I get it ... hopefully :-).  We want to do something like:

if (log.isDebugEnabled())
{
   //Calculate SOMETHING - Very expensive
   String SOMETHING = SOMETHINGA + SOMETHINGELSE;
   log.debug(SOMETHING);
}

So if we are only interested in SEVERE messages, then it seems like it would be a good thing
to set all of the Tomcat loggers to only log severe messages?  Is there a simple way to do
that?  I would think that the Tomcat loggers get their log level from a root logger, and that
if I set the log level on that logger, then it automatically sets it on all the other loggers,
unless I directly override the logging level as with Facility specific properties?

> Warnings are not frequent enough to justify the if statement.

So I assume the logic is that most running instances will be interested in warnings, hence
just skip the if?
 
SNIP
 
> 
>> 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?
> 
> Hmmm, didn't get the point.

That's OK.  I didn't either :-).

SNIP

> 
> But: the loggers with the strange names 
> ...Catalina...localhost...mycontext are generated for each context, and 
> can be used by the webapp developer as part of the servlet API (the 
> context logger). So the webapp producer might have some documentation, 
> what kind of log messages he creates at which level.

OK - so /mywebapp could grab the Logger for the /manager context and make logging calls on
it, which assuming the default configuration would end up in the manager prefixed log?

> 
>> 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...?
> 
> Yes, maybe.

I guess when the day comes for mucking, I'll know it :-).

Thanks again,
- Ole

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


Mime
View raw message