dev@glassfish.java.net

Re: Simple way to find the current logging level?

From: Peter Williams <Pete.Williams_at_Sun.COM>
Date: Mon, 27 Oct 2008 14:21:29 -0700

Vivek Pandey wrote:
> Peter Williams wrote:
>> Maybe I misunderstand what you are asking, but it seems like you are
>> suggesting short-circuiting the logging hierarchy on the assumption
>> that the root level is what you need (and this may be true today).
>>
>> This strikes me as quite fragile and to be avoided. What if someone
>> adds a setting in between? It will be ignored and the problem will
>> not be obvious, so quite difficult to diagnose.
>>
> True but there is nothing else that can be better than this except go
> up in the hierarchy chain to see whats the effective log level.
But that's exactly the rule -- walk up the chain until the level is
set. We should have a utility method or api for this (Jacob's original
question), but I guess we don't.

-Peter
>
> -vivek.
>> -Peter
>>
>> Vivek Pandey wrote:
>>> If we know what is the root logger called? It can pretty much be
>>> used to get the root log level.
>>>
>>> Jacob can do :
>>>
>>> Logger logger = Logger.getLogger("rootloggername");
>>> assert(logger != null);
>>> logger.getLevel();
>>>
>>> -vivek.
>>>
>>> Carla Mott wrote:
>>>> Hi Jacob,
>>>>
>>>> We default the root logger to level INFO and if a named logger
>>>> doesn't have a level set on it specifically it will inherit the
>>>> level of a parent logger (usually root but it's the first one that
>>>> is set). If you are getting null then the level is set on one of
>>>> its parents and you will have to walk up the tree to get the level.
>>>>
>>>> Logger levels can be set dynamically at runtime at any point in the
>>>> tree. If you have a logger named javax.enterprise.system.core for
>>>> example a user can set the level at javax.enterprise.system.core,
>>>> javax.enterprise.system, javax.enterprise, javax or the root.
>>>>
>>>> Carla
>>>>
>>>> Jacob Kessler wrote:
>>>>> Is there any way to query that within glassfish? As I said, I'm
>>>>> trying to get the log level as the Jruby manager starts up to pass
>>>>> it on to the jRuby runtimes that it will create, so an asadmin
>>>>> command isn't really practical.
>>>>>
>>>>> Kedar Mhaswade wrote:
>>>>>>
>>>>>>
>>>>>> Jacob Kessler wrote:
>>>>>>> I'm trying to find the current logging level so that I can pass
>>>>>>> it on to a Jruby runtime to let Rails/merb/etc. log things
>>>>>>> correctly and sensibly. However, a simple call to
>>>>>>> logger.getLevel() on the logger I have in Java returns a null
>>>>>>> which, while allowed, isn't very useful. Trying to recuse myself
>>>>>>> up the logger hierarchy until I find a non-null level seems like
>>>>>>> the wrong way to deal with that, so I thought I'd ask here: Is
>>>>>>> there a simple way to find out the current log level that your
>>>>>>> logger is logging at?
>>>>>>
>>>>>> asadmin generate-jvm-report --type=log | grep <logger name>?
>>>>>>
>>>>>> -Kedar
>>>>>>
>>>>>> (Assuming v3 Prelude).
>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>
>>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>