views:

33

answers:

1

Our application is made up of tons of libraries, all of which use log4j for logging. The developer of the libraries chose levels for the log messages that are output, but they don't necessarily match with our needs. For example, an error message for the library developer is perhaps for our application just an informational message.

Is it possible to create a mapping from one level to another for a certain appender?

+1  A: 

The only way I can think of is to implement a custom layout which changes the log level of incoming messages according to your needs. The layout is not meant for this, so it is a hack to use it this way, but it works. I published an example of a custom layout in this earlier post of mine. It is made for a different purpose, but is easy to adapt it to your needs.

Péter Török
Thanks for the pointer. That's probably too heavyweight of a solution for our situation, but I fear it might be the only solution.
scompt.com