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 
{PROJECT_NAME}/src/java/
(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 startup.sh, 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"?>
<!--
rdfsg.com
-->


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

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

</Configuration>