Changing log level at runtime  
Author Message
Juergen Weber





PostPosted: 2005-1-4 6:49:00 Top

java-programmer, Changing log level at runtime You know the situation: logging output is useless .. until you need it.

Is there a way to configure log4j in a web application or an EJB with
log level ERROR and have it change to DEBUG whenever an error happens?

The only thing I can imagine is having a special servlet that you have
to call with the browser to have it trigger a log level change for the
whole web application.

Are there better ways? Maybe with the jdk built-in logger?

Or with log4j JMX? But I could not find any docs or examples.

Thx,
Juergen
 
Ryan Stewart





PostPosted: 2005-1-4 7:52:00 Top

java-programmer >> Changing log level at runtime "Juergen Weber" <email***@***.com> wrote in message
news:email***@***.com...
> You know the situation: logging output is useless .. until you need it.
>
> Is there a way to configure log4j in a web application or an EJB with log
> level ERROR and have it change to DEBUG whenever an error happens?
>
> The only thing I can imagine is having a special servlet that you have to
> call with the browser to have it trigger a log level change for the whole
> web application.
>
> Are there better ways? Maybe with the jdk built-in logger?
>
> Or with log4j JMX? But I could not find any docs or examples.
>
Do what? Things that should be logged when an error occurs should be logged
at the ERROR level. If you find yourself receiving insufficient information,
either rethink your logging or create another logger that logs at a lower
level to a different location, like a RollingFileAppender with a small size
and just one or two backups if you're worried about eating up a lot of
space.


 
Juergen Weber





PostPosted: 2005-1-5 6:50:00 Top

java-programmer >> Changing log level at runtime OK, found what I was looking for:

http://www.codeczar.com/products/logweb/