You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by garrydias <ga...@gmail.com> on 2012/04/10 16:08:23 UTC

Apparent Duplicated Log (Log4J)

Hello..

#1) In a JEE enviroment, why my logging lines are printing like this:
/10:36:02,584 INFO  [STDOUT] 10:36:02,583 INFO  [MyClass] Whatever logging!/

#2) When it should been like this:
/10:36:02,583 INFO  [MyClass] Whatever logging!/

My application is deployed in JBossAS 5.1 using Apache Log4j as logging
service. All server startup logging lines are normal (like #2) but when my
deployed application starts to log its lines are printed with a duplicated
time, duplicated priority and STDOUT logger (like 1#). The classes in my
application are beans defined in xml spring file or bean endpoints in
CamelContext.

Is Camel appending /10:36:02,584 INFO  [STDOUT]/ when a log4j operations are
invoked by my bean endpoints?

This appending is also crashing my NDC stack, printing only /Whatever
Logging/ instead /StackValue1 StackValue2 StackValueN Whatever Logging!/

--
View this message in context: http://camel.465427.n5.nabble.com/Apparent-Duplicated-Log-Log4J-tp5630011p5630011.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apparent Duplicated Log (Log4J)

Posted by garrydias <ga...@gmail.com>.
Thanx, Claus

I am using JBoss 5.1.0 and did this:
- remove /slf4j-jboss-logging.jar/ and /slf4j-api.jar/ from
*JBOSS_HOME\common\lib*;
- download /slf4j-api-1.6.4.jar/ from
http://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.6.4 and place it in
*JBOSS_HOME\common\lib*;
- in my pom.xml I changed the scope to /provided/ in my slf4j dependency and
/excludes/ slf4j from dependency hierarchy of others dependencies.

Now NDC logs properly and jboss startup errors gone.

Solved.

Thanks, Claus

regards


--
View this message in context: http://camel.465427.n5.nabble.com/Apparent-Duplicated-Log-Log4J-tp5630011p5633056.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apparent Duplicated Log (Log4J)

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You need to use a JBoss that supports slf4j 1.6 which is required by
the Camel version you use.
slf4j 1.5 and 1.6 is unfortunately not binary compatible.



On Tue, Apr 10, 2012 at 4:48 PM, garrydias <ga...@gmail.com> wrote:
> I noticed that an error occurs during jboss startup. A conflict between SL4J
> (embedded in jboss) and SL4J required by Camel is printed:
> /2012-04-10 10:05:06,424 ERROR [STDERR] (main)  SLF4J: Class path contains
> multiple SLF4J bindings.
> 2012-04-10 10:05:06,424 ERROR [STDERR] (main)  SLF4J: Found binding in
> [vfszip:/C:/dev/servers/jboss-5.1.0.GA/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class]
> 2012-04-10 10:05:06,424 ERROR [STDERR] (main)  SLF4J: Found binding in
> [vfszip:/C:/dev/servers/jboss-5.1.0.GA/server/all-infosender/deploy/_projects/project1-1.0.0.ear/project1-web-1.0.0.war/WEB-INF/lib/com.springsource.slf4j.log4j-1.6.1.jar/org/slf4j/impl/StaticLoggerBinder.class]
> 2012-04-10 10:05:06,424 ERROR [STDERR] (main)  SLF4J: See
> http://www.slf4j.org/codes.html#multiple_bindings for an explanation./
>
>
> If I remove SL4J (1.6.1 version) from pom.xml Camel is not deployed because
> it depends on *org.slf4j.impl.StaticLoggerBinder* and this exception is
> thrown at server startup:
> /
> ...
> Caused by: org.springframework.beans.FatalBeanException: Invalid
> NamespaceHandler class
> [org.apache.camel.spring.handler.CamelNamespaceHandler] for namespace
> [http://camel.apache.org/schema/spring]: problem with handler class file or
> dependent class; nested exception is java.lang.NoSuchMethodError:
> org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
>        at
> org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:139)
>        at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1333)
>        at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1328)
>        at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
>        at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
>        at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
>        at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
>        ... 83 more
> Caused by: java.lang.NoSuchMethodError:
> org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
>        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
>        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
>        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
>        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
>        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
>        at
> org.apache.camel.spring.handler.CamelNamespaceHandler.<clinit>(CamelNamespaceHandler.java:74)
>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>        at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
>        at
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)/
>
>
>
> I don´t know if these conflicts are related to original post but... who
> knows??
>
> thanks
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apparent-Duplicated-Log-Log4J-tp5630011p5630138.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Apparent Duplicated Log (Log4J)

Posted by garrydias <ga...@gmail.com>.
I noticed that an error occurs during jboss startup. A conflict between SL4J
(embedded in jboss) and SL4J required by Camel is printed:
/2012-04-10 10:05:06,424 ERROR [STDERR] (main)  SLF4J: Class path contains
multiple SLF4J bindings.
2012-04-10 10:05:06,424 ERROR [STDERR] (main)  SLF4J: Found binding in
[vfszip:/C:/dev/servers/jboss-5.1.0.GA/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class]
2012-04-10 10:05:06,424 ERROR [STDERR] (main)  SLF4J: Found binding in
[vfszip:/C:/dev/servers/jboss-5.1.0.GA/server/all-infosender/deploy/_projects/project1-1.0.0.ear/project1-web-1.0.0.war/WEB-INF/lib/com.springsource.slf4j.log4j-1.6.1.jar/org/slf4j/impl/StaticLoggerBinder.class]
2012-04-10 10:05:06,424 ERROR [STDERR] (main)  SLF4J: See
http://www.slf4j.org/codes.html#multiple_bindings for an explanation./


If I remove SL4J (1.6.1 version) from pom.xml Camel is not deployed because
it depends on *org.slf4j.impl.StaticLoggerBinder* and this exception is
thrown at server startup:
/
...
Caused by: org.springframework.beans.FatalBeanException: Invalid
NamespaceHandler class
[org.apache.camel.spring.handler.CamelNamespaceHandler] for namespace
[http://camel.apache.org/schema/spring]: problem with handler class file or
dependent class; nested exception is java.lang.NoSuchMethodError:
org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
	at
org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:139)
	at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1333)
	at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1328)
	at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
	at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
	... 83 more
Caused by: java.lang.NoSuchMethodError:
org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
	at
org.apache.camel.spring.handler.CamelNamespaceHandler.<clinit>(CamelNamespaceHandler.java:74)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
	at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)/



I don´t know if these conflicts are related to original post but... who
knows??

thanks

--
View this message in context: http://camel.465427.n5.nabble.com/Apparent-Duplicated-Log-Log4J-tp5630011p5630138.html
Sent from the Camel - Users mailing list archive at Nabble.com.