Hi,
Thanks for the info. I added the lines to my sub-agent
code but it won't compile (error is: "undeclared
SUBAGENT-LOGFILE"). If I commented out that line, then
the link failed ("undefined reference to
`setup_log'").

What header file or/and library am I missing?
Thanks
Steve
Thillaivillagam" <[EMAIL PROTECTED]> wrote:

> Put the following lines of code in your subagent
> program:
> 
>         logh =
> netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE,
> 
> LOG_DEBUG);
>         if (logh)
>         {
>                 logh->pri_max = LOG_EMERG;
>                 logh->token =
> strdup(SUBAGENT_LOGFILE);
>         }
>  
>         setup_log(0, /* 1=Don't zero log, instead
> append to it */
>                           0, /* stderr_log */
>                           /var/log/subagent.log); /*
> */
> 
> The subagent will log to subagent.log.
> 
> Anand
> 
> 
> Steve S. Law wrote:
> 
> >In my sub-agent program, I have
> snmp_enable_calllog()
> >and
> >several snmp_log()calls but nothing is being logged
> in
> >/var/log/snmpd.log file (default?). I thought
> >snmpd.log is only for AgentX master agent and not
> for
> >sub-agent?  Or even sub-agent will be logged to the
> >same file also? Clearly, I don't want my sub-agent
> and
> >master agent logging to the same file. I want to
> have
> >a log file for sub-agent separately. How do I do
> it?
> >
> >I still have no luck in logging.
> >
> >Please help.
> >
> >Steve
> >
> >
> >--- Robert Story <[EMAIL PROTECTED]> wrote:
> >
> >  
> >
> >>On Fri, 29 Jul 2005 15:07:11 -0700 (PDT) Steve
> >>wrote:
> >>SSL> So far I have been using printf statements in
> >>my
> >>SSL> sub-agent. I want to log them into a file
> >>instead, so
> >>SSL> in the sub-agent main program, I set 'syslog'
> >>to 1
> >>SSL> which invokes snmp_enable_callog(). However,
> >>when I
> >>SSL> run it, I don't see any thing on the screean
> >>but I
> >>SSL> don't know where and if anything is being
> >>logged at
> >>SSL> all in any file.
> >>
> >>The default log file is /var/log/snmpd.log.
> >>
> >>SSL> Can you tell me what I should do? Do I need
> to
> >>write
> >>SSL> more code? what is DEBUGMSG for? I should use
> >>DEBUGMSG
> >>SSL> instead of printf in my code?
> >>
> >>If you always want to log, then snmp_log() is
> >>probably what you want. If it is
> >>really debug, and you only want to see it when the
> >>right debug flag is
> >>enabled, then use the DEBUG* macros.
> >>
> >>-- 
> >>NOTE: messages sent directly to me, instead of the
> >>lists, will be deleted
> >>      unless they are requests for paid consulting
> >>services.
> >>
> >>Robert Story; NET-SNMP Junkie
> >>Support: <http://www.net-snmp.org/>
> >><irc://irc.freenode.net/#net-snmp>  
> >>Archive:
> >>
> >>    
> >>
>
><http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-users>
> >  
> >
> >>You are lost in a twisty maze of little standards,
> >>all different. 
> >>
> >>    
> >>
> >
> >
> >
>
>-------------------------------------------------------
> >SF.Net email is Sponsored by the Better Software
> Conference & EXPO
> >September 19-22, 2005 * San Francisco, CA *
> Development Lifecycle Practices
> >Agile & Plan-Driven Development * Managing Projects
> & Teams * Testing & QA
> >Security * Process Improvement & Measurement *
> http://www.sqe.com/bsce5sf
> >_______________________________________________
> >Net-snmp-users mailing list
> >Net-snmp-users@lists.sourceforge.net
> >Please see the following page to unsubscribe or
> change other options:
>
>https://lists.sourceforge.net/lists/listinfo/net-snmp-users
> >
> >  
> >
> 
> 
> 



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to