Changing the level of a journal message in a library

Our application is made up of many libraries, all of which use log4j for logging. The library designer has chosen levels for log messages to be displayed, but they do not necessarily correspond to our needs. For example, an error message for a library developer, perhaps for our application, is just an informational message.

Is it possible to create a mapping from one level to another for a specific application?

+3
source share
1 answer

The only thing I can think of is to implement a custom layout that changes the level of the incoming message log to suit your needs. The layout is not intended for this, so it is a hack to use it that way, but it works. I posted a custom layout example in this previous post . It is designed for another purpose, but it is easy to adapt to your needs.

+2
source

Source: https://habr.com/ru/post/1752225/


All Articles