You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2013/11/21 15:09:42 UTC

[jira] [Comment Edited] (KARAF-2381) The shell log:set command not as documented

    [ https://issues.apache.org/jira/browse/KARAF-2381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13828958#comment-13828958 ] 

Jean-Baptiste Onofré edited comment on KARAF-2381 at 11/21/13 2:09 PM:
-----------------------------------------------------------------------

Actually, I think there is a misunderstanding of the usage of the DEFAULT log level. It's not related to the storage, like reloading the "original" log level from etc/org.ops4j.pax.logging.cfg file.

The purpose of the DEFAULT log level is to delete the current log level of a logger (and leave other properties like appender, etc). Like this, at runtime, the logger will use the log level of its parent. That's why we can't use log:set DEFAULT on the rootLogger.

For instance, if we have:
rootLogger=INFO,file
my.logger=INFO,appender1
my.logger.custom=DEBUG,appender2

We do:
log:set INFO my.logger.custom

We have:
rootLogger=INFO,file
my.logger=INFO,appender1
my.logger.custom=INFO,appender2

Now, if we do:
log:set DEFAULT my.logger.custom

We have:
rootLogger=INFO,file
my.logger=INFO,appender1
my.logger.custom=appender2

The log level is removed from the my.logger.custom logger, so it means that I will use the log level from my.logger.
Note that the appender is not changed.

Now, if we do:
log:set DEFAULT my.logger

We have:
rootLogger=INFO,file
my.logger=appender1
my.logger.custom=appender2

It removes the log level from my.logger logger. So it will use the log level from the rootLogger.

I'm updating the documentation to explain/describe it and I'm checking that it actually acts like this.


was (Author: jbonofre):
Actually, I think there is a misunderstanding of the usage of the DEFAULT log level. It's not related to the storage, like reloading the "original" log level from etc/org.ops4j.pax.logging.cfg file.

The purpose of the DEFAULT log level is to assign the log level of the parent logger to a logger (up to the rootLogger). That's why, for instance, it's not possible to do log:set DEFAULT on the rootLogger as it doesn't have a parent.

Let me illustrate. Assuming we have:
rootLogger=INFO
org.apache.karaf=ERROR
org.apache.karaf.admin=ERROR

If I do:
log:set DEBUG org.apache.karaf.admin
I have:
rootLogger=INFO
org.apache.karaf=ERROR
org.apache.karaf.admin=DEBUG

Now, I do:
log:set DEFAULT org.apache.karaf.admin
it takes the log level from the parent, so org.apache.karaf. So I will have:
rootLogger=INFO
org.apache.karaf=ERROR
org.apache.karaf.admin=ERROR

Now, I do:
log:set DEBUG org.apache.karaf
I have:
rootLogger=INFO
org.apache.karaf=DEBUG
org.apache.karaf.admin=ERROR

Now, I do:
log:set DEFAULT org.apache.karaf
It takes the log level from the parent, so rootLogger. So I have:
rootLogger=INFO
org.apache.karaf=INFO
org.apache.karaf.admin=ERROR

Now, if I do:
log:set DEFAULT org.apache.karaf.admin
It takes the log level from the parent, so org.apache.karaf. So I have:
rootLogger=INFO
org.apache.karaf=INFO
org.apache.karaf.admin=INFO

I'm updating the documentation to explain/describe it and I'm checking that it actually acts like this.

> The shell log:set command not as documented
> -------------------------------------------
>
>                 Key: KARAF-2381
>                 URL: https://issues.apache.org/jira/browse/KARAF-2381
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.3.1
>         Environment: Windows 7 + JDK7, RedHat 5 Linux + JDK6
>            Reporter: Opher Shachar
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 2.4.0, 3.0.0, 2.3.4
>
>
> Running the shell's *log:set _LogLevel_ _PackageName_* command makes the change *persistent* in contrary to the [documentation|http://repo1.maven.org/maven2/org/apache/karaf/manual/2.3.1/manual-2.3.1.html#ConsoleLogCommands].
> On the flip side *log:set _DEFAULT_ _PackageName_* is _not_ persisted.
> So, the *log:set* command should either:
> * make *log:set _DEFAULT_ _PackageName_* persisted (and fix the documentation), or
> * make *log:set _LogLevel_ _PackageName_* _not_ persistent (as documented).



--
This message was sent by Atlassian JIRA
(v6.1#6144)