Chinaunix首页 | 论坛 | 博客
  • 博客访问: 131758
  • 博文数量: 47
  • 博客积分: 1220
  • 博客等级: 中尉
  • 技术积分: 565
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-09 10:07
个人简介

unix/linux shell、c/c++、java、oracle pl/sql、db2 sql pl、informatica

文章分类

全部博文(47)

文章存档

2012年(11)

2011年(3)

2010年(8)

2009年(20)

2008年(5)

我的朋友

分类: C/C++

2011-12-08 20:20:49

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了!
 
 
阅读(4916) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

我要去鸟巢2011-12-12 23:49:16

调整级别,挺不错的!