[ 
https://issues.apache.org/jira/browse/LOG4J2-3437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17507617#comment-17507617
 ] 

Pooja Pandey commented on LOG4J2-3437:
--------------------------------------

[~pkarwasz], other than above, we have below use case scenario and trying to 
figure out solution.

 

Requirement:

We are trying to migrate our application from log4j1.x to log4j2.x using 
log4j1.x bridge 2.17.2.

We have many loggers and each logger is running in its own thread with its own 
log level threshold.

The approach used here is to capture the threshold setting as a thread local 
variable. The value 
of the variable is used in an override of the getEffectiveLevel method from 
log4j’s Logger 
class. log4j uses getEffectiveLevel internally to determine the threshold for 
logging 
messages. The net effect of this approach is that a body of code can set the 
threshold at a 
higher logical level of the code and all lower level code invoked by that level 
will respect the 
lower threshold without needing be otherwise told. On exit from the high level 
function, it must 
clear the threshold setting so that other operations that reuse the thread do 
not encounter a 
spurious setting.

 

Above requirement is not getting fulfilled with just bridge approach because it 
looks like that getEffectiveLevel() is not getting called internally.

 

Please let me know if you have any idea about the solution.

> Log4j 1.x bridge Request to support programmatically configuring Log4j.
> -----------------------------------------------------------------------
>
>                 Key: LOG4J2-3437
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3437
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Log4j 1.2 bridge
>    Affects Versions: 2.17.2
>            Reporter: Pooja Pandey
>            Priority: Major
>
> As per log4j migration documentation 
> ([https://logging.apache.org/log4j/2.x/manual/migration.html),|https://logging.apache.org/log4j/2.x/manual/migration.html)]
>  I understand that currently log4j 1.x bridge 2.17.2 doesn't support 
> programmatically configuring log4j appenders.
> *#### Limitations of the Log4j 1.x bridge*
>  # *They must not programmatically configure Log4j.*
>  
> In our application, we have a requirement where we need to add many 
> FileAppender programmatically with various log threshold values.
>  
> Hoping to get this feature supported in future versions for log4j1.x bridge.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to