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

takeseem commented on LOG4J2-1034:
----------------------------------

if allow unquoted field names and allow sigle quotes, it's look more nice:)
EX:
{code}
{
        "configuration": {
                "status": "error",
                "name": "RoutingTest",
                "packages": "org.apache.logging.log4j.test",
                "properties": {
                        "property": {
                                "name": "filename",
                                "value" : 
"target/rolling1/rollingtest-$${sd:type}.log"
                        }
                },
                "loggers": {
                        "logger": {
                                "name": "EventLogger",
                                "level": "info",
                                "additivity": "false",
                        "AppenderRef": {
                                "ref": "Routing" 
                        }
                        },
                        "root": {
                                "level": "error",
                                "AppenderRef": {
                                        "ref": "STDOUT"
                                }
                        }
                }
        }
}
{code}

allow unquoted field names and allow sigle quotes
{code}
{
        configuration: {
                status: 'error',
                name: 'RoutingTest',
                packages: 'org.apache.logging.log4j.test',
                properties: {
                        property: {
                                name: 'filename',
                                value : 
'target/rolling1/rollingtest-$${sd:type}.log'
                        }
                },
                loggers: {
                        logger: {
                                name: 'EventLogger',
                                level: 'info',
                                additivity: 'false',
                        AppenderRef: {
                                ref: 'Routing' 
                        }
                        },
                        root: {
                                level: 'error',
                                AppenderRef: {
                                        ref: 'STDOUT'
                                }
                        }
                }
        }
}
{code}
like javascript style!

> JsonConfiguration.getObjectMapper may more friendly to json
> -----------------------------------------------------------
>
>                 Key: LOG4J2-1034
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1034
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Configurators
>    Affects Versions: 2.3
>            Reporter: takeseem
>            Priority: Minor
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> Thanks.
> It's a good idea for JsonConfiguration: 
>  * allow unquoted field names
>  * allow single quotes
> org.apache.logging.log4j.core.config.json.JsonConfiguration.getObjectMapper
> {code}
>     protected ObjectMapper getObjectMapper() {
>         return new 
> ObjectMapper().configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, 
> true).configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, 
> true).configure(JsonParser.Feature.ALLOW_COMMENTS, true);
>     }
> {code}
> v2.3: 
> {code}
>     protected ObjectMapper getObjectMapper() {
>         return new 
> ObjectMapper().configure(JsonParser.Feature.ALLOW_COMMENTS, true);
>     }
> {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to