tags:

views:

885

answers:

1

I have a simple web app running on Tomcat 5.5 with log4j for logging. Occasionally I need to push the logging down to DEBUG but most of the time I'm happy with INFO.

I can change my config xml and restart the app but I would prefer to switch the log levels on the fly. Is there a standard technique for this?

+1  A: 

Just use the programmatic API:

logger.setLevel(Level.DEBUG)

in your program when you need more verbose logging output, and

logger.setLevel(Level.INFO)

to make it less verbose again.

Vinay Sajip
If you're using weblogic they have a drop-in JSP that allows you to adjust all running loggers using this API.
Dave Patteson