logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Grobmeier <grobme...@gmail.com>
Subject [log4j2] Format of json config
Date Sat, 28 Apr 2012 13:09:23 GMT
Hei folks,

i created a simple json configuration. I could not load it for unknown
reasons, but I want to address something else with this message.

Given this:

{
    "configuration": {
        "appenders": {
            "Console": {
                "name": "Console",
                "PatternLayout": {
                    "pattern": "%m%n"
                }
            }
        },
        "loggers": {
            "logger": {
                "name": "Sub",
                "level": "TRACE",
                "appender-ref": {
                    "ref": "Console"
                }
            },
            "root": {
                "level": "error",
                "appender-ref": {
                    "ref": "Console"
                }
            }
        }
    }
}

Why don't we use JSON arrays? For example in the "loggers" Objekt we
define a "logger" and "root". It seems to me that I would need another
"logger" pretty soon. It is more or less a type of what I want. But
having the same keys in one single object feels strange. It is not
permitted form the json format (to my knowledge), but what I somebody
wants to create a gui to create these files? In case of for example JS
he might have a problem with duplicated keys.

We could rewrite it to:

 "loggers": [
               {
                "type" : "logger",
                "name": "Sub",
                "level": "TRACE",
                "appender-ref": {  "ref": "Console" }
                },
                {
                "type" : "root",
                "name": "App",
                "level": "TRACE",
                "appender-ref": {  "ref": "Console" }
                }
             ],


This feels more intuitive to me and might avoid problems when others
want ot use that file. At the moment I am not educated on the impacts
of this change yet. I would say the same should happen with appenders
or any other key, which holds a list of objects.

Cheers
Christian

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


Mime
View raw message