Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: On Static Linking - Could not instantiate class [org.apache.log4j.Conso: msg#00061

apache.logging.log4cxx.user

Subject: Re: On Static Linking - Could not instantiate class [org.apache.log4j.ConsoleAppender]


On Nov 28, 2007, at 2:07 PM, Unnikrishnan Udinoor wrote:

Hi,

I am using log4cxx 0.9.7 version. On dynamically linking to the log4cxx library my C++ application works fine with the logging.

On changing the linking to static log4cxx , I get errors stating that unable to instantiate the class.

Can someone help me to fix this issue ? Thanks a lot in Advance.

To be specific, this is the error I am getting.


Use of log4cxx 0.9.7 is discouraged. Please consider moving to the SVN HEAD. I remember a lot of pain with using log4cxx 0.9.7 from a static library and those issues should be fixed in the SVN HEAD.

The issue is due to the class registration information is only linked in when there is some explicit reference to the appender in the code. In this case, the linker did not see any reference to ConsoleAppender or RollingFileAppender when it linked your app, so those object files weren't linked into your app. Since they weren't linked the static constructor that adds those classes to the list of available classes and so you get the class not found messages. If you really want to use 0.9.7, you need to compel the linker to bring the appenders and layouts that you need into the app. You could do that by having something (even unreachable code) in your app call ConsoleAppender::getStaticClass(), etc.



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.postgresql.b...    video.ffmpeg.us...    gis.qgis.devel/...    web.rdf.redland...    file-systems.oc...    recreation.rail...    systems.archos....    python.c++/2003...    lang.c--/2005-0...    multimedia.gpho...    network.unison....    editors.jedit.u...    hardware.pciids...    cms.tiki.cvs/20...    bug-tracking.ma...    java.hadoop.hba...    ietf.rsvp/2002-...    xfree86.devel/2...    qnx.openqnx.dev...    apache.labs.dev...    tex.pdftex/2008...    os.solaris.open...    user-groups.lin...    kde.koffice/200...   
Home | advertise | OSDir is an inevitable website. super tiny logo

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