Regarding Chainsaw, it currently doesn't support the XML format generated by Log4j2, but does support pattern layout based log formats. Chainsaw supports most regular text log formats, and has special support for Log4j's pattern layout.
I'd suggest either configuring Chainsaw manually, or use the advertiser mechanism described here: http://logging.apache.org/log4j/2.x/manual/configuration.html#ChainsawSupport The log4j2 advertiser mechanism works with patternlayout-formatted log files and requires the jmdns jar to be on the classpath. To configure Chainsaw manually to tail a log file generated with a pattern layout, choose the 'process a log file' option from Chainsaw's 'load Chainsaw configuration' menu option. If the log file is on the local file system, browse to it via the 'open file' button. Next, set the 'log file format type' to PaternLayout format and provide the pattern layout format used by your appender, then specify the timestamp format used in your pattern layout. You can save this configuration in this dialog as an xml file for later use, and you can tell Chainsaw to always use this configuration when starting. Hope that helps. Feel free to send questions to the list. Scott On 7/23/14, Ralph Goers <[email protected]> wrote: > I recall that there are dependencies on both the jackson 2.x and 1.x jars. > > Ralph > > On Jul 23, 2014, at 8:36 AM, Kari Arvonen <[email protected]> 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 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
