logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Middleton <osfan6...@gmail.com>
Subject Re: Compiling on Windows
Date Thu, 23 Apr 2015 03:58:06 GMT
Update on the crash:  I don't know what is going on with it, but I have
narrowed down how to reproduce it.  It turns out that the macros for
logging( for example LOG4CXX_ERROR) create a
log4cxx::helpers::MessageBuffer oss_; object.  This object gets created and
the message is logged using it.  If the logging level is not valid, the
MessageBuffer object is not created, and so the crash does not occur.

The strange thing is that the crash happens at the end of the method that
the logging statement is in, it does *not* happen when the destructor of
the MessageBuffer is called.  Windows indicates that this is a BEX
error(buffer overflow).

One solution that I saw was to make sure the library is compiled with /MD,
I checked the output for log4cxx and it is compiled with that, and my
program is compiled with -MD.  Any ideas on what could be causing it?

-Robert Middleton

On Wed, Apr 22, 2015 at 10:05 PM, Robert Middleton <osfan6313@gmail.com>

> Thorsten,
> Thanks for the information.  For future reference, here is what I needed
> to get it to build:
>    - Windows compiler(cl).  I had the Windows 7 SDK installed, which gave
>    me the command prompt with cl on PATH and the proper environment
>    - ant from: http://ant.apache.org/bindownload.cgi
>    - ant-contrib-1.0b3.jar from:
>    http://sourceforge.net/projects/ant-contrib/files/ant-contrib/
>    - cpptasks-1.0b5.jar from ant-contrib
>    - xercesImpl.jar from http://xerces.apache.org/mirrors.cgi#binary
> I set my %PATH% to have the ant bin/ directory on it, and put the 3 jar
> files on %CLASSPATH%.  I then ran ant -Dfind=false -Ddebug=no.  This built
> the library; I added it to the .pro file with the following, after copying
> over the .dll and .lib file to the directory with the .pro:
> win32:CONFIG(release, debug|release): LIBS += -L$$PWD/ -llog4cxx
> I then copied over the log4cxx include directory and put in logging.
> Everything builds cleanly with MSVC, the problem is that as soon as
> something gets logged my program crashes - it appears to be happening
> within log4cxx, since I can cause it to happen by changing the level of a
> log statement.
> -Robert Middleton
> On Wed, Apr 22, 2015 at 3:38 AM, Thorsten Schöning <tschoening@am-soft.de>
> wrote:
>> Guten Tag Robert Middleton,
>> am Mittwoch, 22. April 2015 um 04:31 schrieben Sie:
>> > I want to use log4cxx on a Windows-based project, and I'm wondering
>> > what the easiest way to compile it for Windows is?
>> I guess that heavily depends on your compiler and toolchain, not sure
>> if I read about QT on the list in the past, so you may be the first
>> one trying. I would try to start using ANT and see how it's going, my
>> experience using Cygwin is not the best if it comes to building
>> software, but I didn't ever try with log4cxx.
>> https://logging.apache.org/log4cxx/building/ant.html
>> Mit freundlichen Grüßen,
>> Thorsten Schöning
>> --
>> Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
>> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>> Telefon...........05151-  9468- 55
>> Fax...............05151-  9468- 88
>> Mobil..............0178-8 9468- 04
>> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
>> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

View raw message