logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

RE: SIGSEGV on log4cxx initialisation: msg#00042

apache.logging.log4cxx.user

Subject: RE: SIGSEGV on log4cxx initialisation

Welcome to order of initialization hell :) Try this instead:

#include <log4cxx/Logger.h>
#include <log4cxx/basicconfigurator.h>

using namespace log4cxx;

LoggerPtr GetLogger()
{
static LoggerPtr logger = Logger::getLogger("a.b");
return logger;
}

int main(int argc, char* argv[])
{
BasicConfigurator::configure();
GetLogger()->fatal("Fatal message");
}

HTH,
Stoyan

-----Original Message-----
From: Tom Quarendon [mailto:tomq@xxxxxxxxxxxxx]
Sent: Thursday, August 26, 2004 15:05
To: log4cxx-user@xxxxxxxxxxxxxxxxxx
Subject: SIGSEGV on log4cxx initialisation

Unless I've called some kind of configuration before I call
Logger::getLogger, I seem to get a SIGSEGV. Program continues and works as
expected, it is just an anoyance in a debugger where you get a SIGSEGV
before you get to main. Indeed it's taken me quite a long time to realise
that the segv is caused by log4cxx, and to realise that if you just continue
and ignore it the program works fine.

The sample program I'm using is

#include <log4cxx/Logger.h>
#include <log4cxx/basicconfigurator.h>

using namespace log4cxx;
LoggerPtr logger = Logger::getLogger("a.b");

int main(int argc, char* argv[]) {
BasicConfigurator::configure();
logger->fatal("Fatal message");
}

I'm on Windows XP and using Cygwin GCC, and running this through gdb I get 2
segvs before I get to main.

I've just noticed that if I change it to move the "LoggerPtr logger = ..."
line after the BasicConfigurator::configure() call I get the same 2 segvs,
but this time when stepping over the BasicConfigurator::configure call.

I'm not sure how to compile the log4cxx code with debug, so at the moment I
can't give any help on where these segvx are comming from.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.737 / Virus Database: 491 - Release Date: 11/08/2004





<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo