[SOLVED] Seeing all current log-levels?

Hi,

I love using the Karaf console to define temporary DEBGUG log levels. However, after some debugging, I mostly cannot recon for which sources I changed the level. Is there a way to see all “non-standard” entries in a list? If not, a “log:list” command would be quite helpful.

Thanks in advance,
Toby

Hey Toby,
It is not currently possible because few reasons. Mainly because karaf doesn’t directly know anything about used logging library which handle actual logging. If you take a look on implementation of commands such log:tail you will find that these messages are kept in memory. As an workaround I can recommend you following snippet exec cat "etc/org.ops4j.pax.logging.cfg"|grep "log4j.logger"|grep "DEBUG" which will print out all appenders from logging configuration file which have debug level set. You can create an alias for such command in etc/shell.init.script. Just put there line like that
``debug { exec cat “etc/org.ops4j.pax.logging.cfg”|grep “log4j.logger”|grep “DEBUG” }```

Note that exec command executes system command and just forwards output to karaf standard out so it will not work under windows.

I don’t know if I used it correctly , but this worked for me:
Setting all entries of log:list to DEFAULT.
After a restart, there were (to the best of my knowledge) the logging I had initially reset. At least all the ones I changed were gone.

Hi Lukasz,

Thanks, that looks really helpful. One question remains: Does that also work for log level settings defined during runtime in Karaf or does it only grep those appenders defined in the config file?

Regards, Toby

It was changing over time. With Karaf 4 log:set should be preserved in configuration file.

Ah, great. Just found the console made entries at the bottom of the file. That helps a lot. :slight_smile:

Thanks,
Toby

For the record: while attempting to add this to the shell.init.script I found out that there already is an alias “log:list” -> “log:get ALL” which shows all set log levels and works quite well. :slight_smile:

1 Like