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: LOG4CXX_DEBUG macro fails when used in a shared object or .so file gcc: msg#00007

apache.logging.log4cxx.user

Subject: Re: LOG4CXX_DEBUG macro fails when used in a shared object or .so file gcc


On Oct 13, 2004, at 1:57 AM, Devender Marri wrote:


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());



The cost of constructing a std::ostringstream is non-trivial and calling logger->debug instead of using LOG4CXX_DEBUG loses the file name and line number (there is a bug report documentation to make that clear). I'd recommend the following:

if (logger->isDebugEnabled()) {
std::ostringstream outx;
string str1 = "this is devender";
outx << str1;
int i = 0;
outx << i++;
LOG4CXX_DEBUG(logger, outx,str());
}




<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