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: Link error when using Layout on MS Windows
Date Tue, 09 Dec 2008 22:16:59 GMT

On Dec 9, 2008, at 2:44 PM, peter.doornbosch wrote:

> Hi,
>
>> log4cxx::LoggerPtr  
>> tmpLogger( log4cxx::Logger::getLogger("SIM.TEST") );
>> // set logger level
>> tmpLogger->setLevel( log4cxx::Level::getDebug() );
>>
>>             // set appender properties
>> ===>     log4cxx::PatternLayoutPtr layout( new  
>> log4cxx::PatternLayout( "%d %-5p [%l] [%c:%M] %m%n" ) );
>
> try this: new log4cxx::PatternLayout( L"%d %-5p [%l] [%c:%M] %m%n" )
> (yes, that is an "L" before the quotes ;-)
> or switch your project to unicode.
> => i think the problem is that the pattern is interpreted as being  
> of type char*, but the PatternLayout constructor expects unicode.
>
> hth
> peter
>

Use LOG4CXX_STR() which takes an ASCII literal and prepends the  
appropriate qualifier (L or nothing) depending on configuration.


>>     log4cxx::PatternLayoutPtr layout( new  
>> log4cxx::PatternLayout(LOG4CXX_STR( "%d %-5p [%l] [%c:%M] %m%n" )) );
>>

Anytime an argument takes a LogString or a logchar*, you should use  
LOG4CXX_STR() in the same manner you'd use _T() for TCHAR*.




Mime
View raw message