the first example uses an object as "logger" value,
the second one an array with objects.

I understood it so that only the array option should work?

On Sat, Apr 28, 2012 at 10:05 PM, Ralph Goers
<[email protected]> wrote:
> What is the problem?
>
> Ralph
>
> On Apr 28, 2012, at 1:03 PM, Christian Grobmeier <[email protected]> wrote:
>
>> On Sat, Apr 28, 2012 at 4:33 PM, Ralph Goers <[email protected]> 
>> wrote:
>>> OK - I could swear that I copied the examples straight from unit tests.  
>>> See log4j-routing.json and log4j-routing2.json.
>>
>> Actually you did. Something is wrong here...
>>
>> log4j-routing.json:
>>
>> "loggers": {
>>      "logger": { "name": "EventLogger", "level": "info",
>> "additivity": "false", "appender-ref": { "ref": "Routing" }},
>>      "root": { "level": "error", "appender-ref": { "ref": "STDOUT" }}
>>    }
>>
>> log4j-routing2.json:
>>
>> "loggers": {
>>      "logger": [
>>        { "name": "EventLogger", "level": "info", "additivity":
>> "false", "appender-ref": { "ref": "Routing" }},
>>        { "name": "com.foo.bar", "level": "error", "additivity":
>> "false", "appender-ref": { "ref": "STDOUT" }}
>>      ],
>>      "root": { "level": "error", "appender-ref": { "ref": "STDOUT" }}
>>    }
>>
>> Same case in the appenders section.
>> Probably there is a problem in the unit test too
>> Cheers
>>
>>>
>>
>>> Ralph
>>>
>>> On Apr 28, 2012, at 7:15 AM, Christian Grobmeier wrote:
>>>
>>>> hey ralph,
>>>>
>>>> its a pleasure. I like that code and it is impressive that you wrote i
>>>> mostly alone
>>>>
>>>> I have found an error on this page. There is a sample like that:
>>>>
>>>> "loggers": {
>>>>      "logger": { "name": "EventLogger", "level": "info",
>>>> "additivity": "false", "appender-ref": { "ref": "Routing" }},
>>>>      "root": { "level": "error", "appender-ref": { "ref": "STDOUT" }}
>>>>    }
>>>>
>>>> On the same page, above the example you mentioned below.
>>>>
>>>> When i have time, I will try this further and correct it
>>>> Probably tomorrow or this night.
>>>>
>>>> Cheers
>>>>
>>>> On Sat, Apr 28, 2012 at 4:00 PM, Ralph Goers <[email protected]> 
>>>> wrote:
>>>>> 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: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.grobmeier.de
>>>> https://www.timeandbill.de
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>>
>>
>> --
>> http://www.grobmeier.de
>> https://www.timeandbill.de
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
http://www.grobmeier.de
https://www.timeandbill.de

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

Reply via email to