Jostein, I'm no expert, but I'll give my opinion.
I think this would be a better way of doing what you wrote: log4cxx::logstream log(main, log4cxx::Level::getDebug()); log << "Variable i: " << i << LOG4CXX_ENDMSG; The logstream checks whether the logger is enabled before outputing any messages. And, you can then follow that with: log << "Variable c: " << c << LOG4CXX_ENDMSG; log << log4cxx::Level::getInfo() << "This message is at the INFO level" << LOG4CXX_ENDMSG; With this setup, log in a sense replaces cout, and LOG4CXX_ENDMSG replaces endl. The downside of this way vs. yours seems to be that the logstream is always created and used, which, according to this mailing list, is an expensive operation. In my (single-threaded) application, I create a logstream in each object and use that for the entire life of the object. Hope that's helpful, -David -----Original Message----- From: Jostein Tveit [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 24, 2006 8:00 AM To: log4cxx-user@logging.apache.org Subject: logstream defines Hello log4cxx project, Have you ever thought of adding defines like this: #define LOG4CXX_DEBUG_STREAM(logger, message) { \ if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {\ log4cxx::logstream ls(logger, log4cxx::Level::DEBUG);\ ls << message << LOG4CXX_ENDMSG; }} Then it would be very easy to log for example variables: LOG4CXX_DEBUG_STREAM(main, "Variable i: " << i); What do you think? Am I missing something? Regards, -- Jostein Tveit <[EMAIL PROTECTED]>