[AGENT++] Need help about Logging to file
lsq
song_q_lee at tom.com
Wed Sep 10 18:15:29 CEST 2003
Hi all,
I'm using Agent++ 3.5.12,build it to a dll,
In my MFC program,I want log to a file.
The codes I use are as below:
strLogFile=".\\file.txt";
pfile=fopen(strLogFile,"a");
#ifndef _NO_LOGGING
((AgentLogImpl*) DefaultLog::log())->set_dest(pfile);
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, 6);
#endif
.....
LOG_BEGIN(EVENT_LOG | 1);
LOG("main: SNMP listen port");
LOG(port);
LOG_END;
But I got a Access Violation at "LOG_END;"
When I trace into the dll, it stop at "AgentLog& AgentLogImpl::operator+=(const LogEntry* log)"
it was "fprintf(logfile, "%s\n", log->get_value())" where the violation happens
Is here someone can help me to solve the problem?
Best Regards
Sigurd
More information about the AGENTPP
mailing list