You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Tom (JIRA)" <ji...@apache.org> on 2016/10/26 09:27:58 UTC

[jira] [Created] (LOG4J2-1652) Shutdown only works correctly once

Tom created LOG4J2-1652:
---------------------------

             Summary: Shutdown only works correctly once
                 Key: LOG4J2-1652
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1652
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.7, 2.6.2
         Environment: Java 8
            Reporter: Tom


I am trying to reset log4j via the following code at runtime in order to write to new logfiles in newly specified directory. 

{code:title=|borderStyle=solid}
final LoggerContext context = (org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false);
Configurator.shutdown(context);

// Init and reset
Configurator.initialize("", logConfigFile);
context.setConfigLocation(file.toURI());
{code}

Unfortunately, this only works once correctly. After the second shutdown, new logging files are created but the output is still written to the old files. 
	
		



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

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org