【发布时间】:2016-02-03 19:26:55
【问题描述】:
我在尝试启用 poco_trace 和 poco_debug 日志记录时遇到问题。我使用 Logger::setLevel() 设置 PRIO_TRACE 级别,但我仍然没有看到任何优先级低于 PRIO_INFORMATION 的内容写入我的日志。这是相关代码。
// ... In the constructor of my main class
// All Loggers in the program inherit from the Logger found here.
getLogger().setChannel( channel );
getLogger().setLevel( Poco::Message::PRIO_TRACE );
// This prints "Level is 8" to the log, 8 being Message::PRIO_TRACE.
poco_information_f1( getLogger(), "Level is %i", getLogger().getLevel() );
// This however is not printed to the log.
poco_trace( getLogger(), "Trace logging is enabled" );
// ...
// Definition of getLogger()
inline Poco::Logger& Application::getLogger() const
{
// Where logger is a class member of type Poco::Logger*
poco_check_ptr( logger );
return *logger;
}
据我查看 Poco 文档可知,这应该足够了。是否有我遗漏的步骤,或者此设置存在固有问题?
【问题讨论】:
标签: c++ poco-libraries