logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Randall" <javabr...@gmail.com>
Subject Re: Future of JULI<->Log4j bridging
Date Wed, 03 Sep 2008 04:20:44 GMT
Thanks - all good and working for now.  Bridge version
apache-jul-log4j-bridge-1.0.0-20071030.02281 appears to work well.

Using Spring Framework, I can actually bootstrap the bridge during the
Spring context load using this:

    <bean id="jul-log4j-bridge"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="staticMethod">

<value>org.apache.logging.julbridge.JULLog4jBridge.assimilate</value>
        </property>
    </bean>

... which I think is nice.  No reference or dependency on the
jul-log4j-bridge in my code, deploy-time replacement of JUL backend with
log4j.  Then I can even plug-in Chainsaw:

(log4j.xml)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>

    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.out" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n"
/>
        </layout>
    </appender>

    <appender name="chainsaw" class="org.apache.log4j.net.SocketAppender">
        <param name="remoteHost" value="localhost" />
        <param name="port" value="4445" />
        <param name="locationInfo" value="true" />
    </appender>

    <root>
        <priority value="debug" />
        <appender-ref ref="console" />
        <appender-ref ref="chainsaw" />
    </root>

</log4j:configuration>

Very happy - thank you for contributing this code.

Cheers
Brett

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