I have an requirement to record the snmp authentication sucess and failure details into used log4j2 framework. My code will hit only for success of authentication/snmpget/bulk command and failure snmp commands like argument passed invalid username/OID not exist will not hit my code and response will go the client by used snmp4j/snmp4j-agent jar. On failure case i would miss to log statement into used log4j2 framework.
I have followed few below approaches provided in internet and those are not helpfull
1.https://www.snmp4j.org/CHANGES-2.x.txt: used latest snmp4j-log4j2.8.2 version with snmp4j2.8.4 and snmp4j-agent2.7.4 jar
- https://bugzilla.redhat.com/show_bug.cgi?id=591762 : To send SNMP4J logs to log4j, you can either add "-Dsnmp4j.LogFactory=org.snmp4j.log.Log4jLogFactory" to the RHQ java opts, or call LogFactory.setLogFactory(new org.snmp4j.log.Log4jLogFactory()) in code.
Can any one please help me how to redirect snmp4j logs to used log4j2 framework?