An update: I was able to define the following function in my own header (in the global namespace) that enabled me to use strings with logstream.
inline log4cxx::logstream& operator<<( log4cxx::logstream& lhs, const std::string& rhs) { lhs.getStream() << rhs.c_str(); return lhs; } Again, though, I don't know the costs of using .c_str(), and this seems like a round-about way of fixing this. -David -----Original Message----- From: Steck, David Sent: Friday, July 22, 2005 12:57 PM To: Log4CXX User Subject: Using logstream with std::string Hi all, I am just starting to use log4cxx and happened across the logstream class. This seems like a wonderful idea (vs. fixed string macros). Unless there are reasons I don't know about, I intend to use this class to replace all my cout statements, and I'll skip using the standard macros all together. But, looking a little at the mailing list archives, it sounds like there are still issues with the logstream class. In particular, I've run into the same problem outputting strings that was described in the messages sent 6/6/05 and 6/7/05, with subject "Status of stream.h?". My approach has been to append .c_str() to all my strings, which works fine, but I don't know what the consequences (performance, etc.) of this are, and it feels like a kludge. Has any progress been made in this area? Has anyone written a function to allow strings to be output with logstream? Thanks in advance, -David BTW, I agree with Andreas' suggestion to rename stream.h to logstream.h. In my case, it would have helped me find the source file, logstream.cpp, more easily. Also, I would currently prefer to use logstream over a parameterized printf()-style function call.