commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter B. West" <>
Subject Re: [logging] setLevel in Jkd14Logger
Date Tue, 13 Apr 2004 03:00:11 GMT

I read the notes on configuration, but it seems to me that level setting 
is not a configuration issues, but a runtime issue.  In my brief 
experience of 1.4 logging, I found that I could not set the level on a 
Logger higher than the initial level at creation, but that I could 
dynamically alter the level to anywhere up to that boundary.  (Don't 
quote me on that - I couldn't find such specific details in the 
documentation.)  Setting the initial and boundary level is a 
configuration issue, but what about later modification?

The capacity to dynamically alter the logging level on a given logger 
seems invaluable to me, especially in a server environment.  It is easy 
enough to implement a default "do nothing" behaviour for loggers that 
don't have dynamic level setting.

I would like to think that the configuration for particular loggers 
could be isolated to the constructors, and that all run-time activity 
could be amalgamated under the wrapper.

Craig McClanahan wrote:
> Peter B. West wrote:
>> SimpleLog has getLevel and setLevel methods, but Jdk14Logger does not. 
>> The underlying Logger supports these methods, but it seems on first 
>> inspection that I can only modify the logging level on an existing 
>> instance by "knowing" that I am running a 1.4 Logger, getting the 
>> native Logger instance, and setting the level on that.
>> Is this the case?  If so, should the Log interface include getLevel 
>> and setLevel, possibly returning null and false respectively when the 
>> underlying implementation does not support level setting?
> The commons-logger package is designed to be an adapter on the actual 
> logging calls to the underlying logging implementation, not the 
> configuration.  It is expected that, if you are using JDK 1.4 logging, 
> then you must use the standard configuration mechanisms for setting up 
> loggers and logging levels.  Likewise, if you're using Log4J, you would 
> use a file.
> The only reason that SimpleLog has a setLevel method is that it, itself, 
> *is* a simple :-) logging implementation so that you can use c-l out of 
> the box.  But configuring any sophisticated logging environment is out 
> of scope for c-l.

Peter B. West <>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message