log4r 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/content/contact.html +22 -0
- data/doc/content/contribute.html +21 -0
- data/doc/content/index.html +90 -0
- data/doc/content/license.html +56 -0
- data/doc/content/manual.html +449 -0
- data/doc/dev/README.developers +55 -0
- data/doc/dev/checklist +23 -0
- data/doc/dev/things-to-do +5 -0
- data/doc/images/log4r-logo.png +0 -0
- data/doc/images/logo2.png +0 -0
- data/doc/log4r.css +111 -0
- data/doc/templates/main.html +147 -0
- data/examples/README +19 -0
- data/examples/customlevels.rb +34 -0
- data/examples/fileroll.rb +40 -0
- data/examples/log4r_yaml.yaml +0 -0
- data/examples/logclient.rb +25 -0
- data/examples/logserver.rb +18 -0
- data/examples/moderate.xml +29 -0
- data/examples/moderateconfig.rb +66 -0
- data/examples/myformatter.rb +23 -0
- data/examples/outofthebox.rb +21 -0
- data/examples/rrconfig.xml +63 -0
- data/examples/rrsetup.rb +42 -0
- data/examples/simpleconfig.rb +39 -0
- data/examples/xmlconfig.rb +25 -0
- data/examples/yaml.rb +30 -0
- data/src/log4r.rb +17 -0
- data/src/log4r/base.rb +74 -0
- data/src/log4r/config.rb +9 -0
- data/src/log4r/configurator.rb +224 -0
- data/src/log4r/formatter/formatter.rb +105 -0
- data/src/log4r/formatter/patternformatter.rb +107 -0
- data/src/log4r/lib/drbloader.rb +52 -0
- data/src/log4r/lib/xmlloader.rb +24 -0
- data/src/log4r/logevent.rb +28 -0
- data/src/log4r/logger.rb +194 -0
- data/src/log4r/loggerfactory.rb +89 -0
- data/src/log4r/logserver.rb +28 -0
- data/src/log4r/outputter/consoleoutputters.rb +18 -0
- data/src/log4r/outputter/datefileoutputter.rb +110 -0
- data/src/log4r/outputter/emailoutputter.rb +116 -0
- data/src/log4r/outputter/fileoutputter.rb +49 -0
- data/src/log4r/outputter/iooutputter.rb +55 -0
- data/src/log4r/outputter/outputter.rb +132 -0
- data/src/log4r/outputter/outputterfactory.rb +59 -0
- data/src/log4r/outputter/remoteoutputter.rb +40 -0
- data/src/log4r/outputter/rollingfileoutputter.rb +126 -0
- data/src/log4r/outputter/staticoutputter.rb +30 -0
- data/src/log4r/outputter/syslogoutputter.rb +75 -0
- data/src/log4r/rdoc/configurator +243 -0
- data/src/log4r/rdoc/emailoutputter +103 -0
- data/src/log4r/rdoc/formatter +39 -0
- data/src/log4r/rdoc/log4r +89 -0
- data/src/log4r/rdoc/logger +175 -0
- data/src/log4r/rdoc/logserver +85 -0
- data/src/log4r/rdoc/outputter +108 -0
- data/src/log4r/rdoc/patternformatter +128 -0
- data/src/log4r/rdoc/syslogoutputter +29 -0
- data/src/log4r/rdoc/yamlconfigurator +20 -0
- data/src/log4r/repository.rb +65 -0
- data/src/log4r/staticlogger.rb +49 -0
- data/src/log4r/yamlconfigurator.rb +0 -0
- data/tests/README +10 -0
- data/tests/testall.rb +6 -0
- data/tests/testbase.rb +49 -0
- data/tests/testconf.xml +37 -0
- data/tests/testcustom.rb +27 -0
- data/tests/testformatter.rb +27 -0
- data/tests/testlogger.rb +196 -0
- data/tests/testoutputter.rb +111 -0
- data/tests/testpatternformatter.rb +21 -0
- data/tests/testxmlconf.rb +45 -0
- metadata +127 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
This document introduces interested developers to log4r development. It also
|
2
|
+
reminds us how things work here. :-)
|
3
|
+
|
4
|
+
RubyForge Site
|
5
|
+
--------------
|
6
|
+
|
7
|
+
Log4r is hosted on RubyForge. It was hosted on SourceForge up to 1.0.5.
|
8
|
+
|
9
|
+
Project Full Name: Log4r
|
10
|
+
Project Unix Name: log4r
|
11
|
+
CVS Server: cvs.log4r.rubyforge.org
|
12
|
+
Shell/Web Server: log4r.rubyforge.org
|
13
|
+
Path to web pages: /var/www/gforge-projects/log4r/
|
14
|
+
|
15
|
+
|
16
|
+
HTML manual and site
|
17
|
+
--------------------
|
18
|
+
|
19
|
+
This is pieced together with a homebrewed content-template system.
|
20
|
+
doc/content has the actual contents, which are just three lines of metadata
|
21
|
+
and a bunch of <tr>s that are incorporated into a template. The only template
|
22
|
+
is doc/templates/main.html which is universal. To test the changes, run
|
23
|
+
bin/makedoc.rb directly and check the results in doc/index.html.
|
24
|
+
|
25
|
+
|
26
|
+
Testing RDoc
|
27
|
+
------------
|
28
|
+
Either run bin/makerdoc.rb directly or,
|
29
|
+
|
30
|
+
cd src/
|
31
|
+
rdoc --op /tmp/rdoc --template kilmer --main log4r.rb
|
32
|
+
|
33
|
+
|
34
|
+
Automated Builds
|
35
|
+
----------------
|
36
|
+
|
37
|
+
The build system is automated and relies on CVS and ruby. There are three main
|
38
|
+
things that go on during build:
|
39
|
+
|
40
|
+
1) bin/makedist.rb checks out a build to prepare for distribution and calls
|
41
|
+
other build scripts, then assembles the distribution into tgz and zip balls
|
42
|
+
|
43
|
+
2) HTML manual is constructed by bin/makehtml.rb, called from makedist.rb
|
44
|
+
|
45
|
+
3) RDoc is constructed by bin/makerdoc.rb, called from makedist.rb
|
46
|
+
|
47
|
+
All system variables and configurable options are in bin/devconfig.rb.
|
48
|
+
|
49
|
+
Essentially, the only thing that needs to be done to build packages for
|
50
|
+
distribution is,
|
51
|
+
|
52
|
+
ruby makedist.rb <version-number>
|
53
|
+
|
54
|
+
The results are one tarball, one zip file of the same, and one documentation
|
55
|
+
tarball ready to be placed on the log4r home page.
|
data/doc/dev/checklist
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Release checklist:
|
2
|
+
|
3
|
+
* DON'T FORGET: change install.rb when new src/ files are added
|
4
|
+
* Update the log4r.gemspec
|
5
|
+
* Update the changelog
|
6
|
+
* Update the README
|
7
|
+
* Change any INSTALL instructions
|
8
|
+
* Update the manuals and HTML
|
9
|
+
* Modify what should not appear in the release (bin/prune.rb)
|
10
|
+
* Run makedist.rb and check the integrity of the resulting files
|
11
|
+
- Test installs
|
12
|
+
- Run the unit tests (cd tests; ruby testall.rb)
|
13
|
+
- Run all the examples
|
14
|
+
- Browse the docs
|
15
|
+
|
16
|
+
|
17
|
+
Who to Tell:
|
18
|
+
|
19
|
+
* RubyGems distribution (to upload gem)
|
20
|
+
* ruby-talk mailing list
|
21
|
+
* RAA
|
22
|
+
* RubyForge news
|
23
|
+
* RubyForge email notification of new file releases
|
@@ -0,0 +1,5 @@
|
|
1
|
+
* Add gem generation to the automated build process
|
2
|
+
* Rewrite the RDoc in third person (no "you"s) and be more formal
|
3
|
+
* Warn of any remaining parameters from XML and YAML in the Configurators
|
4
|
+
* Refactor YamlConfigurator and Configurator a bit: XML shouldn't sound
|
5
|
+
like the prefered option
|
Binary file
|
Binary file
|
data/doc/log4r.css
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #FFFFFF;
|
3
|
+
font-family:sans-serif;
|
4
|
+
}
|
5
|
+
|
6
|
+
a:link { color:#014DA3 }
|
7
|
+
a:active { color:#AA0000 }
|
8
|
+
a:visited { color:#014DA3 }
|
9
|
+
a:hoover { color:#AA0000 }
|
10
|
+
|
11
|
+
.example {
|
12
|
+
font-family: monospace;
|
13
|
+
border:1px solid #007;
|
14
|
+
background:#FFFFFF;
|
15
|
+
margin:1em;
|
16
|
+
}
|
17
|
+
|
18
|
+
pre.box {
|
19
|
+
margin:0px 1em 1em 1em;
|
20
|
+
color:#AA0000;
|
21
|
+
}
|
22
|
+
|
23
|
+
.menu {
|
24
|
+
font-family:sans-serif;
|
25
|
+
font-size:10px;
|
26
|
+
border-left: 1px solid #AA0000;
|
27
|
+
border-right: 1px solid #AA0000;
|
28
|
+
border-bottom: 1px solid #AA0000;
|
29
|
+
background:#EEEEEE;
|
30
|
+
color:#AA0000;
|
31
|
+
}
|
32
|
+
|
33
|
+
.menutitle {
|
34
|
+
font-family:sans-serif;
|
35
|
+
font-size:medium;
|
36
|
+
color:#FFFFFF;
|
37
|
+
font-weight:bold;
|
38
|
+
background:#AA0000;
|
39
|
+
border-right: 1px solid #AA0000;
|
40
|
+
border-left: 1px solid #AA0000;
|
41
|
+
border-top: 1px solid #AA0000;
|
42
|
+
border-bottom: 1px solid #AA0000;
|
43
|
+
}
|
44
|
+
|
45
|
+
.menubuff {
|
46
|
+
font-family:sans-serif;
|
47
|
+
font-size:1px;
|
48
|
+
color:#000000;
|
49
|
+
border-left: 1px solid #AA0000;
|
50
|
+
border-right: 1px solid #AA0000;
|
51
|
+
font-weight:bold;
|
52
|
+
background-color: #99CCFF;
|
53
|
+
height:5;
|
54
|
+
padding-bottom: 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
.contentbuff {
|
58
|
+
font-family:sans-serif;
|
59
|
+
font-size:10px;
|
60
|
+
border-left: 1px solid #AA0000;
|
61
|
+
border-right: 1px solid #AA0000;
|
62
|
+
font-weight:bold;
|
63
|
+
background-color: #99CCFF;
|
64
|
+
height:5;
|
65
|
+
padding-bottom: 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
.header {
|
69
|
+
font-family:sans-serif;
|
70
|
+
color:#AA0000;
|
71
|
+
}
|
72
|
+
|
73
|
+
.content {
|
74
|
+
font-family:sans-serif;
|
75
|
+
font-size:medium;
|
76
|
+
color:#000000;
|
77
|
+
background:#EEEEEE;
|
78
|
+
border-right: 2px solid #AA0000;
|
79
|
+
border-left: 2px solid #AA0000;
|
80
|
+
border-bottom: 2px solid #AA0000;
|
81
|
+
padding-bottom: 5;
|
82
|
+
padding-right: 5;
|
83
|
+
padding-left: 5;
|
84
|
+
padding-top: 0;
|
85
|
+
}
|
86
|
+
.contenttitle {
|
87
|
+
font-family:sans-serif;
|
88
|
+
font-size:medium;
|
89
|
+
color:#FFFFFF;
|
90
|
+
font-weight:bold;
|
91
|
+
background-color:#AA0000;
|
92
|
+
border-left: 2px solid #AA0000;
|
93
|
+
border-top: 1px solid #AA0000;
|
94
|
+
border-right: 2px solid #AA0000;
|
95
|
+
padding: 2;
|
96
|
+
}
|
97
|
+
|
98
|
+
.contentbuff {
|
99
|
+
font-family:sans-serif;
|
100
|
+
font-size:10px;
|
101
|
+
color:#014DA3;
|
102
|
+
border-left: 2px solid #AA0000;
|
103
|
+
border-right: 2px solid #AA0000;
|
104
|
+
font-weight:bold;
|
105
|
+
background-color:#99CCFF;
|
106
|
+
height:13;
|
107
|
+
padding-bottom: 0;
|
108
|
+
}
|
109
|
+
|
110
|
+
br { padding-bottom: 200 }
|
111
|
+
|
@@ -0,0 +1,147 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<!-- TITLE -->
|
4
|
+
<link rel="stylesheet" type="text/css" href="log4r.css">
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
|
8
|
+
<div align="right"><img src="images/log4r-logo.png"/></div>
|
9
|
+
<hr noshade>
|
10
|
+
|
11
|
+
<table border="0" cellspacing="3" cellpadding="0" width="100%">
|
12
|
+
<tr>
|
13
|
+
|
14
|
+
<!-- Sidebar -->
|
15
|
+
<td width="15%" valign="top">
|
16
|
+
<table cellspacing="0" cellpadding="0" width=100%" nowrap="true">
|
17
|
+
|
18
|
+
<!-- Log4r Box -->
|
19
|
+
<tr><td >
|
20
|
+
<table width="100%" cellspacing="0" cellpadding="0" align="center" >
|
21
|
+
<tr><td width="100%" class="menutitle">Log4r</td></tr>
|
22
|
+
<tr><td width="100%" class="menubuff"> </td></tr>
|
23
|
+
<!-- list -->
|
24
|
+
<table class="menu" cellspacing="3" cellpadding="0" width="100%"
|
25
|
+
align="center">
|
26
|
+
<tr><td ><a href="index.html">Home Page</a></tr></td>
|
27
|
+
<tr><td><a href="http://sourceforge.net/project/showfiles.php?group_id=43396">
|
28
|
+
Download</a></td></tr>
|
29
|
+
<tr><td nowrap="true">
|
30
|
+
<a href="http://rubyforge.org/projects/log4r/">@ RubyForge</a>
|
31
|
+
</td></tr>
|
32
|
+
<tr><td>
|
33
|
+
<a href="license.html">License</a>
|
34
|
+
</td></tr>
|
35
|
+
<tr><td>
|
36
|
+
<a href="contact.html">Contact</a>
|
37
|
+
</td></tr>
|
38
|
+
</table>
|
39
|
+
</td></tr>
|
40
|
+
|
41
|
+
<tr><td height=15> </td></tr>
|
42
|
+
|
43
|
+
<!-- Doc Box -->
|
44
|
+
<tr><td >
|
45
|
+
<table cellspacing="0" cellpadding="0" align="center" width="100%">
|
46
|
+
<tr><td width="100%" class="menutitle">Documents</td></tr>
|
47
|
+
<tr><td width="100%" class="menubuff"> </td></tr>
|
48
|
+
<!-- list -->
|
49
|
+
<table class="menu" cellspacing="3" cellpadding="0" width="100%"
|
50
|
+
align="center">
|
51
|
+
<tr><td>
|
52
|
+
<a href="manual.html">#{version} Manual</a>
|
53
|
+
</tr></tr>
|
54
|
+
<tr><td>
|
55
|
+
<a href="rdoc/index.html">#{version} RDoc API</a>
|
56
|
+
</td></tr>
|
57
|
+
|
58
|
+
</table>
|
59
|
+
</td></tr>
|
60
|
+
|
61
|
+
<tr><td height=15> </td></tr>
|
62
|
+
|
63
|
+
<!-- Development Box -->
|
64
|
+
<tr><td >
|
65
|
+
<table cellspacing="0" cellpadding="0" align="center" width="100%">
|
66
|
+
<tr><td width="100%" class="menutitle">Development</td></tr>
|
67
|
+
<tr><td width="100%" class="menubuff"> </td></tr>
|
68
|
+
<!-- list -->
|
69
|
+
<table class="menu" cellspacing="3" cellpadding="0" width="100%"
|
70
|
+
align="center">
|
71
|
+
<tr><td>
|
72
|
+
<a
|
73
|
+
href="http://sourceforge.net/tracker/?atid=436181&group_id=43396&func=browse">
|
74
|
+
Bugs</a>
|
75
|
+
</tr></tr>
|
76
|
+
<tr><td>
|
77
|
+
<a
|
78
|
+
href="http://sourceforge.net/tracker/?atid=436184&group_id=43396&func=browse">
|
79
|
+
Requests</a>
|
80
|
+
</td></tr>
|
81
|
+
<tr><td>
|
82
|
+
<a href="contribute.html">Contribute</a>
|
83
|
+
</td></tr>
|
84
|
+
|
85
|
+
</table>
|
86
|
+
</td></tr>
|
87
|
+
|
88
|
+
<tr><td height=15> </td></tr>
|
89
|
+
|
90
|
+
|
91
|
+
<!-- Link Box -->
|
92
|
+
<tr><td >
|
93
|
+
<table cellspacing="0" cellpadding="0" align="center" width="100%">
|
94
|
+
<tr><td width="100%" class="menutitle">Links</td></tr>
|
95
|
+
<tr><td width="100%" class="menubuff"> </td></tr>
|
96
|
+
<!-- list -->
|
97
|
+
<table class="menu" cellspacing="3" cellpadding="0" width="100%"
|
98
|
+
align="center">
|
99
|
+
<tr><td>
|
100
|
+
<a href="http://www.ruby-lang.org/en/index.html">Ruby</a>
|
101
|
+
</td></tr>
|
102
|
+
<tr><td>
|
103
|
+
<a href="http://jakarta.apache.org/log4j/docs/index.html">Apache Log4j</a>
|
104
|
+
</tr></tr>
|
105
|
+
<tr><td>
|
106
|
+
<a href="http://www.ruby-lang.org/en/raa-list.rhtml?name=REXML">REXML</a>
|
107
|
+
</td></tr>
|
108
|
+
<tr><td>
|
109
|
+
<a href="http://rm-f.net/~cout/ruby/romp/">ROMP</a>
|
110
|
+
</td></tr>
|
111
|
+
<tr><td height="5"> </td></tr>
|
112
|
+
<tr><td align="center">
|
113
|
+
<a href="http://rubyforge.org">
|
114
|
+
<!-- rubyforge image goes here -->
|
115
|
+
</a>
|
116
|
+
</a>
|
117
|
+
</td></tr>
|
118
|
+
|
119
|
+
</table>
|
120
|
+
</td></tr>
|
121
|
+
|
122
|
+
</table>
|
123
|
+
</td>
|
124
|
+
|
125
|
+
<!-- Main column -->
|
126
|
+
<td width="85%" align="left" valign="top">
|
127
|
+
<center>
|
128
|
+
<table cellspacing="0" cellpadding="0" align="center" width="95%">
|
129
|
+
|
130
|
+
<!-- CONTENT -->
|
131
|
+
|
132
|
+
</table>
|
133
|
+
</center>
|
134
|
+
</td>
|
135
|
+
|
136
|
+
|
137
|
+
</tr>
|
138
|
+
</table>
|
139
|
+
<hr noshade>
|
140
|
+
<div align="right">
|
141
|
+
<font color="#888888" size="-1">
|
142
|
+
<i>
|
143
|
+
<!-- CVSID -->
|
144
|
+
</i></font>
|
145
|
+
</div>
|
146
|
+
</body>
|
147
|
+
</html>
|
data/examples/README
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
The examples are:
|
2
|
+
|
3
|
+
1. outofthebox.rb - How to get started with minimal setup
|
4
|
+
2. simpleconfig.rb - Using Log4r casually
|
5
|
+
3. moderateconfig.rb - A more sophisticated config
|
6
|
+
4. xmlconfig.rb and moderate.xml - XML configuration example based on #3
|
7
|
+
5. rrsetup.rb and rrconfig.xml - A real example (or used to be ;-)
|
8
|
+
6. logserver.rb and logclient.rb - Remote logging example
|
9
|
+
7. fileroll.rb - Using RollingFileOutputter
|
10
|
+
8. yaml.rb and log4r_yaml.yaml - YAML configuration example
|
11
|
+
|
12
|
+
The output will go to screen and to files in the directory logs/.
|
13
|
+
|
14
|
+
Note to RubyGems users: The syntax to require log4r as a gem is as follows:
|
15
|
+
|
16
|
+
require 'rubygems'
|
17
|
+
require_gem 'log4r'
|
18
|
+
|
19
|
+
Obviously, the examples will need to be modified to follow this.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Suppose we don't like having 5 levels named DEBUG, INFO, etc.
|
2
|
+
# Suppose we'd rather use 3 levels named Foo, Bar, and Baz.
|
3
|
+
# Log4r allows you to rename the levels and their corresponding methods
|
4
|
+
# in a painless way. This file provides and example
|
5
|
+
|
6
|
+
$: << '../src'
|
7
|
+
|
8
|
+
require 'log4r'
|
9
|
+
require 'log4r/configurator'
|
10
|
+
include Log4r
|
11
|
+
|
12
|
+
# This is how we specify our levels
|
13
|
+
Configurator.custom_levels "Foo", "Bar", "Baz"
|
14
|
+
|
15
|
+
l = Logger.new('custom levels')
|
16
|
+
l.add StdoutOutputter.new('console')
|
17
|
+
|
18
|
+
l.level = Foo
|
19
|
+
puts l.foo?
|
20
|
+
l.foo "This is foo"
|
21
|
+
puts l.bar?
|
22
|
+
l.bar "this is bar"
|
23
|
+
puts l.baz?
|
24
|
+
l.baz "this is baz"
|
25
|
+
|
26
|
+
puts "Now change to Baz"
|
27
|
+
|
28
|
+
l.level = Baz
|
29
|
+
puts l.foo?
|
30
|
+
l.foo {"This is foo"}
|
31
|
+
puts l.bar?
|
32
|
+
l.bar {"this is bar"}
|
33
|
+
puts l.baz?
|
34
|
+
l.baz {"this is baz"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# How to use RollingFileOutputter
|
2
|
+
|
3
|
+
$: << "../src"
|
4
|
+
require 'log4r'
|
5
|
+
include Log4r
|
6
|
+
|
7
|
+
puts "this will take a while"
|
8
|
+
|
9
|
+
# example of log file being split by time constraint 'maxtime'
|
10
|
+
config = {
|
11
|
+
"filename" => "logs/TestTime.log",
|
12
|
+
"maxtime" => 10,
|
13
|
+
"trunc" => true
|
14
|
+
}
|
15
|
+
timeLog = Logger.new 'WbExplorer'
|
16
|
+
timeLog.outputters = RollingFileOutputter.new("WbExplorer", config)
|
17
|
+
timeLog.level = DEBUG
|
18
|
+
|
19
|
+
# log something once a second for 100 seconds
|
20
|
+
100.times { |t|
|
21
|
+
timeLog.info "blah #{t}"
|
22
|
+
sleep(1.0)
|
23
|
+
}
|
24
|
+
|
25
|
+
# example of log file being split by space constraint 'maxsize'
|
26
|
+
config = {
|
27
|
+
"filename" => "logs/TestSize.log",
|
28
|
+
"maxsize" => 16000,
|
29
|
+
"trunc" => true
|
30
|
+
}
|
31
|
+
sizeLog = Logger.new 'WbExplorer'
|
32
|
+
sizeLog.outputters = RollingFileOutputter.new("WbExplorer", config)
|
33
|
+
sizeLog.level = DEBUG
|
34
|
+
|
35
|
+
# log a large number of times
|
36
|
+
100000.times { |t|
|
37
|
+
sizeLog.info "blah #{t}"
|
38
|
+
}
|
39
|
+
|
40
|
+
puts "done! check the two sets of log files in logs/ (TestTime and TestSize)"
|