i tried using this as

netsnmp_log_handler *logh;
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);

if (logh)
{
   logh->pri_max = pri_max;
   logh->token   = strdup("/root/myAgentx.log");
   netsnmp_enable_filelog(logh,
   netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
   NETSNMP_DS_LIB_APPEND_LOGFILES));
}

but when i used API log file was created but logs for DEBUGMSG("Started") were 
found in the file

then i also added
    debug_register_tokens("snmpV3Agent,currentAlarmTable");
    snmp_set_do_debugging(1);

Then the logs start coming but they were also shown on stdout(console) which i 
don,t won't so could it be possible that my subagent(Agentx) logs come in 
different file and master agent in different file


Thanks

----- Original Message -----
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: [email protected], [EMAIL PROTECTED]
Sent: Wed, 11 Jun 2008 14:15:34 +0530 (IST)
Subject: Re: Logging of subagent to different file

2008/6/10  <[EMAIL PROTECTED]>:
> Could it be possible for creating a different log file for subagent
> and manage the log level and type of log messages to be logged.

If your subagent understands the standard command-line arguments,
then you can use the -Lf option to specify the appropriate log file to use.

Otherwise, you could either code your subagent to use the
snmp_log_options() routine  (to handle command-line options),
or extract the relevant code from this routine.

You basically need to set up a NETSNMP_LOGHANDLER_FILE
style log handler, and specify the name of the file to log to
(logh->token)

Dave

PS:  Can you please post requests to *one* of the mailing lists,
        not both.  Thanks


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to