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: Anyone using SNMPTrapAppender?
Date Sun, 18 Jul 2004 18:07:52 GMT
Hey Bret,

BTW... Scott's message made me take another look at your mail, and I
realized that I had probably completely missed one simple (but important)

You've got examples like this:

myLog.debug("my debug message from host ;" + strHostName);

... where you seem to be trying to make sure the trap contains the local
host name of the box (that the app is running on) that sent the trap.  As
far as the  SNMPTrapAppender is concerned, you don't need to do this.  The
local IP address of the box sending the trap is *always* one of the fields
in a trap -- that's part of the SNMP standard.  Traps would be pretty
useless if you didn't know who sent them!  ;)

You can hard-code the IP address that the appender uses in the properties
file, in the "LocalIPAddress" property.  However, as several people have
pointed out over the years (mainly on this list), that's kind of retarded
for most use cases.  To make things worse, the different trap senders handle
this attribute differently;  if you set the property in your properties
file, it will be used by the JoeSNMPTrapSender.  But if you don't set it,
the behavior of Joe is dependent on how name resolution is configured on the
system in question -- currently, the address will be set to the name that
resolves to "", which is also kind of retarded.  The
WengsoftSNMPTrapSender always ignores the property completely, and sets the
address dynamically.  And the NetSnmpCommandLineTrapSender always uses
exactly what you configure in the properties file, or "" as a
fallback, but with no name resolution.

This whole mess is one of the things I plan to clean up a bit in the next
version -- at the very least, I want to make it consistent across

Anyway, no matter how you slice it, you don't need to be sending the address
in the message of the logging event -- that's redundant.  Of course, if
you're also using other appenders, like a FileAppender or whatever, then
maybe you need the address in the message anyway...


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

View raw message