Here's the program I wrote based on your first post:

--------------------------------------------------------------
#include "stdafx.h"
#include "log4cxx/logger.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/exception.h"

using namespace log4cxx;
using namespace log4cxx::helpers;


int _tmain(int argc, _TCHAR* argv[])
{
    int result = EXIT_SUCCESS;
    try
    {
        PropertyConfigurator::configure("log4cxx.properties");
        LoggerPtr logger = log4cxx::Logger::getRootLogger();
        LOG4CXX_DEBUG(logger, "Test log...");
    }
    catch(Exception&)
    {
        result = EXIT_FAILURE;
    }
    return result;
}
--------------------------------------------------------------

And the properties file:
--------------------------------------------------------------
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
--------------------------------------------------------------

And when I run it, I get this output:
  0    [0x00000828] DEBUG root null - Test log...

Cory



Peter Gejgus wrote:
> My question is the same as the Paul's question at
> http://www.dreamcubes.com/blog/?itemid=43. But I see no meaningful
> answer there.
>
> Cory Riddell wrote:
>> Peter Gejgus wrote:
>>  
>>> I have log4cxx 0.10.0. I use it as a release dll in my project
>>> compiled under VS2005. When my project is built in debug, log4cxx has
>>> no problem. But when I built my project as release, I got a following
>>> issue:
>>>
>>> "A buffer overrun has occurred in foo.exe which has corrupted the
>>> program's internal state. Press Break to debug the program or Continue
>>> to terminate the program."
>>>
>>>     
>>
>>
>> So, if you press break and enter the debugger, can you see that the
>> buffer overrun is in log4cxx code?
>>
>> My first suspicion would be that you have an uninitialized variable
>> somewhere in your program. For some reason, VS initializes variables in
>> a debug build and not at all in a release build.
>>
>> cory
>>
>>
>>   
>
>

Reply via email to