Wow - it is really great to have you digging into this.

Did you look at 
http://people.apache.org/~rgoers/log4j2/manual/configuration.html? It has two 
sample json configuration files and talks about what you need to do to use 
arrays.  In particular, the loggers section looks like 

    "loggers": {
      "logger": [
        { "name": "EventLogger", "level": "info", "additivity": "false", 
"appender-ref": { "ref": "Routing" }},
        { "name": "com.foo.bar", "level": "error", "additivity": "false", 
"appender-ref": { "ref": "Console" }}
      ],
      "root": { "level": "error", "appender-ref": { "ref": "STDOUT" }}
    }
Ralph


On Apr 28, 2012, at 6:09 AM, Christian Grobmeier wrote:

> 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-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-dev-h...@logging.apache.org
> 

Reply via email to