Re: Log level settings are not working correctly and getting wrong value

"Piotr P. Karwasz" <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAFmygFaAAMKsj6S8qLO_+jC5gYLJezUVcYfqPLR-wMePhEoAsA@mail.gmail.com>
Hello Pooja,

On Mon, Mar 7, 2022 at 11:23 AM Pooja Pandey
<[email protected]> wrote:
> I think there is something wrong with Log4j1.x bridge level handling when migrating from log4j1.x to log4j2.x.
>
> Issue: In my config file, log level is set to "Error",  but with log4j1.x bridge log level is getting calculated as DEBUG. I think this is since in log4j1.x from FATAL to DEBUG level integer value decreases as shown below but in log4j2.x from FATAL to DEBUG integer value increases as shown below.

The order of Log4j 2.x numerical levels is the inverse of the Log4j
1.x order. However, that should have no influence on the result of
`org.apache.log4j.Category#getEffectiveLevel()`, if that is the
function you are referring to.

If I recall correctly, you are using a custom `Logger` class. My guess
is that you overrode the `getEffectiveLevel()` with some custom logic.
Be aware that in the Log4j 1.x bridge the field `Category#level` is
almost always `null`, while `Category#getLevel()` is an alias for
`Category#getEffectiveLevel()` (never `null`).

If that is not the case, can you run your application with
`-Dlog4j2.debug=true` and send you configuration file and the output
of the status logger (it's printed to the application's standard
error)?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.