Hello,

On Mon, Mar 7, 2022 at 3:15 PM Pooja Pandey
<pooja.pan...@asg.com.invalid> wrote:
>
> From the questions you posted up to now, you use a lot of custom code 
> extending Log4j 1.x capabilities. In my personal opinion you'll spend more 
> time trying to adapt your code to use the Log4j 1.x bridge, than it would 
> require to migrate to Log4j 2.x.
>
> Almost everything is working in my application now except this "level" 
> setting. Please let me know if you have any idea how to fix this stuff.

Since you want to log messages that are less specific than the level
in the configuration file **or** less specific that a custom level you
set up programmatically, you should look into the global filter:

https://logging.apache.org/log4j/2.x/manual/filters.html

>From the documentation: "Events that are rejected by these filters
will not be passed to loggers for further processing. Once an event
has been accepted by a Context-wide filter it will not be evaluated by
any other Context-wide Filters nor will the Logger's Level be used to
filter the event. " The `Filter` interface [1] has many methods, but
if I am not wrong, you are interested in the `filter(Logger, Level,
Object, Throwable)` method. You can extend `AbstractFilter` for a
default implementation of the remaining methods.

[1] 
https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/Filter.html

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to