You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by hwaastad <he...@waastad.org> on 2015/05/14 12:51:39 UTC

TomEE Ear Logback revisit

Hi,
Im touching space on this one again.

Running some tests with tomee 1.7.2 and have a couple of observations.

1. adding openejb.log.factory=slf4j, adding logback libs, removing the
slf4j-jdk14 and adding logback.xml to conatiner lib I get logback working.
Seems like this is the only way og getting ejb modules to log correctly via
slf4j/logback

2. If I add logback libs/slf4j-api to web app and a logback.xml to resource,
I cannot override the global config. Is there a way of overriding global
config?

br hw




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: TomEE Ear Logback revisit

Posted by Romain Manni-Bucau <rm...@gmail.com>.
well this issue is maybe something else (we fixed a concurrent error for
1.7.2 IIRC, can be linked), but
logback ch.qos.logback.core.util.Loader#getResource ignores classloader
hierarchy so you can't have 2 concurrent configs in a tree


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-15 10:34 GMT+02:00 hwaastad <he...@waastad.org>:

> Hi, I've been playing around some more and it's definitly a classloading
> issue.
>
> This is my observations:
> 1. skipped logback on tomee global
>
> 2. added an logback-config jar which I <unpack> in the ear (also added
> <includeInApplicationXml>true</includeInApplicationXml> in jarModule to get
> it working)
>
> 3. I kind of pushing initialization a little bit here since having two
> schedulers running in two different projects (at the same time) an this
> generates a:
> SEVERE - The bean instance WebScheduler threw a system
> exception:java.lang.LinkageError: loader (instance of
> org/apache/openejb/util/classloader/URLClassLoaderFirst): attempted
> duplicate class definition for name: "org/slf4j/LoggerFactory"
>
> If one of them is startup, initialization is OK.
>
> br hw
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809p4674830.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: TomEE Ear Logback revisit

Posted by hwaastad <he...@waastad.org>.
Hi, I've been playing around some more and it's definitly a classloading
issue.

This is my observations:
1. skipped logback on tomee global

2. added an logback-config jar which I <unpack> in the ear (also added
<includeInApplicationXml>true</includeInApplicationXml> in jarModule to get
it working)

3. I kind of pushing initialization a little bit here since having two
schedulers running in two different projects (at the same time) an this
generates a:
SEVERE - The bean instance WebScheduler threw a system
exception:java.lang.LinkageError: loader (instance of 
org/apache/openejb/util/classloader/URLClassLoaderFirst): attempted 
duplicate class definition for name: "org/slf4j/LoggerFactory"

If one of them is startup, initialization is OK.

br hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809p4674830.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: TomEE Ear Logback revisit

Posted by Romain Manni-Bucau <rm...@gmail.com>.
for tomee/lib? it is not...or it is. It fully depends how lib/* is
resolved. this is not portable AFAIK (depends java.io.File#list()).


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-14 21:11 GMT+02:00 hwaastad <he...@waastad.org>:

> Probably.
> I'm not too familiar with the logback classloader defs.
>
> BTW, it seems that removing slf4-jdk is not really needed.
>
> br hw
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809p4674815.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: TomEE Ear Logback revisit

Posted by hwaastad <he...@waastad.org>.
Probably.
I'm not too familiar with the logback classloader defs.

BTW, it seems that removing slf4-jdk is not really needed.

br hw




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809p4674815.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: TomEE Ear Logback revisit

Posted by Romain Manni-Bucau <rm...@gmail.com>.
isnt it just that logback doesnt handle hierarchic classloaders?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-14 19:22 GMT+02:00 hwaastad <he...@waastad.org>:

> Hi Romain and thx for testing it out.
>
> well, in tomee/lib/logback.xml pattern is:
>
> <pattern>%d{HH:mm:ss.SSS} TomEE [%thread] %highlight(%-5level) %logger{50}
> -
> %msg%n</pattern>
>
> in web-inf/classes/logback.xml I've defined:
>
> <pattern>%d{HH:mm:ss.SSS} ENTERPRISE-WEB [%thread] %-5level %logger{50} -
> %msg%n</pattern>
>
> However logging shows:
> 19:21:35.007 TomEE [EjbTimerPool - 2] WARN  org.waastad.WebScheduler -
> Logging warn
>
> Which is the pattern from the tomee/lib/logback.xml
>
> I was hoping the logback.xml in webapp would be used.
>
> br hw
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809p4674813.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: TomEE Ear Logback revisit

Posted by hwaastad <he...@waastad.org>.
Hi Romain and thx for testing it out.

well, in tomee/lib/logback.xml pattern is:

<pattern>%d{HH:mm:ss.SSS} TomEE [%thread] %highlight(%-5level) %logger{50} -
%msg%n</pattern>

in web-inf/classes/logback.xml I've defined:

<pattern>%d{HH:mm:ss.SSS} ENTERPRISE-WEB [%thread] %-5level %logger{50} -
%msg%n</pattern>

However logging shows:
19:21:35.007 TomEE [EjbTimerPool - 2] WARN  org.waastad.WebScheduler -
Logging warn

Which is the pattern from the tomee/lib/logback.xml

I was hoping the logback.xml in webapp would be used.

br hw




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809p4674813.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: TomEE Ear Logback revisit

Posted by Romain Manni-Bucau <rm...@gmail.com>.
putting logback in the app I get:
https://gist.github.com/rmannibucau/36a19aaab89bff627fbc

what's the issue (sorry it doesnt look obvious to me)?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-14 15:06 GMT+02:00 hwaastad <he...@waastad.org>:

> Hi,
> meaning  logback/slf4j libs in tomee/lib and logback.xml in tomee/libs
>
> https://github.com/hwaastad/LogBackEnterprise.git
>
> simple project in which there is a scheduler in both web and ejb just
> logging debug, info,warn and error.
>
> br hw
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809p4674811.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: TomEE Ear Logback revisit

Posted by hwaastad <he...@waastad.org>.
Hi,
meaning  logback/slf4j libs in tomee/lib and logback.xml in tomee/libs

https://github.com/hwaastad/LogBackEnterprise.git

simple project in which there is a scheduler in both web and ejb just
logging debug, info,warn and error.

br hw



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809p4674811.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: TomEE Ear Logback revisit

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Wdym by global here? The best is surely to setup a project with tomee maven
plugin to let us check.
Le 14 mai 2015 13:08, "hwaastad" <he...@waastad.org> a écrit :

> Hi,
> Im touching space on this one again.
>
> Running some tests with tomee 1.7.2 and have a couple of observations.
>
> 1. adding openejb.log.factory=slf4j, adding logback libs, removing the
> slf4j-jdk14 and adding logback.xml to conatiner lib I get logback working.
> Seems like this is the only way og getting ejb modules to log correctly via
> slf4j/logback
>
> 2. If I add logback libs/slf4j-api to web app and a logback.xml to
> resource,
> I cannot override the global config. Is there a way of overriding global
> config?
>
> br hw
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Ear-Logback-revisit-tp4674809.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>