[SNMP4J] SnmpRequest.java not logging errors

Frank Fock fock at agentpp.com
Sat Aug 2 08:10:06 CEST 2008


Hi,

There is IMHO no abnormal program event
that is "logged" to console and not forwarded
to the logging adapter. The event below is
a *normal* program event, since returning
a SNMP error status is a normal task of a
SNMP agent.

So, printing the stacktrace here in debug
mode is for debugging only, or do you
want to log each SNMP error returned
by the agent in production?

Best regards,
Frank

Mark Gorokhov schrieb:
> I support this request to remove all printStackTrace() from 
> SNMP4J code and use only RuntimeExceptions. Other option is to
> add error event listeners and let them decide what to do 
> with the problem.
>
> Mark G.
>
> -----Original Message-----
> From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
> Behalf Of Wilson Burgos
> Sent: Friday, August 01, 2008 1:16 PM
> To: snmp4j at agentpp.org
> Subject: [SNMP4J] SnmpRequest.java not logging errors
>
> Hello,
> 	I'm using SNMP4j and I can't seem to log SNMP errors when debug
> is enabled. I found out the SnmpRequest.java is dumping them to the
> console only. Is this the intended behavior not log error messages?
>
> public void requestStatusChanged(RequestStatusEvent event) {
>       int newStatus = event.getStatus().getErrorStatus();
>       setErrorStatus(newStatus);
>       if (logger.isDebugEnabled() &&
>           (newStatus != SnmpConstants.SNMP_ERROR_SUCCESS)) {
>         new Exception("Error '"+                      
>  
> PDU.toErrorStatusText(event.getStatus().getErrorStatus())+
>                       "' generated at: "+vb).printStackTrace();
>       }
> }
>
> Thanks,
> Wil
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>   




More information about the SNMP4J mailing list