Hello,

I want to do logging of my subagent(Master[snmpd] - subagent[myAgent] 
configuration) to a different file for this i have created a new handler and 
registered my tokens :

<Code snippet 1 Starts>:
=============================================================
netsnmp_log_handler *logh;
int             priority = LOG_DEBUG;
int             pri_max  = LOG_EMERG;
/* Logging to a different file */
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);
        if (logh) 
        {
                logh->pri_max = pri_max;
                logh->token   = strdup("mySubAgent.log");
                netsnmp_enable_filelog(logh,                                    
           netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
                  NETSNMP_DS_LIB_APPEND_LOGFILES));     
        }

    debug_register_tokens("snmpV3Agent,currentAlarmTable");
    snmp_set_do_debugging(1);
=============================================================
<Code snippet 1 Ends>:

and then use DEBUGMSGTL() to enter logs, e.g :

<Code snippet 2 Starts>:
=============================================================
DEBUGMSGTL(("snmpV3Agent", "Using as Agentx SubAgent\n"));
=============================================================
<Code snippet 2 Ends>:

But i want to do logging of my subagent to a different file for various 
priorities and control that priority through config file i.e

LOG_DEBUG , LOG_INFO , LOG_WARNING , LOG_CRIT

i.e While debugging just enable log messages for LOG_DEBUG and in production 
enable log messages for LOG_CRIT and LOG_WARNING.

Which api to use for this ( shall i use snmp_log or DEBUGMSGTL api) and how to 
control logging through configuration

Thanks

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to