On Wed, Dec 13, 2006 at 04:39:40PM -0500, Bob Rossi wrote:
> On Wed, Dec 13, 2006 at 03:13:05PM -0500, Bob Rossi wrote:
> > On Tue, Dec 12, 2006 at 03:05:39PM -0500, Bob Rossi wrote:
> > > Hi,
> > >
> > > OK, I'm planning on using log4cxx, along with apr. Is there anything
> > > special I should consider? Can I simply have log4cxx use the libapr that
> > > I already build?
> >
> > I got it to this point,
> >
> > loglog.cpp: In static member function `static void
> > log4cxx::helpers::LogLog::emit(const std::wstring&)':
> >
> >
> > loglog.cpp:89: error: `wcerr' is not a member of `std'
> >
> > make[1]: *** [loglog.lo] Error 1
> >
> > make[1]: Leaving directory `/home/bobbybrasko/log4cxx/logging-log4cxx/src'
> >
> > make: *** [all-recursive] Error 1
> >
> >
> > This is on windows with mingw compiler, using autotools.
>
>
> Apparently, include/log4cxx/private/log4cxx_private.h has
> #define LOG4CXX_HAS_STD_WCOUT 1
> and loglog.cpp does
> #if LOG4CXX_HAS_WCHAR_T
> void LogLog::emit(const std::wstring& msg) {
> #if LOG4CXX_HAS_STD_WCOUT
> std::wcerr << L"log4cxx: " << msg << std::endl;
> #else
> LOG4CXX_ENCODE_CHAR(encoded, msg);
> std::cerr << "log4cxx: " << encoded << std::endl;
> #endif
> }
>
> If I comment out the WCOUT macro, I get,
> loglog.cpp: In static member function `static void
> log4cxx::helpers::LogLog::emit(const std::wstring&)':
>
>
> loglog.cpp:91: error: no matching function for call to
> `log4cxx::helpers::Transcoder::encode(const std::
> basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>
> >&, std::string&)'
> ../include/log4cxx/helpers/transcoder.h:63: note: candidates are: static
> void log4cxx::helpers::Transcod
> er::encode(const log4cxx::LogString&, std::string&)
>
> ../include/log4cxx/helpers/transcoder.h:81: note: static
> void log4cxx::helpers::Transcod
> er::encode(const log4cxx::LogString&, std::wstring&)
>
> make[1]: *** [loglog.lo] Error 1
>
> make[1]: Leaving directory `/home/bobbybrasko/log4cxx/logging-log4cxx/src'
>
> make: *** [all-recursive] Error 1
>
It's a combination of 3 defines that are confused during the build
process. That is,
LOG4CXX_HAS_WCHAR_T
LOG4CXX_HAS_STD_WCOUT
LOG4CXX_LOGCHAR_IS_UTF8
the configure script says,
checking for wchar_t... yes
checking logchar type... utf-8
For some reason WCOUT is true, but mingw complains about it. Does mingw
support this? The problem code is here,
#if LOG4CXX_HAS_WCHAR_T
void LogLog::emit(const std::wstring& msg) {
#if LOG4CXX_HAS_STD_WCOUT
std::wcerr << L"log4cxx: " << msg << std::endl;
#else
LOG4CXX_ENCODE_CHAR(encoded, msg);
std::cerr << "log4cxx: " << encoded << std::endl;
#endif
}
#endif
Since wcerr isn't available, I've changed LOG4CXX_HAS_WCHAR_T to not be
defined. This calls the LOG4CXX_ENCODE_CHAR macro now. However, the
encode function looks like,
static void encode(const LogString& src, std::string& dst);
and LogString is defined as a char because of logchar type shown in the
configure above. In logstring.h,
#if LOG4CXX_LOGCHAR_IS_UTF8
typedef char logchar;
typedef std::basic_string<logchar> LogString;
So, log4cxx attempts to pass a wstring into a LogString, but a LogString
is a really string.
Please advise on how to fix this, and I'll sumbit a patch. If I've messe
up the ./configure line, please let me know.
Thanks,
Bob Rossi