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

David del Amo Mateos updated LOG4J2-2134:
-----------------------------------------
    Attachment: Log4j2RefreshTest.java
                log4j2.yml

Test files

> Stackoverflow at AwaitCompletionReliabilityStrategy
> ---------------------------------------------------
>
>                 Key: LOG4J2-2134
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2134
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.8.2, 2.9.1
>         Environment: not important
>            Reporter: David del Amo Mateos
>            Priority: Blocker
>         Attachments: Log4j2RefreshTest.java, log4j2.yml
>
>
> Hi, I have a need to change the configuration of log4j2 programatically after 
> automatic configuration following the instructions at 
> https://logging.apache.org/log4j/2.x/manual/customconfig.html.
> To fullfill my requirements I need to stop the context and restart it with my 
> proper config, when I do this and try to write a log the 
> AwaitCompletionReliabilityStrategy enters in a bucle and throws a 
> Stackoverflow exception.
> I've developed a Unit test that recreates the problem:
> {quote}{{
>       @Test
>       public void testRefresh() {
>         Logger log = LogManager.getLogger(this.getClass());
>         final LoggerContext ctx = (LoggerContext) 
> LogManager.getContext(false);
>         final Configuration config = ctx.getConfiguration();
>         PatternLayout layout = 
> PatternLayout.createLayout(PatternLayout.SIMPLE_CONVERSION_PATTERN, null, 
> config, null,
>             null,false, false, null, null);
>         Appender appender = FileAppender.createAppender("target/test.log", 
> "false", "false", "File", "true",
>             "false", "false", "4000", layout, null, "false", null, config);
>         appender.start();
>         config.addAppender(appender);
>         AppenderRef ref = AppenderRef.createAppenderRef("File", null, null);
>         AppenderRef[] refs = new AppenderRef[] {ref};
>         LoggerConfig loggerConfig = LoggerConfig.createLogger("false", 
> Level.INFO, "testlog4j2refresh",
>             "true", refs, null, config, null );
>         loggerConfig.addAppender(appender, null, null);
>         config.addLogger("testlog4j2refresh", loggerConfig);
>         ctx.stop();
>         ctx.start(config);
>         
>         log.error("Info message");
>       }
> }}{quote}
> I don't know if I can submit files to this system, but have the test and a 
> little patch that prevents this problem checking in 
> AwaitCompletionReliabilityStrategy:94 if next and result is equals and 
> returning result in this case.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to