logo       

Possible error with logging a stringstream: msg#00036

Subject: Possible error with logging a stringstream
Hi!
 
When using log4cxx I usually do something like this to build the log string.
 
std::stringstream oss;
oss << "This is my logging and the result is: ";
int i=getANumber();
if( i == 1 )
{
  oss << "1";
}
else
{
  oss << "something else";
}
LOG4CXX_DEBUG(logger, oss.str();
 
nextMethodToCall();
 
[This works ok.]
 
 
One time I added
    oss << std::ends;
before the LOG4CXX_DEBUG call.
 
 
This log line never appeared in the log and the nextMethodToCall() method was never called. It seemed like the
thread where this was done hanged in the LOG4CXX_DEBUG call!
 
Great if you could check that. I'm using the head version of LOG4CXX downloaded the 19. december this year =)
 
 
 
Another thing while I'm at it:
 
I have used the LOG4CXX_DEBUG command with concatuating several std::string(s) as parameters, ie:
LOG4CXX_DEBUG(logger, "This is a string: " + myFirstString + " and this is another one: " + myOtherString );
 
It does only work with strings. Do you have any plans of making this possible for other types aswell (as in log4j)..?
(I know java has the advantage of toString() and that is probably why this doesn't work right?)
int a = 5;
LOG4CXX_DEBUG(logger, "This is a number test: " + a);
 
It compiled but resulted in the following logline:
.... - is a number test:
 
The first word was cut and the integer was never printed.
 
 
 
Happy Christmas from
Tomas Andersen
Consultant
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | 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