logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Masterson" <m.master...@computer.org>
Subject Re: SNMPTrapAppender v. 1.2.9
Date Sat, 05 Jul 2003 10:46:54 GMT
Hi Viv,

You aren't specifying an implementation of the SnmpTrapSender interface in
your configuration.

Your config should look like this - the second line is the one you are
missing.

log4j.appender.TRAP_LOG=org.apache.log4j.ext.SNMPTrapAppender
log4j.appender.TRAP_LOG.ImplementationClassName=org.apache.log4j.ext.JoeSNMP
TrapSender
log4j.appender.TRAP_LOG.ManagementHost=127.0.0.1
log4j.appender.TRAP_LOG.ManagementHostTrapListenPort=162
log4j.appender.TRAP_LOG.EnterpriseOID=1.3.6.1.4.1.24.0
log4j.appender.TRAP_LOG.LocalIPAddress=127.0.0.1
log4j.appender.TRAP_LOG.LocalTrapSendPort=163
log4j.appender.TRAP_LOG.GenericTrapType=1
log4j.appender.TRAP_LOG.SpecificTrapType=6
log4j.appender.TRAP_LOG.ApplicationTrapOID=1.3.6.1.4.1.24.12.10.22.64
log4j.appender.TRAP_LOG.CommunityString=public
log4j.appender.TRAP_LOG.SysUpTime=1000
log4j.appender.TRAP_LOG.Threshold=DEBUG
log4j.appender.TRAP_LOG.layout=org.apache.log4j.PatternLayout
log4j.appender.TRAP_LOG.layout.ConversionPattern=%d,%p,[%t],[%c],%m%n

Note that this is the line where you specify/decide which SNMP library the
appender should use.  In the example above, we've chosen JoeSNMP from the
OpenNMS project.  If you want to use some other library, then you specify it
here.  If you want to use a library other than the three open source
implementations provided with the Appender, then you must *write your own
trap sender class* -- a plug-in -- which implements the SnmpTrapSender
interface from the Appender and uses the library you want to use to send the
trap.  You then specify the FQN of *your* class on this line of your config.

Note that you CANNOT use the Appender to send traps without using SOME
third-party SNMP library.  If that's what you're trying to do, then you need
to re-think that.

Note that as of the next release of AdventNet's commercial SNMP toolkit for
Java, they will be including just such a plug-in that uses their library,
and they will be bundling the SNMPTrapAppender with their product as a
result.  So if you're an AdventNet user, you won't have to roll your own.

Having said all that, the null pointer you're getting is a result of some
changes I made in v. 1.2.9 to accommodate the AdventNet folks and make their
class path issues a bit simpler.  But a null pointer exception is not a very
elegant way to deal with the problem of a missing line in the config.  I'll
have a look at making this a bit prettier.  Looks like there's a version
1.2.9.1 in the pipeline!  :-)

Cheers,
Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message