[ 
https://issues.apache.org/jira/browse/LOG4J2-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16078794#comment-16078794
 ] 

Ralph Goers commented on LOG4J2-1933:
-------------------------------------

Although json.org says an object is an unordered set of key/value pairs, the 
actual standard - 
http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf - 
does not. Instead, it specifically says that lists/arrays are ordered but makes 
no mention of it. Since JSON stands for JavaScript Object Notation, it is also 
prudent to understand what Javascript expects. According to 
http://www.ecma-international.org/ecma-262/6.0/  Object property names are to 
be ordered in the following way: integer-like Strings in ascending order, 
non-integer-like Strings in creation order, Symbols in creation order. Of 
course, this implies that JSON needs to adhere to that order for Javascript 
objects to be properly serialized and deserialized.

Based on that, I see nothing wrong with our current implementation.

> 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
>
> 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
(v6.4.14#64029)

Reply via email to