-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Setting the priorityNames property has no effect on the log output. For example:
AutoPtr<ConsoleChannel> cChannel(new ConsoleChannel);
AutoPtr<PatternFormatter> pPF(new PatternFormatter);
pPF->setProperty("priorityNames", "FATAL,CRITICAL,ERROR,WARN,NOTICE,INFO,DEBUG,TRACE");
pPF->setProperty("pattern", "%Y-%m-%dT%H:%M:%S.%iZ:%I:%p: %s: %t");
AutoPtr<FormattingChannel> pFC(new FormattingChannel(pPF, cChannel));
Logger::root().setChannel(pFC);
Logger& logger = Logger::get("TestLogger");
for (int i = 0; i < 10; ++i) logger.information("Test");
The log output still contains "Information" as the priority vs "INFO".
I looked at the code and can see why - when setting priorityNames, the string is parsed (parsePriorityNames). That routine initializes an array correctly (_priorities) , but that array is never referenced by getPropertyName(), which uses the array priorities (no underscore).
Just change line 274 in PatternFormatter.cpp to:
return _priorities[prio];
Reactions are currently unavailable