I'm currently using several loggers in an multi-threaded application. I
overloaded the Logger class and some of it's methods, but not callAppenders, and
i'm using and extended FileAppender and a simple ConsoleAppender. 
I keep getting an Access Violation Exception in DatePatternConverter. 
When it happens i have 2 FileAppenders (for different loggers and files) in the
same Converter.

My SLogger::forcedLog just tests some more conditions than the original
forcedLog and my SFileAppender::subAppend just removes some forbidden chars from
the log message:
void SFileAppender::subAppend(const LoggingEventPtr& event, Pool& p)
{
LogString theMessage = event->getMessage();
for (LogString::iterator it = theMessage.begin(); it != theMessage.end(); it++)
{
        if (forbiddenChars.find((*it))!=LogString::npos) (*it) = ' ';
}
FileAppender::subAppend(new SpotsLoggingEvent(event->getLogger(),
        event->getLevel(), theMessage, event->getLocationInformation()),p);
}

Oh, and i'm using STL_port
>From the stack:
Thread1:
LOG4CXX! log4cxx::helpers::Transcoder::encode(class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > const &,class _STL::basic_string<unsigned short,class
_STL::char_traits<unsigned short>,class _STL::allocator<unsigned short> > &) +
257 bytes
LOG4CXX! log4cxx::helpers::StringHelper::toString(int,class
log4cxx::helpers::Pool &,class _STL::basic_string<unsigned short,class
_STL::char_traits<unsigned short>,class _STL::allocator<unsigned short> > &) +
133 bytes
LOG4CXX! NumericToken::format(class _STL::basic_string<unsigned short,class
_STL::char_traits<unsigned short>,class _STL::allocator<unsigned short> >
&,struct apr_time_exp_t const &,class log4cxx::helpers::Pool &) + 90 bytes
LOG4CXX! log4cxx::helpers::SimpleDateFormat::format(class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > &,__int64,class log4cxx::helpers::Pool &) + 202 bytes
LOG4CXX! log4cxx::pattern::CachedDateFormat::format(class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > &,__int64,class log4cxx::helpers::Pool &) + 450 bytes
LOG4CXX! log4cxx::pattern::DatePatternConverter::format(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > &,class log4cxx::helpers::Pool &) + 75 bytes
LOG4CXX! log4cxx::PatternLayout::format(class _STL::basic_string<char,class
_STL::char_traits<char>,class _STL::allocator<char> > &,class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 151 bytes
LOG4CXX! log4cxx::WriterAppender::subAppend(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 117 bytes
log4cxx::SFileAppender::subAppend(const
log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> & {...},
log4cxx::helpers::Pool & {...}) line 202 + 202 bytes
LOG4CXX! log4cxx::WriterAppender::append(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 67 bytes
LOG4CXX! log4cxx::AppenderSkeleton::doAppend(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 638 bytes
LOG4CXX! log4cxx::helpers::AppenderAttachableImpl::appendLoopOnAppenders(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 104 bytes
LOG4CXX! log4cxx::Logger::callAppenders(const
log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> & {...},
log4cxx::helpers::Pool & {...}) line 99 + 27 bytes
log4cxx::SLogger::forcedLog(const log4cxx::helpers::ObjectPtrT<log4cxx::Level> &
{...}, const
_STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> > & {...},
const int 500106, const log4cxx::spi::LocationInfo & {...}, unsigned char 1)
line 153 + 32 bytes



Thread2:
STLPORT_VC6_UNICODE.4.5! 01003660()
LOG4CXX! log4cxx::helpers::StringHelper::toString(int,class
log4cxx::helpers::Pool &,class _STL::basic_string<unsigned short,class
_STL::char_traits<unsigned short>,class _STL::allocator<unsigned short> > &) +
133 bytes
LOG4CXX! NumericToken::format(class _STL::basic_string<unsigned short,class
_STL::char_traits<unsigned short>,class _STL::allocator<unsigned short> >
&,struct apr_time_exp_t const &,class log4cxx::helpers::Pool &) + 90 bytes
LOG4CXX! log4cxx::helpers::SimpleDateFormat::format(class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > &,__int64,class log4cxx::helpers::Pool &) + 202 bytes
LOG4CXX! log4cxx::pattern::CachedDateFormat::format(class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > &,__int64,class log4cxx::helpers::Pool &) + 450 bytes
LOG4CXX! log4cxx::pattern::DatePatternConverter::format(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > &,class log4cxx::helpers::Pool &) + 75 bytes
LOG4CXX! log4cxx::PatternLayout::format(class _STL::basic_string<char,class
_STL::char_traits<char>,class _STL::allocator<char> > &,class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 151 bytes
LOG4CXX! log4cxx::WriterAppender::subAppend(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 117 bytes
log4cxx::SFileAppender::subAppend(const
log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> & {...},
log4cxx::helpers::Pool & {...}) line 202 + 202 bytes
LOG4CXX! log4cxx::WriterAppender::append(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 67 bytes
LOG4CXX! log4cxx::AppenderSkeleton::doAppend(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 638 bytes
LOG4CXX! log4cxx::helpers::AppenderAttachableImpl::appendLoopOnAppenders(class
log4cxx::helpers::ObjectPtrT<class log4cxx::spi::LoggingEvent> const &,class
log4cxx::helpers::Pool &) + 104 bytes
LOG4CXX! log4cxx::Logger::callAppenders(const
log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> & {...},
log4cxx::helpers::Pool & {...}) line 99 + 27 bytes


Any ideas? I see no problem with 2 different FileAppenders in 2 different
Loggers running simultaneously, but if there's only one Converter...

Reply via email to