log4r 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +3 -3
- data/Rakefile +2 -2
- data/doc/rdoc/Log4r.html +519 -0
- data/doc/rdoc/Log4r/BasicFormatter.html +388 -0
- data/doc/rdoc/Log4r/ConfigError.html +225 -0
- data/doc/rdoc/Log4r/Configurator.html +1068 -0
- data/doc/rdoc/Log4r/DateFileOutputter.html +479 -0
- data/doc/rdoc/Log4r/DefaultFormatter.html +223 -0
- data/doc/rdoc/Log4r/EmailOutputter.html +654 -0
- data/doc/rdoc/Log4r/FileOutputter.html +346 -0
- data/doc/rdoc/Log4r/Formatter.html +309 -0
- data/doc/rdoc/Log4r/GDC.html +346 -0
- data/doc/rdoc/Log4r/GDC_rb.html +80 -0
- data/doc/rdoc/Log4r/IOOutputter.html +410 -0
- data/doc/rdoc/Log4r/Log4jXmlFormatter.html +337 -0
- data/doc/rdoc/Log4r/Log4rConfig.html +211 -0
- data/doc/rdoc/Log4r/Log4rTools.html +388 -0
- data/doc/rdoc/Log4r/LogEvent.html +378 -0
- data/doc/rdoc/Log4r/LogServer.html +340 -0
- data/doc/rdoc/Log4r/Logger.html +1150 -0
- data/doc/rdoc/Log4r/Logger/LoggerFactory.html +218 -0
- data/doc/rdoc/Log4r/Logger/Repository.html +225 -0
- data/doc/rdoc/Log4r/MDC.html +424 -0
- data/doc/rdoc/Log4r/MDC_rb.html +83 -0
- data/doc/rdoc/Log4r/NDC.html +632 -0
- data/doc/rdoc/Log4r/NDC_rb.html +110 -0
- data/doc/rdoc/Log4r/ObjectFormatter.html +280 -0
- data/doc/rdoc/Log4r/Outputter.html +934 -0
- data/doc/rdoc/Log4r/Outputter/OutputterFactory.html +218 -0
- data/doc/rdoc/Log4r/Outputter/consoleoutputters_rb.html +57 -0
- data/doc/rdoc/Log4r/Outputter/datefileoutputter_rb.html +93 -0
- data/doc/rdoc/Log4r/Outputter/emailoutputter_rb.html +179 -0
- data/doc/rdoc/Log4r/Outputter/fileoutputter_rb.html +64 -0
- data/doc/rdoc/Log4r/Outputter/iooutputter_rb.html +59 -0
- data/doc/rdoc/Log4r/Outputter/outputter_rb.html +222 -0
- data/doc/rdoc/Log4r/Outputter/outputterfactory_rb.html +62 -0
- data/doc/rdoc/Log4r/Outputter/remoteoutputter_rb.html +59 -0
- data/doc/rdoc/Log4r/Outputter/rollingfileoutputter_rb.html +66 -0
- data/doc/rdoc/Log4r/Outputter/staticoutputter_rb.html +55 -0
- data/doc/rdoc/Log4r/Outputter/syslogoutputter_rb.html +110 -0
- data/doc/rdoc/Log4r/Outputter/udpoutputter_rb.html +220 -0
- data/doc/rdoc/Log4r/PatternFormatter.html +404 -0
- data/doc/rdoc/Log4r/ROMPClient.html +211 -0
- data/doc/rdoc/Log4r/ROMPServer.html +211 -0
- data/doc/rdoc/Log4r/RemoteOutputter.html +402 -0
- data/doc/rdoc/Log4r/RollingFileOutputter.html +551 -0
- data/doc/rdoc/Log4r/RootLogger.html +530 -0
- data/doc/rdoc/Log4r/SimpleFormatter.html +276 -0
- data/doc/rdoc/Log4r/StderrOutputter.html +268 -0
- data/doc/rdoc/Log4r/StdoutOutputter.html +268 -0
- data/doc/rdoc/Log4r/SyslogOutputter.html +551 -0
- data/doc/rdoc/Log4r/UDPOutputter.html +379 -0
- data/doc/rdoc/Log4r/YamlConfigurator.html +966 -0
- data/doc/rdoc/Log4r/base_rb.html +57 -0
- data/doc/rdoc/Log4r/config_rb.html +122 -0
- data/doc/rdoc/Log4r/configurator_rb.html +370 -0
- data/doc/rdoc/Log4r/formatter/formatter_rb.html +121 -0
- data/doc/rdoc/Log4r/formatter/log4jxmlformatter_rb.html +64 -0
- data/doc/rdoc/Log4r/formatter/patternformatter_rb.html +239 -0
- data/doc/rdoc/Log4r/lib/drbloader_rb.html +57 -0
- data/doc/rdoc/Log4r/lib/xmlloader_rb.html +57 -0
- data/doc/rdoc/Log4r/logevent_rb.html +55 -0
- data/doc/rdoc/Log4r/logger_rb.html +293 -0
- data/doc/rdoc/Log4r/loggerfactory_rb.html +66 -0
- data/doc/rdoc/Log4r/logserver_rb.html +161 -0
- data/doc/rdoc/Log4r/rdoc/GDC.html +175 -0
- data/doc/rdoc/Log4r/rdoc/MDC.html +178 -0
- data/doc/rdoc/Log4r/rdoc/NDC.html +207 -0
- data/doc/rdoc/Log4r/rdoc/configurator.html +462 -0
- data/doc/rdoc/Log4r/rdoc/emailoutputter.html +279 -0
- data/doc/rdoc/Log4r/rdoc/formatter.html +218 -0
- data/doc/rdoc/Log4r/rdoc/log4r.html +286 -0
- data/doc/rdoc/Log4r/rdoc/logger.html +382 -0
- data/doc/rdoc/Log4r/rdoc/logserver.html +265 -0
- data/doc/rdoc/Log4r/rdoc/outputter.html +313 -0
- data/doc/rdoc/Log4r/rdoc/patternformatter.html +331 -0
- data/doc/rdoc/Log4r/rdoc/syslogoutputter.html +197 -0
- data/doc/rdoc/Log4r/rdoc/win32eventoutputter.html +165 -0
- data/doc/rdoc/Log4r/rdoc/yamlconfigurator.html +187 -0
- data/doc/rdoc/Log4r/repository_rb.html +74 -0
- data/doc/rdoc/Log4r/staticlogger_rb.html +55 -0
- data/doc/rdoc/Log4r/yamlconfigurator_rb.html +95 -0
- data/doc/rdoc/REXML.html +211 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/images/brick.png +0 -0
- data/doc/rdoc/images/brick_link.png +0 -0
- data/doc/rdoc/images/bug.png +0 -0
- data/doc/rdoc/images/bullet_black.png +0 -0
- data/doc/rdoc/images/bullet_toggle_minus.png +0 -0
- data/doc/rdoc/images/bullet_toggle_plus.png +0 -0
- data/doc/rdoc/images/date.png +0 -0
- data/doc/rdoc/images/find.png +0 -0
- data/doc/rdoc/images/loadingAnimation.gif +0 -0
- data/doc/rdoc/images/macFFBgHack.png +0 -0
- data/doc/rdoc/images/package.png +0 -0
- data/doc/rdoc/images/page_green.png +0 -0
- data/doc/rdoc/images/page_white_text.png +0 -0
- data/doc/rdoc/images/page_white_width.png +0 -0
- data/doc/rdoc/images/plugin.png +0 -0
- data/doc/rdoc/images/ruby.png +0 -0
- data/doc/rdoc/images/tag_green.png +0 -0
- data/doc/rdoc/images/wrench.png +0 -0
- data/doc/rdoc/images/wrench_orange.png +0 -0
- data/doc/rdoc/images/zoom.png +0 -0
- data/doc/rdoc/index.html +585 -0
- data/doc/rdoc/js/darkfish.js +116 -0
- data/doc/rdoc/js/jquery.js +32 -0
- data/doc/rdoc/js/quicksearch.js +114 -0
- data/doc/rdoc/js/thickbox-compressed.js +10 -0
- data/doc/rdoc/log4r-rdoc.css +696 -0
- data/doc/rdoc/log4r_rb.html +207 -0
- data/doc/rdoc/rdoc.css +696 -0
- data/examples/rdoc-gen +2 -0
- data/src/log4r.rb +2 -2
- data/src/log4r/formatter/patternformatter.rb +15 -15
- data/src/log4r/outputter/udpoutputter.rb +4 -4
- data/tests/testchainsaw.rb +1 -1
- metadata +123 -8
- data/src/log4r/outputter/datefileoutputter.patch +0 -24
- data/src/log4r/outputter/diff +0 -14
- data/src/log4r/outputter/new-datefileoutputter.rb +0 -117
@@ -0,0 +1,279 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
8
|
+
|
9
|
+
<title>File: emailoutputter [1.1.7 Log4r API]</title>
|
10
|
+
|
11
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet" />
|
12
|
+
|
13
|
+
<script src="../../js/jquery.js" type="text/javascript"
|
14
|
+
charset="utf-8"></script>
|
15
|
+
<script src="../../js/thickbox-compressed.js" type="text/javascript"
|
16
|
+
charset="utf-8"></script>
|
17
|
+
<script src="../../js/quicksearch.js" type="text/javascript"
|
18
|
+
charset="utf-8"></script>
|
19
|
+
<script src="../../js/darkfish.js" type="text/javascript"
|
20
|
+
charset="utf-8"></script>
|
21
|
+
</head>
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="project-metadata">
|
26
|
+
|
27
|
+
|
28
|
+
<div id="fileindex-section" class="section project-section">
|
29
|
+
<h3 class="section-header">Files</h3>
|
30
|
+
<ul>
|
31
|
+
|
32
|
+
<li class="file"><a href="../../log4r/rdoc/GDC.html">GDC</a></li>
|
33
|
+
|
34
|
+
<li class="file"><a href="../../log4r/rdoc/MDC.html">MDC</a></li>
|
35
|
+
|
36
|
+
<li class="file"><a href="../../log4r/rdoc/NDC.html">NDC</a></li>
|
37
|
+
|
38
|
+
<li class="file"><a href="../../log4r/rdoc/configurator.html">configurator</a></li>
|
39
|
+
|
40
|
+
<li class="file"><a href="../../log4r/rdoc/emailoutputter.html">emailoutputter</a></li>
|
41
|
+
|
42
|
+
<li class="file"><a href="../../log4r/rdoc/formatter.html">formatter</a></li>
|
43
|
+
|
44
|
+
<li class="file"><a href="../../log4r/rdoc/log4r.html">log4r</a></li>
|
45
|
+
|
46
|
+
<li class="file"><a href="../../log4r/rdoc/logger.html">logger</a></li>
|
47
|
+
|
48
|
+
<li class="file"><a href="../../log4r/rdoc/logserver.html">logserver</a></li>
|
49
|
+
|
50
|
+
<li class="file"><a href="../../log4r/rdoc/outputter.html">outputter</a></li>
|
51
|
+
|
52
|
+
<li class="file"><a href="../../log4r/rdoc/patternformatter.html">patternformatter</a></li>
|
53
|
+
|
54
|
+
<li class="file"><a href="../../log4r/rdoc/syslogoutputter.html">syslogoutputter</a></li>
|
55
|
+
|
56
|
+
<li class="file"><a href="../../log4r/rdoc/win32eventoutputter.html">win32eventoutputter</a></li>
|
57
|
+
|
58
|
+
<li class="file"><a href="../../log4r/rdoc/yamlconfigurator.html">yamlconfigurator</a></li>
|
59
|
+
|
60
|
+
</ul>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
|
64
|
+
<div id="classindex-section" class="section project-section">
|
65
|
+
<h3 class="section-header">Class Index
|
66
|
+
<span class="search-toggle"><img src="../../images/find.png"
|
67
|
+
height="16" width="16" alt="[+]"
|
68
|
+
title="show/hide quicksearch" /></span></h3>
|
69
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
70
|
+
<fieldset>
|
71
|
+
<legend>Quicksearch</legend>
|
72
|
+
<input type="text" name="quicksearch" value=""
|
73
|
+
class="quicksearch-field" />
|
74
|
+
</fieldset>
|
75
|
+
</form>
|
76
|
+
|
77
|
+
<ul class="link-list">
|
78
|
+
|
79
|
+
<li><a href="../../Log4r.html">Log4r</a></li>
|
80
|
+
|
81
|
+
<li><a href="../../Log4r/BasicFormatter.html">Log4r::BasicFormatter</a></li>
|
82
|
+
|
83
|
+
<li><a href="../../Log4r/ConfigError.html">Log4r::ConfigError</a></li>
|
84
|
+
|
85
|
+
<li><a href="../../Log4r/Configurator.html">Log4r::Configurator</a></li>
|
86
|
+
|
87
|
+
<li><a href="../../Log4r/DateFileOutputter.html">Log4r::DateFileOutputter</a></li>
|
88
|
+
|
89
|
+
<li><a href="../../Log4r/DefaultFormatter.html">Log4r::DefaultFormatter</a></li>
|
90
|
+
|
91
|
+
<li><a href="../../Log4r/EmailOutputter.html">Log4r::EmailOutputter</a></li>
|
92
|
+
|
93
|
+
<li><a href="../../Log4r/FileOutputter.html">Log4r::FileOutputter</a></li>
|
94
|
+
|
95
|
+
<li><a href="../../Log4r/Formatter.html">Log4r::Formatter</a></li>
|
96
|
+
|
97
|
+
<li><a href="../../Log4r/GDC.html">Log4r::GDC</a></li>
|
98
|
+
|
99
|
+
<li><a href="../../Log4r/IOOutputter.html">Log4r::IOOutputter</a></li>
|
100
|
+
|
101
|
+
<li><a href="../../Log4r/Log4jXmlFormatter.html">Log4r::Log4jXmlFormatter</a></li>
|
102
|
+
|
103
|
+
<li><a href="../../Log4r/Log4rTools.html">Log4r::Log4rTools</a></li>
|
104
|
+
|
105
|
+
<li><a href="../../Log4r/LogEvent.html">Log4r::LogEvent</a></li>
|
106
|
+
|
107
|
+
<li><a href="../../Log4r/LogServer.html">Log4r::LogServer</a></li>
|
108
|
+
|
109
|
+
<li><a href="../../Log4r/Logger.html">Log4r::Logger</a></li>
|
110
|
+
|
111
|
+
<li><a href="../../Log4r/MDC.html">Log4r::MDC</a></li>
|
112
|
+
|
113
|
+
<li><a href="../../Log4r/NDC.html">Log4r::NDC</a></li>
|
114
|
+
|
115
|
+
<li><a href="../../Log4r/ObjectFormatter.html">Log4r::ObjectFormatter</a></li>
|
116
|
+
|
117
|
+
<li><a href="../../Log4r/Outputter.html">Log4r::Outputter</a></li>
|
118
|
+
|
119
|
+
<li><a href="../../Log4r/PatternFormatter.html">Log4r::PatternFormatter</a></li>
|
120
|
+
|
121
|
+
<li><a href="../../Log4r/RemoteOutputter.html">Log4r::RemoteOutputter</a></li>
|
122
|
+
|
123
|
+
<li><a href="../../Log4r/RollingFileOutputter.html">Log4r::RollingFileOutputter</a></li>
|
124
|
+
|
125
|
+
<li><a href="../../Log4r/RootLogger.html">Log4r::RootLogger</a></li>
|
126
|
+
|
127
|
+
<li><a href="../../Log4r/SimpleFormatter.html">Log4r::SimpleFormatter</a></li>
|
128
|
+
|
129
|
+
<li><a href="../../Log4r/StderrOutputter.html">Log4r::StderrOutputter</a></li>
|
130
|
+
|
131
|
+
<li><a href="../../Log4r/StdoutOutputter.html">Log4r::StdoutOutputter</a></li>
|
132
|
+
|
133
|
+
<li><a href="../../Log4r/SyslogOutputter.html">Log4r::SyslogOutputter</a></li>
|
134
|
+
|
135
|
+
<li><a href="../../Log4r/UDPOutputter.html">Log4r::UDPOutputter</a></li>
|
136
|
+
|
137
|
+
<li><a href="../../Log4r/YamlConfigurator.html">Log4r::YamlConfigurator</a></li>
|
138
|
+
|
139
|
+
</ul>
|
140
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div id="documentation">
|
148
|
+
<h1>EmailOutputter</h1>
|
149
|
+
<p>
|
150
|
+
This is an experimental class that sends a number of formatted log events
|
151
|
+
as an RFC 822 email. It should work fine if Net:SMTP doesn’t cause
|
152
|
+
any problems. Just in case, create a logger named ‘log4r’ and
|
153
|
+
give it an outputter to see the logging statements made by this class. If
|
154
|
+
it fails to send email, it will set itself to OFF and stop logging.
|
155
|
+
</p>
|
156
|
+
<p>
|
157
|
+
In order to use it,
|
158
|
+
</p>
|
159
|
+
<pre>
|
160
|
+
require 'log4r/outputter/emailoutputter'
|
161
|
+
</pre>
|
162
|
+
<h2>SMTP Configuration</h2>
|
163
|
+
<p>
|
164
|
+
All arguments to Net::SMTP.start are supported. Pass them as hash
|
165
|
+
parameters to <tt>new</tt>. The to field is specified as a comma-delimited
|
166
|
+
list of emails (padded with s* if desired).
|
167
|
+
</p>
|
168
|
+
<p>
|
169
|
+
An example:
|
170
|
+
</p>
|
171
|
+
<pre>
|
172
|
+
email_out = EmailOutputter.new 'email_out',
|
173
|
+
:server=>'localhost',
|
174
|
+
:port=>25,
|
175
|
+
:domain=>'somewhere.com',
|
176
|
+
:from=>'me@foo.bar',
|
177
|
+
:to=>'them@foo.bar, me@foo.bar, bozo@clown.net',
|
178
|
+
:subject=>'Log Report'
|
179
|
+
</pre>
|
180
|
+
<h2>LogEvent Buffer</h2>
|
181
|
+
<p>
|
182
|
+
EmailOutputter stores log messages in a buffer. When the buffer reaches a
|
183
|
+
certain number, the <tt>buffsize</tt>, it will send an email containing the
|
184
|
+
contents of the buffer. The default <tt>buffsize</tt> is 100. To set
|
185
|
+
<tt>buffsize</tt>,
|
186
|
+
</p>
|
187
|
+
<pre>
|
188
|
+
email_out.buffsize = 1000 # set the buffsize to 1000
|
189
|
+
</pre>
|
190
|
+
<h2>Flush To Send Email</h2>
|
191
|
+
<p>
|
192
|
+
Flushing an EmailOutputter will mail out all the remaining LogEvents. This
|
193
|
+
is convenient for systems that encapsulate the shutdown process. It’s
|
194
|
+
a good idea to do this for all outputters,
|
195
|
+
</p>
|
196
|
+
<pre>
|
197
|
+
Outputter.each_outputter {|o| o.flush}
|
198
|
+
</pre>
|
199
|
+
<p>
|
200
|
+
Alternatively, one can invoke flush on the outputter directly,
|
201
|
+
</p>
|
202
|
+
<pre>
|
203
|
+
email_out.flush
|
204
|
+
</pre>
|
205
|
+
<p>
|
206
|
+
It’s also a good idea to notify the recepient of the email that the
|
207
|
+
system is shutting down. Before flushing, log a message to the owner of
|
208
|
+
this outputter,
|
209
|
+
</p>
|
210
|
+
<pre>
|
211
|
+
log_with_email_out.info "The system is shutting down at #{Time.now}"
|
212
|
+
</pre>
|
213
|
+
<h2>Format When?</h2>
|
214
|
+
<p>
|
215
|
+
LogEvents may either be formatted as they come in or as the email is being
|
216
|
+
composed. To do the former, specify a value of <tt>true</tt> to the hash
|
217
|
+
parameter <tt>formatfirst</tt>. The default is to format during email
|
218
|
+
composition.
|
219
|
+
</p>
|
220
|
+
<pre>
|
221
|
+
email_out.formatfirst = true # format as soon as LogEvents are received
|
222
|
+
</pre>
|
223
|
+
<h2>Immediate Notification</h2>
|
224
|
+
<p>
|
225
|
+
EmailOutputter can be configured to flush and send the email whenever the
|
226
|
+
logger sees a certain log priority. Use the <tt>immediate_at</tt> hash
|
227
|
+
parameter and specify the levels as a comma-delimited list (like an XML
|
228
|
+
element). To trigger an email on FATAL and ERROR,
|
229
|
+
</p>
|
230
|
+
<pre>
|
231
|
+
email_out.immediate_at = "FATAL, ERROR"
|
232
|
+
</pre>
|
233
|
+
<h2>Example</h2>
|
234
|
+
<p>
|
235
|
+
A security logger sends email to several folks, buffering up to 25 log
|
236
|
+
events and sending immediates on CRIT and WARN
|
237
|
+
</p>
|
238
|
+
<pre>
|
239
|
+
EmailOutputter.new 'security',
|
240
|
+
:to => 'bob@secure.net, frank@secure.net',
|
241
|
+
:buffsize => 25,
|
242
|
+
:immediate_at => 'WARN, CRIT'
|
243
|
+
</pre>
|
244
|
+
<h2>XML Configuration</h2>
|
245
|
+
<p>
|
246
|
+
See <a href="../configurator_rb.html">log4r/configurator.rb</a> for
|
247
|
+
details. Here’s an example:
|
248
|
+
</p>
|
249
|
+
<pre>
|
250
|
+
<outputter name="security" type="EmailOutputter"
|
251
|
+
buffsize="25" level="ALL">
|
252
|
+
<immediate_at>WARN, CRIT</immediate_at>
|
253
|
+
<server>localhost</server>
|
254
|
+
<from>me@secure.net</from>
|
255
|
+
<to>
|
256
|
+
bob@secure.net, frank@secure.net
|
257
|
+
</to>
|
258
|
+
...
|
259
|
+
</outputter>
|
260
|
+
</pre>
|
261
|
+
<h2>To Do</h2>
|
262
|
+
<p>
|
263
|
+
This class could use some sophistication, in particular a means to compress
|
264
|
+
the logs, a way to set the subject dynamically (probably via a block
|
265
|
+
method), and a time trigger. When the time trigger is introduced, a
|
266
|
+
<tt>buffsize</tt> of 0 should mean ignore <tt>buffsize</tt> to determine
|
267
|
+
when to send the email.
|
268
|
+
</p>
|
269
|
+
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<div id="validator-badges">
|
273
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
274
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
275
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
276
|
+
</div>
|
277
|
+
</body>
|
278
|
+
</html>
|
279
|
+
|
@@ -0,0 +1,218 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
8
|
+
|
9
|
+
<title>File: formatter [1.1.7 Log4r API]</title>
|
10
|
+
|
11
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet" />
|
12
|
+
|
13
|
+
<script src="../../js/jquery.js" type="text/javascript"
|
14
|
+
charset="utf-8"></script>
|
15
|
+
<script src="../../js/thickbox-compressed.js" type="text/javascript"
|
16
|
+
charset="utf-8"></script>
|
17
|
+
<script src="../../js/quicksearch.js" type="text/javascript"
|
18
|
+
charset="utf-8"></script>
|
19
|
+
<script src="../../js/darkfish.js" type="text/javascript"
|
20
|
+
charset="utf-8"></script>
|
21
|
+
</head>
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="project-metadata">
|
26
|
+
|
27
|
+
|
28
|
+
<div id="fileindex-section" class="section project-section">
|
29
|
+
<h3 class="section-header">Files</h3>
|
30
|
+
<ul>
|
31
|
+
|
32
|
+
<li class="file"><a href="../../log4r/rdoc/GDC.html">GDC</a></li>
|
33
|
+
|
34
|
+
<li class="file"><a href="../../log4r/rdoc/MDC.html">MDC</a></li>
|
35
|
+
|
36
|
+
<li class="file"><a href="../../log4r/rdoc/NDC.html">NDC</a></li>
|
37
|
+
|
38
|
+
<li class="file"><a href="../../log4r/rdoc/configurator.html">configurator</a></li>
|
39
|
+
|
40
|
+
<li class="file"><a href="../../log4r/rdoc/emailoutputter.html">emailoutputter</a></li>
|
41
|
+
|
42
|
+
<li class="file"><a href="../../log4r/rdoc/formatter.html">formatter</a></li>
|
43
|
+
|
44
|
+
<li class="file"><a href="../../log4r/rdoc/log4r.html">log4r</a></li>
|
45
|
+
|
46
|
+
<li class="file"><a href="../../log4r/rdoc/logger.html">logger</a></li>
|
47
|
+
|
48
|
+
<li class="file"><a href="../../log4r/rdoc/logserver.html">logserver</a></li>
|
49
|
+
|
50
|
+
<li class="file"><a href="../../log4r/rdoc/outputter.html">outputter</a></li>
|
51
|
+
|
52
|
+
<li class="file"><a href="../../log4r/rdoc/patternformatter.html">patternformatter</a></li>
|
53
|
+
|
54
|
+
<li class="file"><a href="../../log4r/rdoc/syslogoutputter.html">syslogoutputter</a></li>
|
55
|
+
|
56
|
+
<li class="file"><a href="../../log4r/rdoc/win32eventoutputter.html">win32eventoutputter</a></li>
|
57
|
+
|
58
|
+
<li class="file"><a href="../../log4r/rdoc/yamlconfigurator.html">yamlconfigurator</a></li>
|
59
|
+
|
60
|
+
</ul>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
|
64
|
+
<div id="classindex-section" class="section project-section">
|
65
|
+
<h3 class="section-header">Class Index
|
66
|
+
<span class="search-toggle"><img src="../../images/find.png"
|
67
|
+
height="16" width="16" alt="[+]"
|
68
|
+
title="show/hide quicksearch" /></span></h3>
|
69
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
70
|
+
<fieldset>
|
71
|
+
<legend>Quicksearch</legend>
|
72
|
+
<input type="text" name="quicksearch" value=""
|
73
|
+
class="quicksearch-field" />
|
74
|
+
</fieldset>
|
75
|
+
</form>
|
76
|
+
|
77
|
+
<ul class="link-list">
|
78
|
+
|
79
|
+
<li><a href="../../Log4r.html">Log4r</a></li>
|
80
|
+
|
81
|
+
<li><a href="../../Log4r/BasicFormatter.html">Log4r::BasicFormatter</a></li>
|
82
|
+
|
83
|
+
<li><a href="../../Log4r/ConfigError.html">Log4r::ConfigError</a></li>
|
84
|
+
|
85
|
+
<li><a href="../../Log4r/Configurator.html">Log4r::Configurator</a></li>
|
86
|
+
|
87
|
+
<li><a href="../../Log4r/DateFileOutputter.html">Log4r::DateFileOutputter</a></li>
|
88
|
+
|
89
|
+
<li><a href="../../Log4r/DefaultFormatter.html">Log4r::DefaultFormatter</a></li>
|
90
|
+
|
91
|
+
<li><a href="../../Log4r/EmailOutputter.html">Log4r::EmailOutputter</a></li>
|
92
|
+
|
93
|
+
<li><a href="../../Log4r/FileOutputter.html">Log4r::FileOutputter</a></li>
|
94
|
+
|
95
|
+
<li><a href="../../Log4r/Formatter.html">Log4r::Formatter</a></li>
|
96
|
+
|
97
|
+
<li><a href="../../Log4r/GDC.html">Log4r::GDC</a></li>
|
98
|
+
|
99
|
+
<li><a href="../../Log4r/IOOutputter.html">Log4r::IOOutputter</a></li>
|
100
|
+
|
101
|
+
<li><a href="../../Log4r/Log4jXmlFormatter.html">Log4r::Log4jXmlFormatter</a></li>
|
102
|
+
|
103
|
+
<li><a href="../../Log4r/Log4rTools.html">Log4r::Log4rTools</a></li>
|
104
|
+
|
105
|
+
<li><a href="../../Log4r/LogEvent.html">Log4r::LogEvent</a></li>
|
106
|
+
|
107
|
+
<li><a href="../../Log4r/LogServer.html">Log4r::LogServer</a></li>
|
108
|
+
|
109
|
+
<li><a href="../../Log4r/Logger.html">Log4r::Logger</a></li>
|
110
|
+
|
111
|
+
<li><a href="../../Log4r/MDC.html">Log4r::MDC</a></li>
|
112
|
+
|
113
|
+
<li><a href="../../Log4r/NDC.html">Log4r::NDC</a></li>
|
114
|
+
|
115
|
+
<li><a href="../../Log4r/ObjectFormatter.html">Log4r::ObjectFormatter</a></li>
|
116
|
+
|
117
|
+
<li><a href="../../Log4r/Outputter.html">Log4r::Outputter</a></li>
|
118
|
+
|
119
|
+
<li><a href="../../Log4r/PatternFormatter.html">Log4r::PatternFormatter</a></li>
|
120
|
+
|
121
|
+
<li><a href="../../Log4r/RemoteOutputter.html">Log4r::RemoteOutputter</a></li>
|
122
|
+
|
123
|
+
<li><a href="../../Log4r/RollingFileOutputter.html">Log4r::RollingFileOutputter</a></li>
|
124
|
+
|
125
|
+
<li><a href="../../Log4r/RootLogger.html">Log4r::RootLogger</a></li>
|
126
|
+
|
127
|
+
<li><a href="../../Log4r/SimpleFormatter.html">Log4r::SimpleFormatter</a></li>
|
128
|
+
|
129
|
+
<li><a href="../../Log4r/StderrOutputter.html">Log4r::StderrOutputter</a></li>
|
130
|
+
|
131
|
+
<li><a href="../../Log4r/StdoutOutputter.html">Log4r::StdoutOutputter</a></li>
|
132
|
+
|
133
|
+
<li><a href="../../Log4r/SyslogOutputter.html">Log4r::SyslogOutputter</a></li>
|
134
|
+
|
135
|
+
<li><a href="../../Log4r/UDPOutputter.html">Log4r::UDPOutputter</a></li>
|
136
|
+
|
137
|
+
<li><a href="../../Log4r/YamlConfigurator.html">Log4r::YamlConfigurator</a></li>
|
138
|
+
|
139
|
+
</ul>
|
140
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div id="documentation">
|
148
|
+
<h1>Formatters</h1>
|
149
|
+
<p>
|
150
|
+
Formatters are responsible for formatting LogEvent data. An Outputter
|
151
|
+
owning a Formatter will invoke the <a
|
152
|
+
href="../../Log4r/Formatter.html#M000007">Log4r::Formatter#format</a>
|
153
|
+
method prior to writing.
|
154
|
+
</p>
|
155
|
+
<h2>Available Formatters</h2>
|
156
|
+
<ul>
|
157
|
+
<li><a href="../../Log4r/BasicFormatter.html">Log4r::BasicFormatter</a> -
|
158
|
+
default
|
159
|
+
|
160
|
+
</li>
|
161
|
+
<li><a href="../../Log4r/PatternFormatter.html">Log4r::PatternFormatter</a> -
|
162
|
+
most flexible. See <a
|
163
|
+
href="../formatter/patternformatter_rb.html">log4r/formatter/patternformatter.rb</a>
|
164
|
+
|
165
|
+
</li>
|
166
|
+
<li><a href="../../Log4r/SimpleFormatter.html">Log4r::SimpleFormatter</a> -
|
167
|
+
like BasicFormatter for Strings only (low noise)
|
168
|
+
|
169
|
+
</li>
|
170
|
+
<li><a href="../../Log4r/ObjectFormatter.html">Log4r::ObjectFormatter</a> - for
|
171
|
+
inspecting objects
|
172
|
+
|
173
|
+
</li>
|
174
|
+
<li>Log4r::NullFormatter - twirls on its feet and does nothing
|
175
|
+
|
176
|
+
</li>
|
177
|
+
</ul>
|
178
|
+
<h1>XML Configuration</h1>
|
179
|
+
<p>
|
180
|
+
Specify the Formatter and its class (as <tt>type</tt>) under an
|
181
|
+
<tt><outputter></tt> directive:
|
182
|
+
</p>
|
183
|
+
<pre>
|
184
|
+
<outputter name="someout" type="sometype">
|
185
|
+
<formatter type="Log4r::BasicFormatter"/>
|
186
|
+
</outputter>
|
187
|
+
</pre>
|
188
|
+
<p>
|
189
|
+
As explained in <a
|
190
|
+
href="../configurator_rb.html">log4r/configurator.rb</a>, the hash
|
191
|
+
arguments you would normally pass to <tt>new</tt> are specified as <em>XML
|
192
|
+
parameters</em>. Only PatternFormatter has any of these.
|
193
|
+
</p>
|
194
|
+
<h1>Custom Formatting</h1>
|
195
|
+
<p>
|
196
|
+
Building a custom Formatter is extremely easy. Just define a class that
|
197
|
+
extends Formatter and override the Formatter#format method. Then give it to
|
198
|
+
any interested Outputters.
|
199
|
+
</p>
|
200
|
+
<p>
|
201
|
+
If you’re interested in setting up your custom formatters in XML,
|
202
|
+
please take a look at log4r/configurator.rb.
|
203
|
+
</p>
|
204
|
+
<h2>Data Available</h2>
|
205
|
+
<p>
|
206
|
+
See <a href="../../Log4r/LogEvent.html">Log4r::LogEvent</a>
|
207
|
+
</p>
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div id="validator-badges">
|
212
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
213
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
214
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
215
|
+
</div>
|
216
|
+
</body>
|
217
|
+
</html>
|
218
|
+
|