The priority was set to LOG_DEBUG

sorry for the mistake

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


The problem is that if i don't add following lines in code the logs for 
DEBUGMSG("Started") and DEBUGMSGTL("snmpV3Agent","Started") do not come but my 
logfile is created

    debug_register_tokens("snmpV3Agent,currentAlarmTable");
    snmp_set_do_debugging(1);

but on adding these above lines log start coming in my logfile but also come on 
console

code piece:
-------------------------------------------------------------
    debug_register_tokens("snmpV3Agent,currentAlarmTable");
    snmp_set_do_debugging(1);

        /* Logging to a different file */
        logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);
        if (logh) 
        {
                logh->pri_max = pri_max;
                logh->token   = strdup("/root/AGENT/Agent.log");
                netsnmp_enable_filelog(logh,                                    
           netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
                                 NETSNMP_DS_LIB_APPEND_LOGFILES));      
        }
        if (agentx_subagent) 
        {
                DEBUGMSG(("Using as Agentx SubAgent\n"));
                DEBUGMSGTL(("snmpV3Agent", "Using as Agentx SubAgent\n"));
                netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
                                NETSNMP_DS_AGENT_ROLE, 1);

                netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
                                NETSNMP_DS_AGENT_X_SOCKET, AGENTX_ADDRESS);

                DEBUGMSGTL(("snmpV3Agent","Agent starting as AgentX 
Subagent.\n"));

        }
--------------------------------------------------------------

I am attaching my main file.I actually wanted that logs of mysubagent(AgentX) 
come in mylogfile and master agent in /var/logs/snmpd.log




Thanks a Lot 

----- Original Message -----
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: [email protected]
Sent: Fri, 13 Jun 2008 18:46:56 +0530 (IST)
Subject: Re: Logging of subagent to different file

2008/6/13  <[EMAIL PROTECTED]>:
> i tried using this as
>
> netsnmp_log_handler *logh;
> logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);

"priority" ?
What value does this have?


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

Isn't that what you wanted?
For messages to be logged in this 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

Where in your subagent code did you add these lines?
It's almost impossible to comment on what might be happening,
given such an isolated fragment of code.


>  so could it be possible that my subagent(Agentx) logs come in
> different file and master agent in different file

Yes - both Magnus and I have already told you that this
is possible.

But without a better description of what you are actually doing,
there's no way that we can help you find out what's going wrong.

Dave

Attachment: snmpV3Agent.c
Description: Binary data

-------------------------------------------------------------------------
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