logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: How to get Log4j2, Tomcat and Chainsaw work together?
Date Wed, 23 Jul 2014 15:51:20 GMT
Can you add code to your app that shows the value of the java.class.path
system property? That should help us see what jars and in what order your
app is using.

Gary


On Wed, Jul 23, 2014 at 11:36 AM, Kari Arvonen <suomilapsi@gmail.com> wrote:

> Hello,
>
> Versions:
> - Apache Log4j2 2.0 release version
> - Apache Tomcat 7.0.54
> - Apache Chainsaw 2.1 snapshot (http://people.apache.org/~sdeboy/)
> - Oracle Java SE 7 u60 JDK
>
> I have tried to get the XMLLayout to work with Log4j2 assuming it is the
> best format for Chainsaw. What is preferred way to do this?
>
> In any case current log4j2.xml placed in one of the Webapps WEB-INF\classes
> -directory
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="ALL">
>   <Appenders>
>     <File name="XmlFile" fileName="logs/0000Atest.log"
> immediateFlush="true" append="true">
>       <XMLLayout complete="true" charset="UTF-8" compact="false"/>
>     </File>
>   </Appenders>
>
>   <Loggers>
>     <AsyncRoot level="ALL" includeLocation="false">
>       <AppenderRef ref="XmlFile"/>
>     </AsyncRoot>
>   </Loggers>
> </Configuration>
>
> Configuration is read properly. Where I have been struggling is which jars
> and which versions to include. I have tried various versions and seem to
> have always either class not found or implementation missing.
>
> Jars and versions:
> - log4j-api-2.0.jar, log4j-core-2.0.jar, log4j-web-2.0.jar,
> log4j-1.2-api-2.0.jar
> - disruptor-3.2.1.jar
> - jackson-annotations-2.4.1.jar, jackson-core-2.4.1.1.jar,
> jackson-databind-2.4.1.2.jar
> - jackson-dataformat-xml-2.4.1.jar, jackson-datatype-jdk7-2.4.1.jar,
> jackson-datatype-json-org-2.4.1.jar,
> jackson-module-jaxb-annotations-2.4.1.jar
> - stax2-api-3.1.4.jar
>
> I have tried with less jars and various version combinations without
> success. Best I have had is log gets written, but only actual text to be
> logged not with full XML events. Non XML-layout worked fine.
>
> Code snippets in webapp servlet:
> // Log4J 2.x
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.Logger;
> import org.apache.logging.log4j.EventLogger;
>
> private Logger log = null;
>
> this.log = LogManager.getLogger(EventReceiverServlet.class.getName());
>
> log.info("Logger initiated");
> log.debug("åäöÅÄÖ");
> log.debug("Добро пожаловать.");
>
> Latest exception:
> SEVERE: Exception processing: 0
>
> org.apache.logging.log4j.core.async.AsyncLoggerConfigHelper$Log4jEventWrapper@1045e84
> java.lang.NoSuchMethodError:
>
> com.fasterxml.jackson.databind.util.LRUMap.put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
> at
>
> com.fasterxml.jackson.dataformat.xml.util.XmlRootNameLookup.findRootName(XmlRootNameLookup.java:83)
>
> Any help would  be appreciated.
>
> Regards, Suomilapsi
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message