2 Replies Latest reply on May 4, 2010 6:52 AM by Marcus Dahlstein

    Not able to make jboss-log4j send SNMP traps

    Marcus Dahlstein Newbie



      I have been trying to make log4j send SNMP traps using the the "org.apache.log4j.ext.SNMPTrapAppender".

      I have used the example appender delivered in jboss-log4j.xml which looks like this:


      <!-- Log events through SNMP -->
         <appender name="TRAP_LOG">
           <param name="ImplementationClassName" value="org.apache.log4j.ext.JoeSNMPTrapSender"/>
           <param name="ManagementHost" value="10.x.x.x"/>
           <param name="ManagementHostTrapListenPort" value="162"/>
           <param name="EnterpriseOID" value=""/>
           <param name="LocalIPAddress" value=""/>
           <param name="LocalTrapSendPort" value="161"/>
           <param name="GenericTrapType" value="6"/>
           <param name="SpecificTrapType" value="12345678"/>
           <param name="CommunityString" value="public"/>
           <param name="ForwardStackTraceWithTrap" value="true"/>
           <param name="Threshold" value="ERROR"/>
           <param name="ApplicationTrapOID" value=""/>
                  <param name="ConversionPattern" value="%d,%p,[%t],[%c],%m%n"/>


      In order to capture everything which is passed through log4j I tried to add the appender-ref in the root-category like this:

            <priority value="TRACE" />

            <appender-ref ref="TRAP_LOG"/>

            <appender-ref ref="CONSOLE"/>
            <appender-ref ref="FILE"/>


      I've also tried to direct some of the loggers (which works when logging to file) to this appender but I am still not getting anything on my snmp host.

      I tried to tcpdump on the application server, but there seems to be no outgoing traffic to the SNMP host, so it doesn't look like log4j is either missconfigured and nothing ends up in the TRAP_LOG-appender or I have to do something else in order for it to start sending SNMP traps.


      Can someone please shed som light on this?