[ 
https://issues.apache.org/jira/browse/LOG4J2-1316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Justin Knowles updated LOG4J2-1316:
-----------------------------------
    Description: 
The LoggerContextRule when used with JUnit @Rule annotation to provide 
isolation between tests only logs the first test successfully.  Subsequent 
tests do not log at all.

The issue appears to be with the call to `Configurator.shutdown(context);`.  It 
seems to prevent future calls to `Configurator.initialize(...` from working 
properly.  I have not seen any indication that repeated cycles of calls to 
`Configurator.initialize` and `Configurator.shutdown` should not create working 
contexts.

As a test, I removed Configurator.shutdown and this resulted in the expected 
behavior.  I assume that is not a legitimate fix seeing that it would leak 
active contexts.

  was:
The LoggerContextRule when used with JUnit @Rule annotation to provide 
isolation between tests only logs the first test successfully.  Subsequent 
tests do not log at all.

The issue appears to be that the call to `Configurator.shutdown(context);`.  It 
seems to prevent future calls to `Configurator.initialize(...` from working 
properly.  I have not seen any indication that repeated cycles of calls to 
`Configurator.initialize` and `Configurator.shutdown` should not create working 
contexts.

As a test, I removed Configurator.shutdown and this resulted in the expected 
behavior.  I assume that is not a legitimate fix seeing that it would leak 
active contexts.


> LoggerContextRule doesn't work with @Rule when multiple tests log. 
> -------------------------------------------------------------------
>
>                 Key: LOG4J2-1316
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1316
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.5
>            Reporter: Justin Knowles
>            Priority: Minor
>              Labels: junit, test
>
> The LoggerContextRule when used with JUnit @Rule annotation to provide 
> isolation between tests only logs the first test successfully.  Subsequent 
> tests do not log at all.
> The issue appears to be with the call to `Configurator.shutdown(context);`.  
> It seems to prevent future calls to `Configurator.initialize(...` from 
> working properly.  I have not seen any indication that repeated cycles of 
> calls to `Configurator.initialize` and `Configurator.shutdown` should not 
> create working contexts.
> As a test, I removed Configurator.shutdown and this resulted in the expected 
> behavior.  I assume that is not a legitimate fix seeing that it would leak 
> active contexts.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to