Re: The new logging framework and Java 1.4 logging

2004-04-11 Thread Peter B. West
One of the virtues of 1.4 logging is that (subject to security policies, 
I think) the level can be set dynamically.  If I run a *n*x shell 
script, I can arrange to catch signals and, among other things, reset 
the logging level on the fly.  Java logging should offer the same 
capability, especially in embedded situations.  If you are getting some 
strange results from production facility, it would be useful to be able 
to start increasing the logging level in order to get more information, 
and to turn it back down when you have what you want.

1.4 loggers are typically application specific, and will generally be 
named accordingly, e.g., org.apache.fop.Fop. This also allows you to 
have loggers for separate components - org.apache.fop.render.awt, and 
you can fine-tune your logging by package, class or even method.  That's 
my reading, anyway.

Peter

Glen Mazza wrote:
For some reason interface Log (common to all the logging types) does not 
have a "setLevel()"--somehow I think that was intentional, however.  
After all, should FOP actually be setting the logging level?  For 
*embedded use*, that is done by the user--they choose the logger and the 
level they desire, and feed it to FOP via Driver.setLogger().  I'm not 
sure FOP should be altering that level, because that logger could be 
used for many other things in the user's application.  If there's 
messages they don't receive that they actually want, they should adjust 
the logger on their end accordingly.  (OTOH, for command-line usage, 
this may be another story.)
--
Peter B. West 


Re: The new logging framework and Java 1.4 logging

2004-04-11 Thread Glen Mazza
For some reason interface Log (common to all the logging types) does not 
have a "setLevel()"--somehow I think that was intentional, however.  
After all, should FOP actually be setting the logging level?  For 
*embedded use*, that is done by the user--they choose the logger and the 
level they desire, and feed it to FOP via Driver.setLogger().  I'm not 
sure FOP should be altering that level, because that logger could be 
used for many other things in the user's application.  If there's 
messages they don't receive that they actually want, they should adjust 
the logger on their end accordingly.  (OTOH, for command-line usage, 
this may be another story.)

Glen

Peter B. West wrote:

Glen,

I noticed that, but it seems to rather defeat the purpose of having a 
common wrapper in the first place.  It means that at various points in 
my code, I have to drop out and start looking at the particular 
implementation.  I suppose it is still an advantage, in that *most* of 
the code will still be able to log using common calls, but it is not 
tidy.

Peter

Glen Mazza wrote:

There appears a getLogger() that will take you to the native 
java.util.logging instance:
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/impl/Jdk14Logger.html 

 From there, you should be able to call the native setLevel() of the 
1.4 logger:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Logger.html#setLevel(java.util.logging.Level) 






Re: The new logging framework and Java 1.4 logging

2004-04-11 Thread Peter B. West
There is a release candidate for commons-logging v1.4, which includes 
support for Lumberjack logging, i.e., Java1.4 style logging for 1.3 
environments.

Peter
--
Peter B. West 


Re: The new logging framework and Java 1.4 logging

2004-04-11 Thread Peter B. West
Glen,

I noticed that, but it seems to rather defeat the purpose of having a 
common wrapper in the first place.  It means that at various points in 
my code, I have to drop out and start looking at the particular 
implementation.  I suppose it is still an advantage, in that *most* of 
the code will still be able to log using common calls, but it is not tidy.

Peter

Glen Mazza wrote:
There appears a getLogger() that will take you to the native 
java.util.logging instance:
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/impl/Jdk14Logger.html 

 From there, you should be able to call the native setLevel() of the 1.4 
logger:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Logger.html#setLevel(java.util.logging.Level) 
--
Peter B. West 


Re: The new logging framework and Java 1.4 logging

2004-04-11 Thread Glen Mazza
There appears a getLogger() that will take you to the native 
java.util.logging instance:
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/impl/Jdk14Logger.html

From there, you should be able to call the native setLevel() of the 1.4 
logger:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Logger.html#setLevel(java.util.logging.Level)

