You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2019/07/29 02:49:00 UTC
[jira] [Resolved] (LOG4J2-1933) Not able to init config with
JsonConfiguration class while the json config nodes are in random order
[ https://issues.apache.org/jira/browse/LOG4J2-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ralph Goers resolved LOG4J2-1933.
---------------------------------
Resolution: Won't Fix
Closing as won't fix. We have documented the order that is required and everything is working as designed.
> Not able to init config with JsonConfiguration class while the json config nodes are in random order
> ----------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-1933
> URL: https://issues.apache.org/jira/browse/LOG4J2-1933
> Project: Log4j 2
> Issue Type: Bug
> Components: Configurators
> Affects Versions: 2.8.1
> Environment: Linux - CentOS 6
> Reporter: Roman Sosnin
> Priority: Major
>
> Failing to initialize log4j2 configuration dynamically - supplying a JSON configuration node while json nodes are in random order.
> For example, this one works for me:
> "configuration": {
> "status":"...",
> "name":"...",
> "properties":"...",
> "appenders":"...",
> "loggers":"..."
> }
> But this one fails:
> "configuration": {
> "status":"...",
> "name":"...",
> "appenders":"...",
> "loggers":"...",
> "properties":"..."
> }
> PAY ATTENTION: "properties" node is the last node and not 3rd.
> Initializing the config programmatically this way:
> JsonNode logObject = ConfigManager.getInstance().getContainerDefinition().at(CONFIG_LOGGING_JAVA_NODE);
> InputStream stream = new ByteArrayInputStream(logObject.toString().getBytes());
> ConfigurationSource source = new ConfigurationSource(stream);
> Configuration ourConfig = new JsonConfiguration(LoggerContext.getContext(), source);
> Configurator.initialize(ourConfig);
> where logObject is the actual log4j2 JSON config node.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)