I know I can have a category with a level of DEBUG writing only its INFO and higher messages to an appender by setting the appender’s Threshold to INFO.
Is it at all possible to do the opposite?
I want to be able to have a category writing its INFO and above messages to the rootLogger, while its DEBUG and above messages are written to a specific appender. This would enable me to have a summary of the events in the main log file, while the detail of the events are available in a specialised log file.
I’ve tried setting the category’s level to INFO and then setting the threshold of the specific appender to DEBUG, however since the category isn’t printing any DEBUG messages, only INFO and above messages end up in the appender.
is there a way to achieve what I’m describing above?
Thanks, p.
If you are using log4j XML configuration file, then fine grain control can be taken based on level using filter. Filter usages are not possible though via property file.
Using filter, you can associate required level(s) to specific appenders so as to distribute into different files.
List of all log4j filters can be found at: log4j filters