karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grzegorz Grzybek (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-5116) Defining karaf.log.console as a log4j2 log level causes exceptions
Date Tue, 04 Jul 2017 05:57:00 GMT

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

Grzegorz Grzybek commented on KARAF-5116:
-----------------------------------------

{{java.util.logging.Level}} uses:
* SEVERE (highest value)
* WARNING
* INFO
* CONFIG
* FINE
* FINER
* FINEST  (lowest value)

{{BootstrapLogManager}} is only temporary JUL logging facility to be used before starting
fully-fledged pax-logging-\[service|logback|log4j2].

If you want to have proper pax-logging configuration under pax-exam, please see how it's done
with pax-web:
* log4j2.properties: https://github.com/ops4j/org.ops4j.pax.web/blob/web-6.0.5/pax-web-itest/pax-web-itest-base/src/main/resources/log4j2.properties
which is ...
* referenced from pax-logging.properties: https://github.com/ops4j/org.ops4j.pax.web/blob/web-6.0.5/pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/src/test/resources/pax-logging.properties,
which is ...
* referenced from system property [set here|https://github.com/ops4j/org.ops4j.pax.web/blob/web-6.0.5/pax-web-itest/pax-web-itest-base/src/main/java/org/ops4j/pax/web/itest/base/AbstractControlledTestBase.java#L113]
using:
{code:xml}
systemProperty("org.ops4j.pax.logging.property.file").value("src/test/resources/pax-logging.properties"),
{code}
* {{org.ops4j.pax.logging.property.file}} property is read by pax-logging-log4j2 in {{org.ops4j.pax.logging.log4j2.internal.Activator#start()}}

I'll just update documentation

> Defining karaf.log.console as a log4j2 log level causes exceptions
> ------------------------------------------------------------------
>
>                 Key: KARAF-5116
>                 URL: https://issues.apache.org/jira/browse/KARAF-5116
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 4.1.1
>            Reporter: Jamie Kemp
>            Assignee: Grzegorz Grzybek
>            Priority: Minor
>
> Running karaf 4.1.1, defining karaf.log.console as DEBUG to switch on the console appender
(to get to logging when running under pax-exam) results in the following exceptions:
> {code}
> java.lang.IllegalArgumentException: Bad level "DEBUG"
>         at java.util.logging.Level.parse(Level.java:482)
>         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlersInternal(BootstrapLogManager.java:109)
>         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlers(BootstrapLogManager.java:70)
>         at org.apache.karaf.main.util.BootstrapLogManager.configureLogger(BootstrapLogManager.java:75)
>         at org.apache.karaf.main.Main.launch(Main.java:244)
>         at org.apache.karaf.main.Main.main(Main.java:178)
> java.lang.IllegalArgumentException: Bad level "DEBUG"
>         at java.util.logging.Level.parse(Level.java:482)
>         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlersInternal(BootstrapLogManager.java:109)
>         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlers(BootstrapLogManager.java:70)
>         at org.apache.karaf.main.util.BootstrapLogManager.configureLogger(BootstrapLogManager.java:75)
>         at org.apache.karaf.main.KarafActivatorManager.<init>(KarafActivatorManager.java:49)
>         at org.apache.karaf.main.Main.launch(Main.java:280)
>         at org.apache.karaf.main.Main.main(Main.java:178)
> java.lang.IllegalArgumentException: Bad level "DEBUG"
>         at java.util.logging.Level.parse(Level.java:482)
>         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlersInternal(BootstrapLogManager.java:109)
>         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlers(BootstrapLogManager.java:70)
>         at org.apache.karaf.main.util.BootstrapLogManager.configureLogger(BootstrapLogManager.java:75)
>         at org.apache.karaf.main.lock.SimpleFileLock.<init>(SimpleFileLock.java:40)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
>         at org.apache.karaf.main.Main.createLock(Main.java:476)
>         at org.apache.karaf.main.Main.doMonitor(Main.java:378)
>         at org.apache.karaf.main.Main.access$100(Main.java:75)
>         at org.apache.karaf.main.Main$3.run(Main.java:369)
> {code}
> Looks like BootstrapLogManager attempts to use java.util.logging levels which DEBUG is
not one of them. This however does result in valid logging out via log4j2 to the console appender.

> Using a valid java.util.logger level (tried FINE during testing) results in logging to
the console from 'SimpleFileLock' but nothing from log4j2.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message