You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by CALOI ROBERTO MARIA <RO...@sella.it> on 2008/06/12 10:26:15 UTC

Log4cxx with VisualC++ 2008 Express Edition - Release issue

Hello,
I'm having a runtime crash when using the release version of Log4cxx.
This case seems very similar to the FAQ #2 ("My application on Windows crashes on shutdown") where it is suggested to use the same type of C Runtime library.

My project is called prova3.sln with the following source

#include <iostream>

#include "log4cxx/logger.h"
#include "log4cxx/basicconfigurator.h"
#include "log4cxx/helpers/exception.h"

using namespace log4cxx;
using namespace log4cxx::helpers;

LoggerPtr logger(Logger::getLogger("MyApp"));

int main(int argc, char **argv)
{
        int result = EXIT_SUCCESS;
        try
        {
                // Set up a simple configuration that logs on the console.
                BasicConfigurator::configure();

                LOG4CXX_INFO(logger, "Entering application.");
                LOG4CXX_INFO(logger, "Exiting application.");
        }
        catch(Exception&)
        {
                result = EXIT_FAILURE;
        }
      std::cout << "Hello!" << std::endl;
            //char c=std::cin.get();

        return result;
}

DEBUG (Runtime library setting)
The program runs fine if I build the debug version by using:
Prova3.exe : Multi-threaded DLL Debug (/MDd)
Log4cxx.dll: Multi-threaded DLL Debug (/MDd)
Apr-1.lib: Multi-threaded Debug (/MTd)
Aprutil-1.lib: Multi-threaded Debug (/MTd)
Expat.dll: Multi-threaded DLL Debug (/MDd)
(I had to build expat.lib separately to solve some "unresolved references" I got while building the aprutil.sln project).

RELEASE (Runtime library setting)
The program crashes at exit if I build the release version by using:
Prova3.exe : Multi-threaded DLL(/MD)
Log4cxx.dll: Multi-threaded DLL(/MD)
Apr-1.lib: Multi-threaded(/MT)
Aprutil-1.lib: Multi-threaded(/MT)
Expat.dll: Multi-threaded DLL(/MD)

Is there any problem in using static apr-1 and aprutil-1 to build log4cxx .dll?
I tried to build apr and aprutil with the /MD option too, then I got the same runtime error.

Does anybody have any idea on where I'm wrong?

Thanks

Roberto





Le informazioni contenute in questo messaggio di posta elettronica sono riservate, rivolte esclusivamente al destinatario e non comportano alcun vincolo ne' creano obblighi per la societa' mittente, salvo che cio' non sia espressamente previsto da un precedente accordo.
Ogni altra persona diversa dal destinatario non puo' copiare o consegnare il presente messaggio o parte dello stesso a terzi ne' trattare in alcun modo i dati contenuti. La informiamo inoltre che l'utilizzo non autorizzato del messaggio o dei suoi allegati potrebbe costituire reato.

Grazie per la collaborazione.

The informations in this e-mail are are reserved, only addressed to the addressee and they are neither binding on this Society nor to be understood as creating any obligation on its part except where provided for an agreement.
Everyone different from the addressee (who received this e-mail) can't neither copy nor deliver the message or a part of it in possesion of a third party, nor even deal with the informations in this e-mail. Furthermore the unauthorized use of this message or any attachments could be an offence.

Thank you for your cooperation.