[AGENT++] Mib initialization generates a debug assertion problem when I use my own logger class?

Yasemin YILMAZ yaseyilmaz at gmail.com
Fri May 21 14:40:07 CEST 2010


Hi all,

I want to use my own logger class like ATMExample under agent++win32. I have
declared myAgentLog class as following. But Visual C++ debugger is thrown an
error that is *"Debug Assertion Failed" Expression: _BLOCK_TYPE_IS_VALID
(pHead->nBlockUse)* on the code line *mib->init (); *if I uncommented
*DefaultLog::init
(new myAgentLog ());* What can be the problem?

class myAgentLog : public AgentLog
{
public:
    myAgentLog () {}
    ~myAgentLog () {}

    LogEntry* create_log_entry (unsigned char t) const
    { return new LogEntryImpl (t); }

    AgentLog& operator+=(const LogEntry* log)
    {
        string sLogLevel;
        switch (log->get_class ())
        {
            case ERROR_LOG:
                sLogLevel.assign ("[ERR]");
                break;
            case WARNING_LOG:
                sLogLevel.assign ("[WAR]");
                break;
            case EVENT_LOG:
                sLogLevel.assign ("[EVE]");
                break;
            case INFO_LOG:
                sLogLevel.assign ("[INF]");
                break;
            case DEBUG_LOG:
                sLogLevel.assign ("[DEB]");
                break;
            default:
                break;
        }
        cout << "[AGE] " << sLogLevel.c_str () << " " << log->get_value ()
<< endl;

        return *this;
    }
};

Thanks in advance for your helps and clarifications,

Best regards,
Yasemin



More information about the AGENTPP mailing list