Commit 7101e110 authored by Nick Draper's avatar Nick Draper
Browse files

updated incorrect level messages and updated docs.

also added a new FilterChannelTest to ensure things are correct re priorities.


re #12703
parent be9dcf43
......@@ -19,15 +19,11 @@ using Mantid::TestChannel;
class FilterChannelTest : public CxxTest::TestSuite
{
public:
public:
void testContructor()
{
TS_ASSERT_THROWS_NOTHING
(
Poco::FilterChannel a;
)
}
TS_ASSERT_THROWS_NOTHING(Poco::FilterChannel a;)
}
void testContructorDefaults()
{
......@@ -127,7 +123,24 @@ public:
a.log(msg);
TS_ASSERT_EQUALS(tChannel->list().size(),1);
}
void testSimpleLogMessagesByPriority()
{
//initialise the channel
boost::shared_ptr<TestChannel> tChannel(new TestChannel);
Poco::FilterChannel a;
a.addChannel(tChannel.get());
Poco::Message msg;
a.setPriority(Poco::Message::Priority::PRIO_INFORMATION);
msg.setPriority(Poco::Message::Priority::PRIO_NOTICE);
a.log(msg);
TSM_ASSERT_EQUALS("Message of greater priority failed to get through",tChannel->list().size(),1);
msg.setPriority(Poco::Message::Priority::PRIO_INFORMATION);
a.log(msg);
TSM_ASSERT_EQUALS("Message of equal priority failed to get through",tChannel->list().size(),2);
msg.setPriority(Poco::Message::Priority::PRIO_DEBUG);
a.log(msg);
TSM_ASSERT_EQUALS("Message of lesser priority managed to get through",tChannel->list().size(),2);
}
void testLogMessagesByPriority()
{
//initialise the channel
......@@ -163,7 +176,7 @@ public:
msg.setPriority(static_cast<Poco::Message::Priority>(msgPriority));
size_t previousMessageCount = tChannel->list().size();
a.log(msg);
a.log(msg);
size_t addedMessageCount = tChannel->list().size() - previousMessageCount;
if ((channelPriority >= msgPriority)&&(addedMessageCount==1))
......
......@@ -146,7 +146,7 @@ graph1d.autodistribution = On
# logging configuration
# root level message filter (This sets a minimal level possible for any channel)
logging.loggers.root.level = notice
logging.loggers.root.level = information
# splitting the messages to many logging channels
logging.loggers.root.channel.class = SplitterChannel
......@@ -158,10 +158,10 @@ logging.channels.consoleFilterChannel.class= FilterChannel
logging.channels.consoleFilterChannel.channel= consoleChannel
logging.channels.consoleFilterChannel.level= notice
# specific filter for the file channel raising the level to notice (drop to debug for debugging)
# specific filter for the file channel raising the level to information (drop to debug for debugging)
logging.channels.fileFilterChannel.class= FilterChannel
logging.channels.fileFilterChannel.channel= fileChannel
logging.channels.fileFilterChannel.level= notice
logging.channels.fileFilterChannel.level= information
# output to the console - primarily for console based apps
logging.channels.consoleChannel.class = ConsoleChannel
......
......@@ -124,10 +124,10 @@ void export_ConfigService() {
"filename")
.def("setFileLogLevel", &ConfigServiceImpl::setFileLogLevel,
"Sets the log level priority for the File log channel, logLevel 1 = Critical, 7 = Debug")
"Sets the log level priority for the File log channel, logLevel 1 = Fatal, 6 = information, 7 = Debug")
.def("setConsoleLogLevel", &ConfigServiceImpl::setConsoleLogLevel,
"Sets the log level priority for the Console log channel, logLevel 1 = Critical, 7 = Debug")
"Sets the log level priority for the Console log channel, logLevel 1 = Fatal, 6 = information, 7 = Debug")
.def("keys", &ConfigServiceImpl::keys)
......
......@@ -102,32 +102,38 @@ that it closely emulates. There are several comments in the properties file itse
the configuration we provide by default. However there are some obvious areas that you may want
to alter and those properties are detailed below.
+----------------------------------------+---------------------------------------------------+-----------------------+
|Property |Description |Example value |
+========================================+===================================================+=======================+
|logging.loggers.root.level |Defines the lowest level of messages to be output |debug, informtion, |
| |by the system, and will override lower settings in |notice, warning, |
| |filterChannels. The default is information, but |error, critical |
| |this can be lowered to debug for more detailed |or fatal |
| |feedback. | |
| | | |
+----------------------------------------+---------------------------------------------------+-----------------------+
|logging.channels.fileFilterChannel.level|The lowest level messages to output to the log |debug, informtion, |
| |file. The default is warning, but this can be |notice, warning, |
| |lowered to debug for more detailed feedback. The |error, critical |
| |higher level of this and logging.loggers.root.level|or fatal |
| |will apply. | |
+----------------------------------------+---------------------------------------------------+-----------------------+
|logging.channels.fileChannel.path | The Path to the log file. |../logs/mantid.log |
+----------------------------------------+---------------------------------------------------+-----------------------+
+-------------------------------------------+---------------------------------------------------+-----------------------+
|Property |Description |Example value |
+===========================================+===================================================+=======================+
|logging.loggers.root.level |Defines the lowest level of messages to be output |debug, information, |
| |by the system, and will override lower settings in |notice, warning, |
| |filterChannels. The default is information, but |error, critical |
| |this can be lowered to debug for more detailed |or fatal |
| |feedback. | |
| | | |
+-------------------------------------------+---------------------------------------------------+-----------------------+
|logging.channels.fileFilterChannel.level |The lowest level messages to output to the log |debug, information, |
| |file. The default is warning, but this can be |notice, warning, |
| |lowered to debug for more detailed feedback. The |error, critical |
| |higher level of this and logging.loggers.root.level|or fatal |
| |will apply. | |
+-------------------------------------------+---------------------------------------------------+-----------------------+
|logging.channels.consoleFilterChannel.level|The lowest level messages to output to the console.|debug, information, |
| | The default is warning, but this can be |notice, warning, |
| |lowered to debug for more detailed feedback. The |error, critical |
| |higher level of this and logging.loggers.root.level|or fatal |
| |will apply. | |
+-------------------------------------------+---------------------------------------------------+-----------------------+
|logging.channels.fileChannel.path | The Path to the log file. |../logs/mantid.log |
+-------------------------------------------+---------------------------------------------------+-----------------------+
The logging priority levels for the file logging and console logging can also be adjusted in python using the commands:
.. testcode:: LoggingConfigExample
#Set the console to log at debug level on above (7=debug)
ConfigService.setConsoleLogLevel(7)
#Set the file to only log at critical level (1=critical)
ConfigService.setConsoleLogLevel(7)
#Set the file to only log at critical level (2=critical)
ConfigService.setConsoleLogLevel(2)
.. testoutput:: AddSampleLogExample
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment