The error message tells you, that "slf4j-log4j12-1.6.6.jar" is found in two
places. Remove one.
You don't need the "pax-logging-service-1.6.3.jar". It's only needed in an
OSGI environment.
And checkout [1] on how to configure log4j.

[1] http://logging.apache.org/log4j/1.2/

Best,
Christian

On Wed, Nov 14, 2012 at 11:55 PM, gemini <[email protected]> wrote:

> Hi,
>
> I am using Apache Camel 2.10.1 which is inside ActiveMQ 5.7.
> I have lot of routes and I want that every route has separate log file.
> I found some info about "Sifting", but i doesn't work. Maybe I put wrong
> jar
> file into lib - "pax-logging-service-1.6.3.jar" from Apache ServiceMix
> 4.4.2.
> I am not Java programmer - just want do some integration with Camel &
> ActiveMQ, so please explain how to configure logging and give some example.
>
> I try following "log4j.properties", but I get error on the bottom:
>
> ----------------------------------------------------------------------------------------
> log4j.rootLogger=INFO, console, logfile
> log4j.logger.org.apache.activemq.spring=WARN
> log4j.logger.org.apache.activemq.web.handler=WARN
> log4j.logger.org.springframework=WARN
> log4j.logger.org.apache.xbean=WARN
> log4j.logger.org.apache.camel=INFO
>
> # Console appender
> log4j.appender.console=org.apache.log4j.ConsoleAppender
> log4j.appender.console.layout=org.apache.log4j.PatternLayout
> log4j.appender.console.layout.ConversionPattern=%5p | %m%n
> log4j.appender.console.threshold=INFO
>
> # File appender
> log4j.appender.logfile=org.apache.log4j.sift.MDCSiftingAppender
> log4j.appender.logfile.key=camel.routeId
> log4j.appender.logfile.default=camel
> log4j.appender.logfile.appender=org.apache.log4j.RollingFileAppender
> log4j.appender.logfile.appender.MaxFileSize=20MB
> log4j.appender.logfile.appender.MaxBackupIndex=5
> log4j.appender.logfile.appender.layout=org.apache.log4j.PatternLayout
> log4j.appender.logfile.appender.layout.ConversionPattern=%d | %-5p | %m |
> %c
> | %t%n
>
> log4j.appender.logfile.appender.file=${activemq.base}/data/$\\{camel.routeId\\}.log
> log4j.appender.logfile.appender.append=true
> log4j.appender.logfile.threshold=TRACE
>
> ----------------------------------------------------------------------------------------
>
>
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in
>
> [jar:file:/home/esb/activemq/lib/optional/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
>
> [jar:file:/home/esb/activemq/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
> log4j:WARN Failed to set property [appender] to value
> "org.apache.log4j.RollingFileAppender".
>  INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@5488e2dd
> :
> startup date [Wed Nov 14 18:04:44 CET 2012]; root of context hierarchy
> ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
> java.lang.NullPointerException
> java.lang.RuntimeException: Failed to execute start task. Reason:
> java.lang.NullPointerException
>         at
>
> org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:98)
>         at
>
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>         at
>
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:148)
>         at
>
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>         at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:90)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.activemq.console.Main.runTaskClass(Main.java:257)
>         at org.apache.activemq.console.Main.main(Main.java:111)
> Caused by: java.lang.NullPointerException
>         at
>
> org.apache.log4j.sift.MDCSiftingAppender.getAppender(MDCSiftingAppender.java:109)
>         at
> org.apache.log4j.sift.MDCSiftingAppender.append(MDCSiftingAppender.java:79)
>         at
> org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
>         at
>
> org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
>         at org.apache.log4j.Category.callAppenders(Category.java:206)
>         at org.apache.log4j.Category.forcedLog(Category.java:391)
>         at org.apache.log4j.Category.log(Category.java:856)
>         at
> org.slf4j.impl.Log4jLoggerAdapter.log(Log4jLoggerAdapter.java:602)
>         at
> org.apache.commons.logging.impl.SLF4JLocationAwareLog.info
> (SLF4JLocationAwareLog.java:159)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:456)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:394)
>         at
>
> org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
>         at
>
> org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
>         at
>
> org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:102)
>         at
>
> org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:102)
>         at
>
> org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:66)
>         at
>
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
>         at
>
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
>         at
>
> org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:115)
>         at
>
> org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
>         ... 10 more
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Logging-routes-to-separate-files-tp5722752.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Reply via email to