Callback logging

Sverre Moe <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <cd64fb5f-0b2e-4775-8f4a-b77a2a839376@zcs>
Scouring the web and the mailing list archive for information about implementing a callback logging. I could only find bits and pieces. 


If I haven't overlooked it and it is actually there, I think this information should be available on the Net-SNMP Wiki. A small tutorial on how to implement callback logging with your own or your favorite logging framework. 






I am though left with a few remaining questions: 
What should I do with majorID and minorID in the callback function (in this case defined in snmp_register_callback)? Is there some situation where one would need to check the majorID and minorID in the callback? 

What do I return in my callback function? 

log4cplus:: Logger snmp_logger = log4cplus:: Logger::getInstance(LOG4CPLUS_TEXT("SNMP")); 

extern "C" { 
SNMPCallback logging_callback; 
} 

int main(int argc, char **argv) { 
snmp_enable_calllog(); 
snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_LOGGING, logging_callback, NULL); 
} 


int 
logging_callback(int majorID, int minorID, void *serverarg, void *clientarg) { 
snmp_log_message *log_message = (snmp_log_message *) serverarg; 
string message = log_message->msg; 
LOG4CPLUS_INFO(snmp_logger, LOG4CPLUS_TEXT(message)); 

return 1; 
} 

CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.