Here is some example code I read from some tutorial:
int main(int argc, char* argv[])
{
log4cpp::OstreamAppender* osAppender = new log4cpp::OstreamAppender("osAppender", &cout);
osAppender->setLayout(new log4cpp::BasicLayout());
log4cpp::Category& root = log4cpp::Category::getRoot();
root.addAppender(osAppender);
root.setPriority(log4cpp::Priority::DEBUG);
root.error("Hello log4cpp in a Error Message!");
root.warn("Hello log4cpp in a Warning Message!");
log4cpp::Category::shutdown();
getchar();
return 0;
}
Error report:
Unhandled exception at 0x76fe15de of log4cpp_Test.exe: 0xC0000005: Access violation wile reading 0x00000024
What might have caused the error ?
The code which you have posted is ok. It is compiled and run well. Are you sure that you have no additional code beside that posted one? The problem might be caused by just few additional lines.
It looks like somewhere NULL pointer is dereferenced, which causes the access violation.
I think you run into this bug ... and it is from 2008.
User contributions licensed under CC BY-SA 3.0