[AGENT++] logging to a file instead of stdout

Fedja Jeleskovic mrawd2 at gmail.com
Thu Dec 16 19:01:54 CET 2004


Here is the code that works for me:
#define LOG_FILE_NAME "log.txt"

#ifndef _NO_LOGGING
  // set the log file for the Agent++ side...
DefaultLog::init(new AgentLogImpl(LOG_FILE_NAME));

 // set the log file for the SNMP++ side...
 debug_set_logfile(LOG_FILE_NAME);

 // set the log file filters...
 DefaultLog::log()->set_filter(ERROR_LOG, 5);
 DefaultLog::log()->set_filter(WARNING_LOG, 5);
 DefaultLog::log()->set_filter(EVENT_LOG, 5);
 DefaultLog::log()->set_filter(INFO_LOG, 5);
 DefaultLog::log()->set_filter(DEBUG_LOG, 8);
#endif
 
Did you forget to add filters?

Fedja


On Thu, 16 Dec 2004 18:08:48 +0100, Loridon, Martin
<martin.loridon at barco.com> wrote:
> Hi,
> 
> I want to put the logging in a file instead of stdout. Hereby, I have the
> following questions:
> 
> - For agent++ logging, I put DefaultLog::init(new
> AgentLogImpl("FrameLogging.txt")); as the very first line in my main
> function.
> 
> After running my program and calling LOG_BEGIN, LOG and LOG_END, the file
> has been created but I do not manage in putting something in that file.
> 
> Any suggestion what I do wrong or forget to do?
> 
> -For snmp++ logging, debug_set_logfile("FrameLogging.txt"); works fine. btw
> May I use one and the same file for agent++ and snmp++ logging?
> 
> -As our agent is running on an embedded platform and has limited resources,
> how can I keep the log file size under control?
> 
> Thanks in advance for any help,
> 
> kr,
> 
> Martin
> 
> - - - - - - - DISCLAIMER - - - - - - - -
> Unless indicated otherwise, the information contained in this message is
> privileged and confidential, and is intended only for the use of the
> addressee(s) named above and others who have been specifically authorized to
> receive it. If you are not the intended recipient, you are hereby notified
> that any dissemination, distribution or copying of this message and/or
> attachments is strictly prohibited. The company accepts no liability for any
> damage caused by any virus transmitted by this email. Furthermore, the
> company does not warrant a proper and complete transmission of this
> information, nor does it accept liability for any delays. If you have
> received this message in error, please contact the sender and delete the
> message. Thank you.
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://agentpp.org/mailman/listinfo/agentpp
>



More information about the AGENTPP mailing list