logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schuhmacher, Bret" <Bret.Schuhmac...@Aspect.com>
Subject RE: Anyone using SNMPTrapAppender?
Date Sun, 18 Jul 2004 18:52:30 GMT
Mark, you're absolutely right, adding the hostname is redundant to an
SNMP message.  That was a bad example of what I'm trying to do, though.
I've got connections to other machines and when those go down I want to
include the hostname of the machine to which I was connected, which is
different from what I wrote in my example.  I was just trying to keep
the example concise.  And, yes, I'm also using rolling file appenders,
too, so the hostname is important in the example I sent :-). 

Thanks for all your assistance!!! 



> -----Original Message-----
> From: Mark Masterson [mailto:m.masterson@computer.org] 
> Sent: Sunday, July 18, 2004 2:08 PM
> To: LOG4J Users Mailing List
> Subject: RE: Anyone using SNMPTrapAppender?
> 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) point.
> 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 implementations.
> 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...
> Cheers,
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org

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

View raw message