[AGENT++] Logging output to a file...

Jochen Katz katz at agentpp.com
Sat Nov 6 13:35:50 CET 2004


Hi,

> I am trying to get all of the output from the screen into the file,
> but so far I am no happy with my results. One thing that I found is
> in the DefaultLog::log() function (see bellow), but this requires me
> to change the "agent++/include/log.h" file.
> 
> static AgentLog* log() { if (!instance) init(new
> AgentLogImpl("snmp_log.txt")); return instance; }
> 
> Is there a nicer way to do this?

yes, use DefaultLog::init(new AgentLogImpl("snmp_log.txt")) in your 
main() function before doing anything else.

> Also, once this is done only agent++ logs its outputs into the
> specified file. snmp++ on the other hand seem to be a different
> story. Any clean way to get snmp++ ouput to the same file?

snmp++ has debug_set_logfile(const char *filename).

Maybe in future, we can move the logging code from agent++ to snmp++.

Regards,
   Jochen



More information about the AGENTPP mailing list