logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Status of stream.h?
Date Tue, 07 Jun 2005 15:37:20 GMT
Okay, I can see it.  The problem is that the "ArbitraryType" template  
in the bottom of stream.h isn't expanded to std::string.  I attempted  
a quick std::basic_string operator<< template and ended up having  
conflicts in other code due to having multiple template expansions  
and the compiler could not choose between them.

If you can add your own operator<< for std::string to stream.h until  
we can find a general implementation.

The suggestion to do:

LOG4CXX_DEBUG(logger, "i = " << i);

is log4cxx-0.9.7 specific and is going away.


On Jun 7, 2005, at 3:14 AM, Paul Butcher wrote:


> On Tuesday 07 June 2005 01:40, Curt Arnold wrote:
>
>
>> Hard to troubleshoot without that error message.  Could you at least
>> tell me what compiler and platform that you are encountering the
>> problem on?
>>
>>
>
> Sorry, Curt - the same as in my earlier message: g++ (GCC) 3.3.4  
> (pre 3.3.5
> 20040809) running on SUSE Linux 9.2. Here's a small test program which
> reproduces the problem:
>
> ------------------------------------------------------
> #include <log4cxx/stream.h>
> #include <log4cxx/basicconfigurator.h>
>
> #include <string>
>
> int main()
> {
>   log4cxx::BasicConfigurator::configure();
>   log4cxx::LoggerPtr logger = log4cxx::Logger::getRootLogger();
>
>   log4cxx::logstream logstream(logger, log4cxx::Level::DEBUG);
>   logstream << "test" << LOG4CXX_ENDMSG;
>
>   std::string foo = "foo";
>   logstream << foo;
>
>   return 0;
> }
> ------------------------------------------------------
>
> And here is the full error message:
>
> ------------------------------------------------------
> log4cxx/stream.h: In function `log4cxx::logstream&
>    operator<<(log4cxx::logstream&, const ArbitraryType&) [with  
> ArbitraryType =
>    std::string]':
> logtest.cpp:15:   instantiated from here
> log4cxx/stream.h:212: error: no match for 'operator<<' in '
>    (+lhs)->log4cxx::logstream::getStream() << rhs'
> /usr/include/g++/bits/ostream.tcc:63: error: candidates are:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(std::basic_ostream<_CharT,
>    _Traits>&(*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT
 
> = wchar_t,
>    _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:74: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(std::basic_ios<_CharT,
>    _Traits>&(*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT =  
> wchar_t,
>    _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:86: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(std::ios_base&(*)(std::ios_base&)) [with  
> _CharT =
>    wchar_t, _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:122: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(long int) [with _CharT = wchar_t, _Traits =
>    std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:156: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(long unsigned int) [with _CharT = wchar_t,  
> _Traits =
>    std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:98: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(bool) [with _CharT = wchar_t, _Traits =
>    std::char_traits<wchar_t>]
> /usr/include/g++/ostream:178: error:
> std::basic_ostream<_CharT,
>    _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short
 
> int) [with
>    _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/ostream:189: error:
> std::basic_ostream<_CharT,
>    _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short
 
> unsigned
>    int) [with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/ostream:193: error:
> std::basic_ostream<_CharT,
>    _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int)
 
> [with _CharT
>    = wchar_t, _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/ostream:204: error:
> std::basic_ostream<_CharT,
>    _Traits>& std::basic_ostream<_CharT, _Traits>::operator<< 
> (unsigned int)
>    [with _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:181: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(long long int) [with _CharT = wchar_t,  
> _Traits =
>    std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:216: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(long long unsigned int) [with _CharT =  
> wchar_t,
> _Traits
>    = std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:241: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(double) [with _CharT = wchar_t, _Traits =
>    std::char_traits<wchar_t>]
> /usr/include/g++/ostream:219: error:
> std::basic_ostream<_CharT,
>    _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(float)
 
> [with
>    _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:265: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(long double) [with _CharT = wchar_t, _Traits =
>    std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:289: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(const void*) [with _CharT = wchar_t, _Traits =
>    std::char_traits<wchar_t>]
> /usr/include/g++/bits/ostream.tcc:313: error:
>    std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
>    _Traits>::operator<<(std::basic_streambuf<_CharT, _Traits>*)  
> [with _CharT =
>    wchar_t, _Traits = std::char_traits<wchar_t>]
> log4cxx/stream.h:153: error:                 log4cxx::logstream&
>    operator<<(log4cxx::logstream&, const char*)
> log4cxx/stream.h:173: error:                 log4cxx::logstream&
>    operator<<(log4cxx::logstream&, const log4cxx::spi::LocationInfo&)
> log4cxx/stream.h:181: error:                 log4cxx::logstream&
>    operator<<(log4cxx::logstream&, const log4cxx::spi::LocationFlush&)
> log4cxx/stream.h:188: error:                 log4cxx::logstream&
>    operator<<(log4cxx::logstream&, const log4cxx::LevelPtr&)
> log4cxx/stream.h:196: error:                 log4cxx::logstream&
>    operator<<(log4cxx::logstream&, std::ios_base&(*)(std::ios_base&))
> log4cxx/stream.h:210: error:                 log4cxx::logstream&
>    operator<<(log4cxx::logstream&, const ArbitraryType&) [with  
> ArbitraryType =
>    std::string]
> /usr/include/g++/bits/ostream.tcc:572: error:
>    std::basic_ostream<_CharT, _Traits>&
>    std::operator<<(std::basic_ostream<_CharT, _Traits>&, const  
> char*) [with
>    _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
> /usr/include/g++/ostream:436: error:
> std::basic_ostream<_CharT,
>    _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&,
 
> char) [with
>    _CharT = wchar_t, _Traits = std::char_traits<wchar_t>]
> ------------------------------------------------------
>
> paul.butcher->msgCount++
>
> Snetterton, Castle Combe, Cadwell Park...
> Who says I have a one track mind?
>
>



Mime
View raw message