|
From: Václav H. <wi...@us...> - 2009-08-25 16:24:35
|
Václav Haisman wrote, On 25.8.2009 18:21:
> ss ak wrote, On 25.8.2009 18:19:
>> where do i find the list of properties to set????
>> in the documentation or in the code..i could not find what properties to
>> set...
> Well, the documentation is not that good as it should be. If in doubt, look
> into the code :)
>
>>
>> how to set layout as Patternlayout???
> What part of my example is not clear?
Oh, I can see what you mean. Sorry. Try to take a look at the tests in tests
directory. There is even a patternlayout_test.
>
>>
>> log4cplus::BasicConfigurator config;config.configure();
>>
>> logger = Logger::getInstance("main");
>>
>> log4cplus::helpers::Properties props;
>>
>> props.setProperty (LOG4CPLUS_TEXT ("Append"), LOG4CPLUS_TEXT ("true"));
>>
>> props.setProperty (LOG4CPLUS_TEXT ("File"), LOG4CPLUS_TEXT ("logfile.log"));
>>
>> props.setProperty (LOG4CPLUS_TEXT ("PatternLayout"),
>>
>> LOG4CPLUS_TEXT ("%c"));
>>
>> log4cplus::Layout pattlayout = new log4cplus::PatternLayout(props);
>>
>> log4cplus::SharedAppenderPtr fileapp (new log4cplus::FileAppender (props));
>>
>> logger.addAppender(fileapp);
>>
>> logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL);
--
VH
|