> I'd like to avoid having to create a logstream definition in every function > that needs it. > Is there any way to create a logstream in the header and then attach it to a > logger in the constructor?
Could you give an example of the code that you're writing that requires repeatedly explicitly creating a logstream? I ask because I've found the LOG4CXX_xxx macros to be sufficient to avoid needing logstream-related boilerplate. And also because of these comments in the code * Instances of log4cxx::logstream * are not designed for use by multiple threads and in general should be short-lived * function scoped objects. Using log4cxx::basic_logstream as a class member or * static instance should be avoided in the same manner as you would avoid placing a std::ostringstream * in those locations. which appear in main/include/log4cxx/stream.h. - Rhys