File: Poco.Util.LoggingConfigurator.html

package info (click to toggle)
poco-doc 1.3.6-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 10,076 kB
  • ctags: 9,611
  • sloc: makefile: 31
file content (87 lines) | stat: -rw-r--r-- 7,180 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::Util::LoggingConfigurator</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.Util.html" class="namespace">Poco::Util</a></h1>
<h1 class="symbol">class LoggingConfigurator</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Util<br />
<b>Package:</b> Configuration<br />
<b>Header:</b> Poco/Util/LoggingConfigurator.h</p>
<h2>Description</h2>
<div class="description">
<p>This utility class uses a configuration object to configure the logging subsystem of an application. </p>
<p>The <a href="Poco.Util.LoggingConfigurator.html" title="class Poco::Util::LoggingConfigurator">LoggingConfigurator</a> sets up and connects formatters, channels  and loggers. To accomplish its work, the <a href="Poco.Util.LoggingConfigurator.html" title="class Poco::Util::LoggingConfigurator">LoggingConfigurator</a> relies on the functionality provided by the <a href="Poco.LoggingFactory.html" title="class Poco::LoggingFactory">LoggingFactory</a> und <a href="Poco.LoggingRegistry.html" title="class Poco::LoggingRegistry">LoggingRegistry</a> classes. </p>
<p>The <a href="Poco.Util.LoggingConfigurator.html" title="class Poco::Util::LoggingConfigurator">LoggingConfigurator</a> expects all configuration data to be under a root property named &quot;logging&quot;. </p>
<p>Configuring Formatters </p>
<p>A formatter is configured using the &quot;logging.formatters&quot; property. Every  formatter has an internal name, which is only used for referring to it  during configuration time. This name becomes part of the property name. Every formatter has a mandatory &quot;class&quot; property, which specifies the actual class implementing the formatter. <a href="Poco.Any.html" title="class Poco::Any">Any</a> other properties are passed on to the formatter by calling its setProperty() method. </p>
<p>A typical formatter definition looks as follows: </p>
<pre>logging.formatters.f1.class = PatternFormatter
logging.formatters.f1.pattern = %s: [%p] %t
logging.formatters.f1.times = UTC
</pre>
<p>Configuring Channels </p>
<p>A channel is configured using the &quot;logging.channels&quot; property. Like with Formatters, every channel has an internal name, which is used during configuration only. The name becomes part of the property name. Every channel has a mandatory &quot;class&quot; property, which specifies the actual class implementing the channel. <a href="Poco.Any.html" title="class Poco::Any">Any</a> other properties are passed on to the formatter by calling its setProperty() method. </p>
<p>For convenience, the &quot;formatter&quot; property of a channel is treated specifically. The &quot;formatter&quot; property can either be used to refer to an already defined formatter, or it can be used to specify an &quot;inline&quot; formatter definition. In either case, when a &quot;formatter&quot; property is present, the channel is automatically &quot;wrapped&quot; in a <a href="Poco.FormattingChannel.html" title="class Poco::FormattingChannel">FormattingChannel</a> object. </p>
<p>Similarly, a channel supports also a &quot;pattern&quot; property, which results in the automatic instantiation of a <a href="Poco.FormattingChannel.html" title="class Poco::FormattingChannel">FormattingChannel</a> object with a connected <a href="Poco.PatternFormatter.html" title="class Poco::PatternFormatter">PatternFormatter</a>. </p>
<p>Examples: </p>
<pre>logging.channels.c1.class = ConsoleChannel
logging.channels.c1.formatter = f1
logging.channels.c2.class = FileChannel
logging.channels.c2.path = ${system.tempDir}/sample.log
logging.channels.c2.formatter.class = PatternFormatter
logging.channels.c2.formatter.pattern = %s: [%p] %t
logging.channels.c3.class = ConsoleChannel
logging.channels.c3.pattern = %s: [%p] %t
</pre>
<p>Configuring Loggers </p>
<p>A logger is configured using the &quot;logging.loggers&quot; property. Like with channels and formatters, every logger has an internal name, which, however, is only used to ensure the uniqueness of the property names. Note that this name is different from the logger's full name, which is used to access the logger at runtime. Every logger except the root logger has a mandatory &quot;name&quot; property which is used to specify the logger's full name. Furthermore, a &quot;channel&quot; property is supported, which can either refer to a named channel, or which can contain an inline channel definition. </p>
<p>Examples: </p>
<pre>logging.loggers.root.channel = c1
logging.loggers.root.level = warning
logging.loggers.l1.name = logger1
logging.loggers.l1.channel.class = ConsoleChannel
logging.loggers.l1.channel.pattern = %s: [%p] %t
logging.loggers.l1.level = information
</pre>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Util.LoggingConfigurator.html#16735" title="Poco::Util::LoggingConfigurator::configure()">configure</a></p>
<h2>Constructors</h2>
<h3><a name="16733">LoggingConfigurator</a></h3>
<p class="decl"><a href="Poco.Util.LoggingConfigurator.html" title="class Poco::Util::LoggingConfigurator">LoggingConfigurator</a>();</p>
<div class="description">
<p>Creates the <a href="Poco.Util.LoggingConfigurator.html" title="class Poco::Util::LoggingConfigurator">LoggingConfigurator</a>. </p>
</div>
<h2>Destructor</h2>
<h3><a name="16734">~LoggingConfigurator</a></h3>
<p class="decl">~<a href="Poco.Util.LoggingConfigurator.html" title="class Poco::Util::LoggingConfigurator">LoggingConfigurator</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.Util.LoggingConfigurator.html" title="class Poco::Util::LoggingConfigurator">LoggingConfigurator</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="16735">configure</a></h3>
<p class="decl">void configure(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Util.AbstractConfiguration.html" title="class Poco::Util::AbstractConfiguration">AbstractConfiguration</a> * pConfig<br />);</p>
<div class="description">
<p>Configures the logging subsystem based on the given configuration. </p>
<p>A <a href="Poco.Util.ConfigurationView.html" title="class Poco::Util::ConfigurationView">ConfigurationView</a> can be used to pass only a part of a larger configuration. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>