Different log4j patterns on the same same file depending on log level?

Posted by gorca on Stack Overflow See other posts from Stack Overflow or by gorca
Published on 2010-04-07T00:07:45Z Indexed on 2010/04/07 0:13 UTC
Read the original article Hit count: 574

Filed under:
|

Hi,

I'd like for log events of type WARN or higher to show the class name. All others would not show the class name. this is both to simplify the log and to not have the performance hit on lower events such as TRACE. This must all go to the same log file.

For example, right now, I have this on my log file:

2010-04-06 18:50:16,416 [main] INFO org.nyjord.lib.gather.TempMachine - initialised successfuly. 2010-04-06 18:50:16,416 [main] FATAL org.nyjord.lib.gather.TempMachine - not all paths could be located

I would prefer this ON THE SAME FILE:

2010-04-06 18:50:16,416 [main] INFO - initialised successfuly. 2010-04-06 18:50:16,416 [main] FATAL org.nyjord.lib.gather.TempMachine - not all paths could be located

Help would be really welcome.

© Stack Overflow or respective owner

Related posts about log4j

Related posts about java