- Code: Select all
//1、create file channel
Poco::AutoPtr<Poco::FileChannel> fileChannel(new Poco::FileChannel);
fileChannel->setProperty("path", "OSIP.log");
fileChannel->setProperty("rotation", "1024K");
fileChannel->setProperty("compress", "true");
//2、create pattern format
Poco::AutoPtr<Poco::PatternFormatter> patternFormatter(new Poco::PatternFormatter);
patternFormatter->setProperty("times", "local");
patternFormatter->setProperty("pattern", "[%Y-%m-%d %H:%M:%S.%i %s:%u %p]-%t");
//3、create format channel
AutoPtr<FormattingChannel> formatChannel(new FormattingChannel(patternFormatter, fileChannel));
logger.setChannel(formatChannel);
I use the log like this:
- Code: Select all
logger.information("Admin thread running......");
and the log file print like this:
[2012-09-27 15:51:42.202 Admin.cpp:0 Information]-Admin thread running......
I use the "%u" want to print the line number,but it not effect,can anyone help me???