Glen

Peter B. West wrote:

Glen,

As I read the docs, I can have a Log4J, a JDK1.4, or a SimpleLog, 
depending on 1) my property file or service discovery setup, if any, 
or the default factory discovery method.  The default method 
(LogFactoryImpl) will
1) give me a Log4J logger, if available
2) give me a 1.4 Logger, if available
3) give me a SimpleLog.

If I get the default SimpleLog, which implements Log, I can have 
SetLevel, but if I use the 1.4 logger, I do not have access to the 
corresponding 1.4 facility.  This looks like an oversight in the 
definition of the 1.4 logger.  I'll subscribe to the Commons lists and 
check this.

Peter

Glen Mazza wrote:

I think it's just setLevel() that you're looking for:
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/impl/SimpleLog.html 

Peter B. West wrote:

I see that you have the move to commons-logging.  I was encouraged by
this because of the support for 1.4 logging, which I have started to 
use
in alt-design.  When I looked at modifying the existing alt-design code
to use common-logging, however, I could find no way to set the logging
level on an existing logger, as there is, e.g., in SimpleLog.  I can
specify a default level in commons-logging.properties (I assume - I
haven't tried it), but if I want to dynamically change the level in
response to the options with the existing implementation, I'm stumped.





Re: The new logging framework and Java 1.4 logging

2004-04-11 Thread Peter B. West
Glen,

As I read the docs, I can have a Log4J, a JDK1.4, or a SimpleLog, 
depending on 1) my property file or service discovery setup, if any, or 
the default factory discovery method.  The default method 
(LogFactoryImpl) will
1) give me a Log4J logger, if available
2) give me a 1.4 Logger, if available
3) give me a SimpleLog.

If I get the default SimpleLog, which implements Log, I can have 
SetLevel, but if I use the 1.4 logger, I do not have access to the 
corresponding 1.4 facility.  This looks like an oversight in the 
definition of the 1.4 logger.  I'll subscribe to the Commons lists and 
check this.

Peter

Glen Mazza wrote:
I think it's just setLevel() that you're looking for:
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/impl/SimpleLog.html 

Peter B. West wrote:
I see that you have the move to commons-logging.  I was encouraged by
this because of the support for 1.4 logging, which I have started to use
in alt-design.  When I looked at modifying the existing alt-design code
to use common-logging, however, I could find no way to set the logging
level on an existing logger, as there is, e.g., in SimpleLog.  I can
specify a default level in commons-logging.properties (I assume - I
haven't tried it), but if I want to dynamically change the level in
response to the options with the existing implementation, I'm stumped.
--
Peter B. West 


Re: The new logging framework and Java 1.4 logging

2004-04-11 Thread Glen Mazza
I think it's just setLevel() that you're looking for: 

http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/impl/SimpleLog.html

Glen

Peter B. West wrote:

Glen,

I see that you have the move to commons-logging.  I was encouraged by
this because of the support for 1.4 logging, which I have started to use
in alt-design.  When I looked at modifying the existing alt-design code
to use common-logging, however, I could find no way to set the logging
level on an existing logger, as there is, e.g., in SimpleLog.  I can
specify a default level in commons-logging.properties (I assume - I
haven't tried it), but if I want to dynamically change the level in
response to the options with the existing implementation, I'm stumped.
Does anyone know how to do this?

Peter




The new logging framework and Java 1.4 logging

2004-04-10 Thread Peter B. West
Glen,

I see that you have the move to commons-logging.  I was encouraged by
this because of the support for 1.4 logging, which I have started to use
in alt-design.  When I looked at modifying the existing alt-design code
to use common-logging, however, I could find no way to set the logging
level on an existing logger, as there is, e.g., in SimpleLog.  I can
specify a default level in commons-logging.properties (I assume - I
haven't tried it), but if I want to dynamically change the level in
response to the options with the existing implementation, I'm stumped.
Does anyone know how to do this?

Peter
--
Peter B. West