I am using org.apache.log4j.Logger for logging and I am developing a jsp just for monitoring purposes.
This jsp is using classes that write logs (INFO level) not interesting for this monitoring, but annoying, as long as I want to execute this jsp very often.
So, my question is the next:
Is there any way to disable these INFO logs just for the thread where my jsp is running?
If there is not, maybe this approach might pay the bill:
Is there any way to tell log4j level for one given class is FATAL just for a few milliseconds?
There’s no easy way to do this using simple log4j config.
However, you can have your code install a custom filter on the appropriate logger. See the interface reference here:
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/spi/Filter.html
the filter you want.