logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dale King" <dalewk...@gmail.com>
Subject Major problem with wide vs. normal strings in log messages
Date Thu, 22 May 2008 23:21:10 GMT
I'm going to file a bug on what I consider a major problem with wide
versus normal character strings and the << operator to append to the
MessageBuffer. The problem is that the first thing in your message
determines the behavior of the rest of the message. If the first thing
you output is not a wide string, then any other character strings that
are wide will be treated as just the pointer value.

Consider these statements on a platform (i.e. Windows) where WCHAR is
used with various combinations of wide and normal strings:

    LOG4CXX_TRACE( logger, L"1" << L"2" );
    LOG4CXX_TRACE( logger, "1" << L"2" );
    LOG4CXX_TRACE( logger, L"1" << "2" );
    LOG4CXX_TRACE( logger, 1 << "2" );
    LOG4CXX_TRACE( logger, 1 << L"2" );

The expected result is 5 logging events all with the message "12".
Instead I get:


Most of the << operators in the MessageBuffer class return either
CharMessageBuffer & or std::ostream &. I think all of these should
probably be returning MessageBuffer which would allow it to switch to
a WideMessageBuffer if I ever add a wide string, not just if the first
string is wide.
Dale King

View raw message