You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Christian Grobmeier <gr...@gmail.com> on 2012/04/28 15:09:23 UTC

[log4j2] Format of json config

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


Re: [log4j2] Format of json config

Posted by Christian Grobmeier <gr...@gmail.com>.
On Sat, Apr 28, 2012 at 10:31 PM, Ralph Goers <rg...@apache.org> wrote:
> Are you getting confused as to when the type element is required?  If so, reread the section on the configuration page.

No, thats not what bugs me. I understand that.

I am fighting with this log4j2.json configuration and can't find the
error. Its only outputting the error messages. A similar log4j2.xml
file works as expected, it is just the json file. If you can explain
me my error, I would be glad.

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



>
> Ralph
>
> On Apr 28, 2012, at 1:08 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>
>> 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
>> <ra...@dslextreme.com> wrote:
>>> What is the problem?
>>>
>>> Ralph
>>>
>>> On Apr 28, 2012, at 1:03 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>>>
>>>> On Sat, Apr 28, 2012 at 4:33 PM, Ralph Goers <ra...@dslextreme.com> 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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
>>>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> http://www.grobmeier.de
>>>>>> https://www.timeandbill.de
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.grobmeier.de
>>>> https://www.timeandbill.de
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>
>>
>>
>> --
>> http://www.grobmeier.de
>> https://www.timeandbill.de
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>



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

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


Re: [log4j2] Format of json config

Posted by Ralph Goers <rg...@apache.org>.
Are you getting confused as to when the type element is required?  If so, reread the section on the configuration page.

Ralph

On Apr 28, 2012, at 1:08 PM, Christian Grobmeier <gr...@gmail.com> wrote:

> 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
> <ra...@dslextreme.com> wrote:
>> What is the problem?
>> 
>> Ralph
>> 
>> On Apr 28, 2012, at 1:03 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>> 
>>> On Sat, Apr 28, 2012 at 4:33 PM, Ralph Goers <ra...@dslextreme.com> 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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> http://www.grobmeier.de
>>>>> https://www.timeandbill.de
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> http://www.grobmeier.de
>>> https://www.timeandbill.de
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
> 
> 
> 
> -- 
> http://www.grobmeier.de
> https://www.timeandbill.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 

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


Re: [log4j2] Format of json config

Posted by Christian Grobmeier <gr...@gmail.com>.
On Sat, Apr 28, 2012 at 10:25 PM, Ralph Goers <rg...@apache.org> wrote:
> No. You can have multiple distinct objects or an array since both end up with multiple logger objects.

OK. So does that mean I can have either one object in the key "logger"
or an array? That would make sense.


>
> Ralph
>
> On Apr 28, 2012, at 1:08 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>
>> 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
>> <ra...@dslextreme.com> wrote:
>>> What is the problem?
>>>
>>> Ralph
>>>
>>> On Apr 28, 2012, at 1:03 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>>>
>>>> On Sat, Apr 28, 2012 at 4:33 PM, Ralph Goers <ra...@dslextreme.com> 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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
>>>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> http://www.grobmeier.de
>>>>>> https://www.timeandbill.de
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.grobmeier.de
>>>> https://www.timeandbill.de
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>
>>
>>
>> --
>> http://www.grobmeier.de
>> https://www.timeandbill.de
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>



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

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


Re: [log4j2] Format of json config

Posted by Ralph Goers <rg...@apache.org>.
No. You can have multiple distinct objects or an array since both end up with multiple logger objects.  

Ralph

On Apr 28, 2012, at 1:08 PM, Christian Grobmeier <gr...@gmail.com> wrote:

> 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
> <ra...@dslextreme.com> wrote:
>> What is the problem?
>> 
>> Ralph
>> 
>> On Apr 28, 2012, at 1:03 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>> 
>>> On Sat, Apr 28, 2012 at 4:33 PM, Ralph Goers <ra...@dslextreme.com> 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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> http://www.grobmeier.de
>>>>> https://www.timeandbill.de
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> http://www.grobmeier.de
>>> https://www.timeandbill.de
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
> 
> 
> 
> -- 
> http://www.grobmeier.de
> https://www.timeandbill.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 

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


Re: [log4j2] Format of json config

Posted by Christian Grobmeier <gr...@gmail.com>.
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
<ra...@dslextreme.com> wrote:
> What is the problem?
>
> Ralph
>
> On Apr 28, 2012, at 1:03 PM, Christian Grobmeier <gr...@gmail.com> wrote:
>
>> On Sat, Apr 28, 2012 at 4:33 PM, Ralph Goers <ra...@dslextreme.com> 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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.grobmeier.de
>>>> https://www.timeandbill.de
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>
>>
>>
>> --
>> http://www.grobmeier.de
>> https://www.timeandbill.de
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>



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

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


Re: [log4j2] Format of json config

Posted by Ralph Goers <ra...@dslextreme.com>.
What is the problem?

Ralph

On Apr 28, 2012, at 1:03 PM, Christian Grobmeier <gr...@gmail.com> wrote:

> On Sat, Apr 28, 2012 at 4:33 PM, Ralph Goers <ra...@dslextreme.com> 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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> http://www.grobmeier.de
>>> https://www.timeandbill.de
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
> 
> 
> 
> -- 
> http://www.grobmeier.de
> https://www.timeandbill.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 

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


Re: [log4j2] Format of json config

Posted by Christian Grobmeier <gr...@gmail.com>.
On Sat, Apr 28, 2012 at 4:33 PM, Ralph Goers <ra...@dslextreme.com> 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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>>
>>
>>
>>
>> --
>> http://www.grobmeier.de
>> https://www.timeandbill.de
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>



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

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


Re: [log4j2] Format of json config

Posted by Ralph Goers <ra...@dslextreme.com>.
OK - I could swear that I copied the examples straight from unit tests.  See log4j-routing.json and log4j-routing2.json.

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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
>> 
> 
> 
> 
> -- 
> http://www.grobmeier.de
> https://www.timeandbill.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org


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


Re: [log4j2] Format of json config

Posted by Christian Grobmeier <gr...@gmail.com>.
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 <ra...@dslextreme.com> 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: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>



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

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

Re: [log4j2] Format of json config

Posted by Ralph Goers <ra...@dslextreme.com>.
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-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>