|
|
Sponsor |
RE: LOG4CXX_DEBUG macro fails when used in a shared object or .so file gcc: msg#00003apache.logging.log4cxx.user
Hi Curt, Thank you for the reply, atleast I now know that there is indeed a problem, as I was trying different ways to solve the problem. currently I am using std::ostrstream to do the same and found that it works. my new code looks as follows std::ostrstream outx; string str1 = "this is devender "; outx << str1; int i = 0; outx<< i++; logger->debug(outx.str()); I added the above code just in case some one else end up with the same problem. Thank you. Sincierly Marri Devender Rao -----Original Message----- From: Curt Arnold [mailto:carnold@xxxxxxxxxx] Sent: Wed 10/13/2004 2:16 PM To: Log4CXX User Cc: Subject: Re: LOG4CXX_DEBUG macro fails when used in a shared object or .so file gcc > Can some body tell me what difference does the #define macro for > LOG4CXX_DEBUG makes for a shared object to that of > an executable. > > sample code... > 1)string str1 = "this is devender "; > 2)LOG4CXX_DEBUG(loggerx, _T("MSG ") << str1); > 3)int i = 0; > 4)LOG4CXX_DEBUG(loggerx, _T("MSG ") << i++); > > I appreciate every body for taking ur precious time in looking at my > email. > Sincierly > Marri Devender Rao > There have been muiltiple reports of segmentation faults due to the initialization order of static constructors when using log4cxx in a shared library. My guess is this could be another manifestation of the same problem. It is on my list of things to investigate. Please avoid using operator<< with the LOG4CXX_* macros. Yes you can get away with it now, but it depends on undocumented and undesirable aspects of the macros that I intend to eliminate when addressing http://nagoya.apache.org/jira/browse/LOGCXX-10 (likely 0.9.9). The _T macros are also undesirable and should not be used in new code. I recently added a stream wrapper for log4cxx (see http://nagoya.apache.org/jira/browse/LOGCXX-18) and recent messages on the thread. I think the basic usage patterns are reasonably solid, though the implementation needs to be optimized to delay buffer allocation until needed. If you wanted to use it, your code fragment would look like: #include <log4cxx/stream.h> > > string str1 = "this is devender "; log4cxx::logstream ls (loggerx, log4cxx::Level::DEBUG); ls << "MSG" << str1 << LOG4CXX_ENDMSG; int i = 0; ls << "MSG" << i++ << LOG4CXX_ENDMSG; May still run into the segmentation issue, since my guess is that it is unrelated. <<winmail.dat>>
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: LOG4CXX_DEBUG macro fails when used in a shared object or .so file gcc, Curt Arnold |
|---|---|
| Next by Date: | solaris - log4cxx compilation, Sebastian Gurgul |
| Previous by Thread: | Re: LOG4CXX_DEBUG macro fails when used in a shared object or .so file gcc, Curt Arnold |
| Next by Thread: | Re: LOG4CXX_DEBUG macro fails when used in a shared object or .so file gcc, Curt Arnold |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive 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 |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|