Pax Logging 1.11 and System.out by the DefaultServiceLogger

20 views
Skip to first unread message

Jérémie Brébec

unread,
Oct 4, 2019, 10:20:08 AM10/4/19
to OPS4J
Hello,

I am upgrading to Karaf 4.2.7 with Pax Logging 1.11

Everytime Karaf is started, I see this line in the console :

org.ops4j.pax.url.wrap [org.ops4j.pax.url.commons.handler.HandlerActivator] DEBUG : Handler for protocols [wrap] started

I use a custom distribution with the static framework : the startup.properties file is generated, and the start-level of pax.url.wrap is lower than the start level of pax-logging-api
As it starts before the pax-logging-api, it gets a "fallback logger" which log with System.out.println()

1/ I can't change the threshold of this logger, because the property "org.ops4j.pax.logging.DefaultServiceLog.level" is read only when the pax-loggin-api is started
2/ I can't use a "FileServiceLogger" as a fallback because the pax-url-wrap bundle is not starting (the logger is loaded in the activator class, before the activator is called)
3/ I can use a BufferingLog. However, this function doesn't seem to be fully implemented : the queue in this logger is never flushed/cleared.

Is there a solution to my problem without patching the startup.properties or the karaf features ?

Regards,
Jérémie

Grzegorz Grzybek

unread,
Oct 4, 2019, 10:44:01 AM10/4/19
to op...@googlegroups.com
Hello Jérémie

Karaf "official" distro simply has this in etc/system.properties:

# Log level when the pax-logging service is not available
# This level will only be used while the pax-logging service bundle
# is not fully available.
# To change log levels, please refer to the org.ops4j.pax.logging.cfg file
# instead.
org.ops4j.pax.logging.DefaultServiceLog.level = ERROR

without it, Karaf would start with this message as well.

And yes - pax-logging 1.11.x has lots of changes, adjustments and polishing related also to "default" logger which I wanted to be operational ASAP - even before pax-logging-api bundles gets ACTIVE.





regards
Grzegorz Grzybek

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/3aa380f4-a831-4106-912e-f747bf29ef79%40googlegroups.com.

Jérémie Brébec

unread,
Oct 4, 2019, 11:13:09 AM10/4/19
to OPS4J
Yes, however this property is only read in the pax-logging-api Activator (line 64) : If a bundle starts before the pax-logging-api, then the applied threshold will be "debug".


Le vendredi 4 octobre 2019 16:44:01 UTC+2, Grzegorz Grzybek a écrit :
Hello Jérémie

Karaf "official" distro simply has this in etc/system.properties:

# Log level when the pax-logging service is not available
# This level will only be used while the pax-logging service bundle
# is not fully available.
# To change log levels, please refer to the org.ops4j.pax.logging.cfg file
# instead.
org.ops4j.pax.logging.DefaultServiceLog.level = ERROR

without it, Karaf would start with this message as well.

And yes - pax-logging 1.11.x has lots of changes, adjustments and polishing related also to "default" logger which I wanted to be operational ASAP - even before pax-logging-api bundles gets ACTIVE.





regards
Grzegorz Grzybek

pt., 4 paź 2019 o 16:20 Jérémie Brébec <jeremi...@gmail.com> napisał(a):
Hello,

I am upgrading to Karaf 4.2.7 with Pax Logging 1.11

Everytime Karaf is started, I see this line in the console :

org.ops4j.pax.url.wrap [org.ops4j.pax.url.commons.handler.HandlerActivator] DEBUG : Handler for protocols [wrap] started

I use a custom distribution with the static framework : the startup.properties file is generated, and the start-level of pax.url.wrap is lower than the start level of pax-logging-api
As it starts before the pax-logging-api, it gets a "fallback logger" which log with System.out.println()

1/ I can't change the threshold of this logger, because the property "org.ops4j.pax.logging.DefaultServiceLog.level" is read only when the pax-loggin-api is started
2/ I can't use a "FileServiceLogger" as a fallback because the pax-url-wrap bundle is not starting (the logger is loaded in the activator class, before the activator is called)
3/ I can use a BufferingLog. However, this function doesn't seem to be fully implemented : the queue in this logger is never flushed/cleared.

Is there a solution to my problem without patching the startup.properties or the karaf features ?

Regards,
Jérémie

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to op...@googlegroups.com.

Grzegorz Grzybek

unread,
Oct 4, 2019, 11:19:51 AM10/4/19
to op...@googlegroups.com
Hello

right... org.ops4j.pax.logging.spi.support.DefaultServiceLog#setLogLevel() is called in pax-logging-api activator.
it defaults to "0" which means TRACE. I should've rather initialized it simply to org.ops4j.pax.logging.spi.support.BackendSupport#defaultLogLevel() which checks system property.

Please create PAXLOGGING jira issue and I can fix it in pax-logging 1.11.3.

regards
Grzegorz Grzybek

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/5625e728-4ab0-4596-9e08-77f5ecaf0eaa%40googlegroups.com.

Jérémie Brébec

unread,
Oct 4, 2019, 11:41:40 AM10/4/19
to OPS4J
I have created PAXLOGGING-274

Thanks !
Reply all
Reply to author
Forward
0 new messages