[
https://issues.apache.org/jira/browse/LOG4J2-2151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16290803#comment-16290803
]
none commented on LOG4J2-2151:
------------------------------
I think reconfigure just reloads everything where as in log4j 1.x
PropertyConfigurator would reload the file but wouldn’t reload it as fresh.
I’m wondering is there anything similar to PropertyConfigurator as it seems
that a configuration.iniialise will only work once then it won’t reload the
file.
Or can a new property be added so that it doesn’t reload it as new instead just
reload the file like PropertyConfiguarator did.
> Help with migrating from log4j1 to log4j2
> -----------------------------------------
>
> Key: LOG4J2-2151
> URL: https://issues.apache.org/jira/browse/LOG4J2-2151
> Project: Log4j 2
> Issue Type: Bug
> Reporter: none
>
> Hi, im trying to migrate from log4j 1 to 2.
> Im having problems with migrating from the propertyconfigurator.
> Doing something like
> @SuppressWarnings("unchecked")
> private static void reset() throws MalformedURLException,
> URISyntaxException {
> LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
> Configuration config = ctx.getConfiguration();
> for (LoggerConfig loggerConfig : config.getLoggers().values()) {
> loggerConfig.setLevel(null);
> }
> Configurator.shutdown(ctx);
> String path = System.getProperty(JAVA_OPTIONS_LOG_CONFIG);
> if (Strings.isNullOrEmpty(path)) {
> ConfigurationSource source =
> ConfigurationSource.fromResource(LOG_CONFIGURATION, null);
> Configurator.initialize(null, source);
> } else {
> URL in = new URL(path);
> Configurator.initialize((String) null, null, in.toURI());
> }
> ctx.updateLoggers();
> }
> kinds of works but then it closes my other appenders that i started with java.
> See https://gerrit-review.googlesource.com/#/c/gerrit/+/142811/
> please could i have some help as i've spent two weeks on this and havent
> really moved on.
> We need to reset the loggers back to default when we do
> for example
> ssh -p 29418 admin@localhost gerrit logging set-level \
> debug com.google.
> ssh -p 29418 admin@localhost gerrit logging set-level \
> reset
> and also i found that even though i specified ConsoleAppender in
> log4j2.properties (resources folder in java) it dosen't seem to show any of
> gerrit logging when starting.
> To work around this i am adding ConsoleAppender through the ErrorLog class.
> (Sorry if this is the wrong place to ask this but i couldn't find any where
> else).
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)