You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Rainer Schuetze <sc...@geoinform.fh-mainz.de> on 2005/12/05 17:42:28 UTC

Logstream failed with std::string

Hi,

I tried to log a std::string to a logstream, but it failed: Regarding 
the posting on :
http://www.opensubscriber.com/message/log4cxx-user@logging.apache.org/1481199.html

I make a work-around which is attended below. The implementation on the 
logstream class works fine for me, but I suppose there must be a more 
elegant solution for this problem.


in the stream.h:
LOG4CXX_EXPORT ::log4cxx::logstream& operator<<(
    ::log4cxx::logstream& lhs,
    const ::std::string& rhs);


in the logstream.cpp
::log4cxx::logstream& operator<<(
    ::log4cxx::logstream& lhs,
    const ::std::string& rhs) {
	return lhs << rhs.c_str();
}

Regards
Rainer