Wednesday, August 20, 2014

This took me an inordinately long time, so I thought I’d share:
This is the log4j2.xml file, placed in 
(where you might also have your hibernate.cfg.xml)

I left the status as TRACE  to assist anyone debugging the configuration, e.g., if you seen CLASS_NOT_FOUND you might be missing a jar in you classpath.

The output appears in the tomcat logs directory, without the “../“ it appears in the bin directory (with, etc.).

Hope this is helpful and saves those who find it some time — Part of the reason getting it right was so hard was distinguishing log4j vs log4j2 hints.

Note:  Running OSX 10.9.4

<?xml version="1.0" encoding="UTF-8"?>

<Configuration status="TRACE">
        <Property name="dest">"etherios_Digester_log4j.log"</Property>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{YYYY/MM/dd:HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        <File name="rdfsgFile" fileName="../logs/etherios_digester_log4j.log">
                <pattern>%d %p %C{1.} [%t] %m%n</pattern>
        <Logger name="com.rdfsg.aca.etherios.CoreDataInitializer" level="TRACE">
            <AppenderRef ref="rdfsgFile"/>

        <Root level="ERROR">
            <AppenderRef ref="rdfsgFile"/>