poco c++ 日志级别设置
问题:因之前日志(taskrunner.properties)级别为debug,会输出很多程序运行的细节信息日志,占用了很多系统资源,于是一同事将debug改成info,这一改导致所有相关程序都调不起来!
检查:
1、Logger.cpp 程序,片断
void Logger::setLevel(const std::string& level)
{
if (level == "fatal")
setLevel(Message::PRIO_FATAL);
else if (level == "critical")
setLevel(Message::PRIO_CRITICAL);
else if (level == "error")
setLevel(Message::PRIO_ERROR);
else if (level == "warning")
setLevel(Message::PRIO_WARNING);
else if (level == "notice")
setLevel(Message::PRIO_NOTICE);
else if (level == "information")
setLevel(Message::PRIO_INFORMATION);
else if (level == "debug")
setLevel(Message::PRIO_DEBUG);
else if (level == "trace")
setLevel(Message::PRIO_TRACE);
else
throw InvalidArgumentException("Not a valid log level", level);
}
2、Message.h 程序,片断
enum Priority
{
PRIO_FATAL = 1, /// A fatal error. The application will most likely terminate. This is the highest priority.
PRIO_CRITICAL, /// A critical error. The application might not be able to continue running successfully.
PRIO_ERROR, /// An error. An operation did not complete successfully, but the application as a whole is not affected.
PRIO_WARNING, /// A warning. An operation completed with an unexpected result.
PRIO_NOTICE, /// A notice, which is an information with just a higher priority.
PRIO_INFORMATION, /// An informational message, usually denoting the successful completion of an operation.
PRIO_DEBUG, /// A debugging message.
PRIO_TRACE /// A tracing message. This is the lowest priority.
};
处理:将属性配置文件(taskrunner.properties) 相应语句设置如下:
logging.loggers.app.level =information
重调相关程序,都OK了!
阅读(5072) | 评论(1) | 转发(1) |