【发布时间】:2016-08-16 21:53:58
【问题描述】:
我正在为我的项目使用 poco 记录器。我想要一种行为,如果进程重新启动,poco 不会创建新的日志文件。下面是我的配置:我做错了什么?我发现每次重新启动时,poco 都会覆盖日志而不是附加到以前的日志。
AutoPtr<FileChannel> pFile(new FileChannel(logfile));
pFile->setProperty("rotateOnOpen","true");
pFile->setProperty("rotation","1 M");
pFile->setProperty("archive", "timestamp");
pFile->setProperty("compress", "true");
pFile->setProperty("purgeAge", "1 months");
AutoPtr<Formatter> pformatter(new PatternFormatter("%d-%m-%Y %H:%M:%S %s: %t"));
pformatter->setProperty("times","local");
AutoPtr<Channel> pformattingchannel(new FormattingChannel(pformatter,pFile));
Logger::root().setChannel(pformattingchannel);
Logger::root().setLevel(Poco::Message::PRIO_INFORMATION);
【问题讨论】: