logging 0.9.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +13 -0
- data/README.rdoc +51 -39
- data/Rakefile +1 -0
- data/examples/appenders.rb +44 -0
- data/examples/classes.rb +39 -0
- data/examples/formatting.rb +49 -0
- data/examples/hierarchies.rb +71 -0
- data/examples/layouts.rb +45 -0
- data/examples/loggers.rb +26 -0
- data/examples/names.rb +40 -0
- data/examples/simple.rb +14 -0
- data/lib/logging.rb +50 -21
- data/lib/logging/appender.rb +4 -56
- data/lib/logging/appenders.rb +120 -0
- data/lib/logging/appenders/buffering.rb +2 -1
- data/lib/logging/appenders/console.rb +0 -2
- data/lib/logging/appenders/rolling_file.rb +0 -2
- data/lib/logging/appenders/string_io.rb +1 -3
- data/lib/logging/appenders/syslog.rb +0 -7
- data/lib/logging/config/configurator.rb +1 -1
- data/lib/logging/config/yaml_configurator.rb +3 -7
- data/lib/logging/layout.rb +2 -4
- data/lib/logging/layouts.rb +47 -0
- data/lib/logging/layouts/basic.rb +2 -4
- data/lib/logging/layouts/parseable.rb +211 -0
- data/lib/logging/layouts/pattern.rb +6 -8
- data/lib/logging/log_event.rb +1 -1
- data/lib/logging/logger.rb +4 -4
- data/lib/spec/logging_helper.rb +2 -2
- data/test/appenders/test_buffered_io.rb +26 -18
- data/test/appenders/test_console.rb +10 -10
- data/test/appenders/test_email.rb +18 -19
- data/test/appenders/test_file.rb +12 -12
- data/test/appenders/test_growl.rb +11 -12
- data/test/appenders/test_io.rb +14 -15
- data/test/appenders/test_rolling_file.rb +15 -24
- data/test/appenders/test_syslog.rb +10 -10
- data/test/layouts/test_basic.rb +4 -5
- data/test/layouts/test_json.rb +112 -0
- data/test/layouts/test_pattern.rb +9 -9
- data/test/layouts/test_yaml.rb +121 -0
- data/test/setup.rb +1 -1
- data/test/test_appender.rb +0 -14
- data/test/test_log_event.rb +1 -1
- data/test/test_logging.rb +3 -3
- metadata +17 -2
@@ -8,9 +8,9 @@ module TestAppenders
|
|
8
8
|
include LoggingTestCase
|
9
9
|
|
10
10
|
def test_initialize
|
11
|
-
|
11
|
+
Logging::Repository.instance
|
12
12
|
|
13
|
-
appender =
|
13
|
+
appender = Logging.appenders.stdout
|
14
14
|
assert_equal 'stdout', appender.name
|
15
15
|
assert_same STDOUT, appender.instance_variable_get(:@io)
|
16
16
|
|
@@ -18,14 +18,14 @@ module TestAppenders
|
|
18
18
|
assert_equal true, appender.closed?
|
19
19
|
assert_equal false, STDOUT.closed?
|
20
20
|
|
21
|
-
appender =
|
21
|
+
appender = Logging.appenders.stdout('foo')
|
22
22
|
assert_equal 'foo', appender.name
|
23
23
|
|
24
|
-
appender =
|
24
|
+
appender = Logging.appenders.stdout(:level => :warn)
|
25
25
|
assert_equal 'stdout', appender.name
|
26
26
|
assert_equal 2, appender.level
|
27
27
|
|
28
|
-
appender =
|
28
|
+
appender = Logging.appenders.stdout('bar', :level => :error)
|
29
29
|
assert_equal 'bar', appender.name
|
30
30
|
assert_equal 3, appender.level
|
31
31
|
end
|
@@ -36,9 +36,9 @@ module TestAppenders
|
|
36
36
|
include LoggingTestCase
|
37
37
|
|
38
38
|
def test_initialize
|
39
|
-
|
39
|
+
Logging::Repository.instance
|
40
40
|
|
41
|
-
appender =
|
41
|
+
appender = Logging.appenders.stderr
|
42
42
|
assert_equal 'stderr', appender.name
|
43
43
|
assert_same STDERR, appender.instance_variable_get(:@io)
|
44
44
|
|
@@ -46,14 +46,14 @@ module TestAppenders
|
|
46
46
|
assert_equal true, appender.closed?
|
47
47
|
assert_equal false, STDERR.closed?
|
48
48
|
|
49
|
-
appender =
|
49
|
+
appender = Logging.appenders.stderr('foo')
|
50
50
|
assert_equal 'foo', appender.name
|
51
51
|
|
52
|
-
appender =
|
52
|
+
appender = Logging.appenders.stderr(:level => :warn)
|
53
53
|
assert_equal 'stderr', appender.name
|
54
54
|
assert_equal 2, appender.level
|
55
55
|
|
56
|
-
appender =
|
56
|
+
appender = Logging.appenders.stderr('bar', :level => :error)
|
57
57
|
assert_equal 'bar', appender.name
|
58
58
|
assert_equal 3, appender.level
|
59
59
|
end
|
@@ -11,8 +11,6 @@ module TestAppenders
|
|
11
11
|
|
12
12
|
def setup
|
13
13
|
super
|
14
|
-
::Logging.init
|
15
|
-
@levels = ::Logging::LEVELS
|
16
14
|
|
17
15
|
flexmock(Net::SMTP).new_instances do |m|
|
18
16
|
m.should_receive(:start).at_least.once.with(
|
@@ -20,25 +18,26 @@ module TestAppenders
|
|
20
18
|
m.should_receive(:sendmail).at_least.once.with(String, 'me', ['you'])
|
21
19
|
end
|
22
20
|
|
23
|
-
@appender =
|
21
|
+
@appender = Logging.appenders.email('email',
|
24
22
|
'from' => 'me', 'to' => 'you',
|
25
23
|
:buffer_size => '3', :immediate_at => 'error, fatal',
|
26
24
|
:domain => 'test.logging', :acct => 'test', :passwd => 'test'
|
27
25
|
)
|
26
|
+
@levels = Logging::LEVELS
|
28
27
|
end
|
29
28
|
|
30
29
|
def test_initialize
|
31
30
|
assert_raise(ArgumentError, 'Must specify from address') {
|
32
|
-
|
31
|
+
Logging.appenders.email('email')
|
33
32
|
}
|
34
33
|
assert_raise(ArgumentError, 'Must specify to address') {
|
35
|
-
|
34
|
+
Logging.appenders.email('email', :from => 'me')
|
36
35
|
}
|
37
36
|
assert_nothing_raised {
|
38
|
-
|
37
|
+
Logging.appenders.email('email', :from => 'me', :to => 'you')
|
39
38
|
}
|
40
39
|
|
41
|
-
appender =
|
40
|
+
appender = Logging.appenders.email('email',
|
42
41
|
'from' => 'me', 'to' => 'you'
|
43
42
|
)
|
44
43
|
|
@@ -53,7 +52,7 @@ module TestAppenders
|
|
53
52
|
assert_equal(:cram_md5, appender.authtype)
|
54
53
|
assert_equal("Message of #{$0}", appender.subject)
|
55
54
|
|
56
|
-
appender =
|
55
|
+
appender = Logging.appenders.email('email',
|
57
56
|
'from' => 'lbrinn@gmail.com', 'to' => 'everyone',
|
58
57
|
:buffsize => '1000', :immediate_at => 'error, fatal',
|
59
58
|
:server => 'smtp.google.com', :port => '443',
|
@@ -75,7 +74,7 @@ module TestAppenders
|
|
75
74
|
assert_equal(:tls, appender.authtype)
|
76
75
|
assert_equal("I'm rich and you're not", appender.subject)
|
77
76
|
|
78
|
-
appender =
|
77
|
+
appender = Logging.appenders.email('email',
|
79
78
|
'from' => 'me', 'to' => 'you', :auto_flushing => 42
|
80
79
|
)
|
81
80
|
assert_equal(42, appender.auto_flushing)
|
@@ -85,8 +84,8 @@ module TestAppenders
|
|
85
84
|
# with auto_flushing enabled, mail will be sent each time a log event
|
86
85
|
# occurs
|
87
86
|
@appender.auto_flushing = true
|
88
|
-
event =
|
89
|
-
|
87
|
+
event = Logging::LogEvent.new('TestLogger', @levels['warn'],
|
88
|
+
[1, 2, 3, 4], false)
|
90
89
|
@appender.append event
|
91
90
|
assert_not_equal(@levels.length, @appender.level)
|
92
91
|
assert_equal(0, @appender.buffer.length)
|
@@ -102,10 +101,10 @@ module TestAppenders
|
|
102
101
|
assert_equal(0, @appender.buffer.length)
|
103
102
|
|
104
103
|
# error and fatal messages should be send immediately (no buffering)
|
105
|
-
error =
|
106
|
-
|
107
|
-
fatal =
|
108
|
-
|
104
|
+
error = Logging::LogEvent.new('ErrLogger', @levels['error'],
|
105
|
+
'error message', false)
|
106
|
+
fatal = Logging::LogEvent.new('FatalLogger', @levels['fatal'],
|
107
|
+
'fatal message', false)
|
109
108
|
|
110
109
|
@appender.append event
|
111
110
|
@appender.append fatal
|
@@ -140,8 +139,8 @@ module TestAppenders
|
|
140
139
|
end
|
141
140
|
|
142
141
|
def test_flush
|
143
|
-
event =
|
144
|
-
|
142
|
+
event = Logging::LogEvent.new('TestLogger', @levels['info'],
|
143
|
+
[1, 2, 3, 4], false)
|
145
144
|
@appender.append event
|
146
145
|
@appender << 'test message'
|
147
146
|
assert_equal(2, @appender.buffer.length)
|
@@ -152,8 +151,8 @@ module TestAppenders
|
|
152
151
|
end
|
153
152
|
|
154
153
|
def test_close
|
155
|
-
event =
|
156
|
-
|
154
|
+
event = Logging::LogEvent.new('TestLogger', @levels['info'],
|
155
|
+
[1, 2, 3, 4], false)
|
157
156
|
@appender.append event
|
158
157
|
@appender << 'test message'
|
159
158
|
assert_equal(2, @appender.buffer.length)
|
data/test/appenders/test_file.rb
CHANGED
@@ -11,7 +11,7 @@ module TestAppenders
|
|
11
11
|
|
12
12
|
def setup
|
13
13
|
super
|
14
|
-
|
14
|
+
Logging.init
|
15
15
|
|
16
16
|
FileUtils.mkdir [File.join(TMP, 'dir'), File.join(TMP, 'uw_dir')]
|
17
17
|
FileUtils.chmod 0555, File.join(TMP, 'uw_dir')
|
@@ -22,26 +22,26 @@ module TestAppenders
|
|
22
22
|
def test_class_assert_valid_logfile
|
23
23
|
log = File.join(TMP, 'uw_dir', 'file.log')
|
24
24
|
assert_raise(ArgumentError) do
|
25
|
-
|
25
|
+
Logging.appenders.file.assert_valid_logfile(log)
|
26
26
|
end
|
27
27
|
|
28
28
|
log = File.join(TMP, 'dir')
|
29
29
|
assert_raise(ArgumentError) do
|
30
|
-
|
30
|
+
Logging.appenders.file.assert_valid_logfile(log)
|
31
31
|
end
|
32
32
|
|
33
33
|
log = File.join(TMP, 'uw_file')
|
34
34
|
assert_raise(ArgumentError) do
|
35
|
-
|
35
|
+
Logging.appenders.file.assert_valid_logfile(log)
|
36
36
|
end
|
37
37
|
|
38
38
|
log = File.join(TMP, 'file.log')
|
39
|
-
assert
|
39
|
+
assert Logging.appenders.file.assert_valid_logfile(log)
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_initialize
|
43
43
|
log = File.join(TMP, 'file.log')
|
44
|
-
appender =
|
44
|
+
appender = Logging.appenders.file(NAME, 'filename' => log)
|
45
45
|
assert_equal 'logfile', appender.name
|
46
46
|
appender << "This will be the first line\n"
|
47
47
|
appender << "This will be the second line\n"
|
@@ -53,7 +53,7 @@ module TestAppenders
|
|
53
53
|
end
|
54
54
|
cleanup
|
55
55
|
|
56
|
-
appender =
|
56
|
+
appender = Logging.appenders.file(NAME, :filename => log)
|
57
57
|
assert_equal 'logfile', appender.name
|
58
58
|
appender << "This will be the third line\n"
|
59
59
|
appender.flush
|
@@ -65,8 +65,8 @@ module TestAppenders
|
|
65
65
|
end
|
66
66
|
cleanup
|
67
67
|
|
68
|
-
appender =
|
69
|
-
|
68
|
+
appender = Logging.appenders.file(NAME, :filename => log,
|
69
|
+
:truncate => true)
|
70
70
|
assert_equal 'logfile', appender.name
|
71
71
|
appender << "The file was truncated\n"
|
72
72
|
appender.flush
|
@@ -79,9 +79,9 @@ module TestAppenders
|
|
79
79
|
|
80
80
|
private
|
81
81
|
def cleanup
|
82
|
-
unless
|
83
|
-
|
84
|
-
|
82
|
+
unless Logging.appenders[NAME].nil?
|
83
|
+
Logging.appenders[NAME].close false
|
84
|
+
Logging.appenders[NAME] = nil
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -11,15 +11,14 @@ module TestAppenders
|
|
11
11
|
|
12
12
|
def setup
|
13
13
|
super
|
14
|
-
::Logging.init
|
15
|
-
@levels = ::Logging::LEVELS
|
16
14
|
|
17
|
-
@appender =
|
15
|
+
@appender = Logging.appenders.growl('growl',
|
18
16
|
:coalesce => true, :separator => "\000",
|
19
|
-
:layout => Logging
|
17
|
+
:layout => Logging.layouts.pattern(:pattern => "%5l - Test\000%m")
|
20
18
|
)
|
21
19
|
@appender.level = :all
|
22
20
|
@growl = @appender.instance_variable_get(:@growl).dup
|
21
|
+
@levels = Logging::LEVELS
|
23
22
|
end
|
24
23
|
|
25
24
|
def test_initialize
|
@@ -29,10 +28,10 @@ module TestAppenders
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def test_append
|
32
|
-
info =
|
33
|
-
|
34
|
-
warn =
|
35
|
-
|
31
|
+
info = Logging::LogEvent.new('TestLogger', @levels['info'],
|
32
|
+
'info message', false)
|
33
|
+
warn = Logging::LogEvent.new('TestLogger', @levels['warn'],
|
34
|
+
'warning message', false)
|
36
35
|
|
37
36
|
flexmock(@appender).should_receive(:system => true).once.with(
|
38
37
|
@growl % ['WARN - Test', "warning message\nwarning message\nwarning message", 0])
|
@@ -54,8 +53,8 @@ module TestAppenders
|
|
54
53
|
|
55
54
|
def test_append_without_coalescing
|
56
55
|
@appender.instance_variable_set(:@coalesce, false)
|
57
|
-
event =
|
58
|
-
|
56
|
+
event = Logging::LogEvent.new('TestLogger', @levels['warn'],
|
57
|
+
'warning message', false)
|
59
58
|
|
60
59
|
flexmock(@appender).should_receive(:system => true).twice.with(
|
61
60
|
@growl % ['WARN - Test', 'warning message', 0])
|
@@ -108,8 +107,8 @@ module TestAppenders
|
|
108
107
|
|
109
108
|
def test_disabling
|
110
109
|
@appender.instance_variable_set(:@coalesce, false)
|
111
|
-
event =
|
112
|
-
|
110
|
+
event = Logging::LogEvent.new('TestLogger', @levels['warn'],
|
111
|
+
'warning message', false)
|
113
112
|
|
114
113
|
flexmock(@appender).should_receive(:system => false).once.with(
|
115
114
|
@growl % ['WARN - Test', 'warning message', 0])
|
data/test/appenders/test_io.rb
CHANGED
@@ -9,16 +9,15 @@ module TestAppenders
|
|
9
9
|
|
10
10
|
def setup
|
11
11
|
super
|
12
|
-
::Logging.init
|
13
|
-
@levels = ::Logging::LEVELS
|
14
12
|
|
15
|
-
@appender =
|
13
|
+
@appender = Logging.appenders.string_io('test_appender')
|
16
14
|
@sio = @appender.sio
|
15
|
+
@levels = Logging::LEVELS
|
17
16
|
end
|
18
17
|
|
19
18
|
def test_append
|
20
|
-
event =
|
21
|
-
|
19
|
+
event = Logging::LogEvent.new('TestLogger', @levels['warn'],
|
20
|
+
[1, 2, 3, 4], false)
|
22
21
|
@appender.append event
|
23
22
|
assert_equal " WARN TestLogger : <Array> #{[1, 2, 3, 4]}\n", readline
|
24
23
|
assert_nil(readline)
|
@@ -36,14 +35,14 @@ module TestAppenders
|
|
36
35
|
def test_append_error
|
37
36
|
# setup an internal logger to capture error messages from the IO
|
38
37
|
# appender
|
39
|
-
log = Logging
|
40
|
-
Logging
|
41
|
-
Logging
|
38
|
+
log = Logging.appenders.string_io('__internal_io')
|
39
|
+
Logging.logger[Logging].add_appenders(log)
|
40
|
+
Logging.logger[Logging].level = 'all'
|
42
41
|
|
43
42
|
# close the string IO object so we get an error
|
44
43
|
@sio.close
|
45
|
-
event =
|
46
|
-
|
44
|
+
event = Logging::LogEvent.new('TestLogger', @levels['warn'],
|
45
|
+
[1, 2, 3, 4], false)
|
47
46
|
@appender.append event
|
48
47
|
|
49
48
|
assert_equal "INFO Logging : appender \"test_appender\" has been disabled", log.readline.strip
|
@@ -62,7 +61,7 @@ module TestAppenders
|
|
62
61
|
assert_equal true, @appender.closed?
|
63
62
|
|
64
63
|
[STDIN, STDERR, STDOUT].each do |io|
|
65
|
-
@appender =
|
64
|
+
@appender = Logging.appenders.io('test', io)
|
66
65
|
@appender.close
|
67
66
|
assert_equal false, io.closed?
|
68
67
|
assert_equal true, @appender.closed?
|
@@ -87,9 +86,9 @@ module TestAppenders
|
|
87
86
|
def test_concat_error
|
88
87
|
# setup an internal logger to capture error messages from the IO
|
89
88
|
# appender
|
90
|
-
log = Logging
|
91
|
-
Logging
|
92
|
-
Logging
|
89
|
+
log = Logging.appenders.string_io('__internal_io')
|
90
|
+
Logging.logger[Logging].add_appenders(log)
|
91
|
+
Logging.logger[Logging].level = 'all'
|
93
92
|
|
94
93
|
# close the string IO object so we get an error
|
95
94
|
@sio.close
|
@@ -114,7 +113,7 @@ module TestAppenders
|
|
114
113
|
|
115
114
|
def test_initialize
|
116
115
|
assert_raise(EOFError) {@sio.readline}
|
117
|
-
assert_raise(TypeError) {
|
116
|
+
assert_raise(TypeError) {Logging.appenders.io('test', [])}
|
118
117
|
end
|
119
118
|
|
120
119
|
private
|
@@ -11,7 +11,7 @@ module TestAppenders
|
|
11
11
|
|
12
12
|
def setup
|
13
13
|
super
|
14
|
-
|
14
|
+
Logging.init
|
15
15
|
|
16
16
|
@fn = File.join(TMP, 'test.log')
|
17
17
|
@fn_fmt = File.join(TMP, 'test.%d.log')
|
@@ -22,7 +22,7 @@ module TestAppenders
|
|
22
22
|
assert_equal [], Dir.glob(@glob)
|
23
23
|
|
24
24
|
# create a new appender
|
25
|
-
ap =
|
25
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn)
|
26
26
|
assert File.exist?(@fn)
|
27
27
|
assert_equal 0, File.size(@fn)
|
28
28
|
|
@@ -32,7 +32,7 @@ module TestAppenders
|
|
32
32
|
cleanup
|
33
33
|
|
34
34
|
# make sure we append to the current file (not truncate)
|
35
|
-
ap =
|
35
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn)
|
36
36
|
assert_equal [@fn], Dir.glob(@glob)
|
37
37
|
assert_equal 20, File.size(@fn)
|
38
38
|
|
@@ -43,8 +43,7 @@ module TestAppenders
|
|
43
43
|
|
44
44
|
# setting the truncate option to true should roll the current log file
|
45
45
|
# and create a new one
|
46
|
-
ap =
|
47
|
-
:filename => @fn, :truncate => true)
|
46
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :truncate => true)
|
48
47
|
|
49
48
|
log1 = sprintf(@fn_fmt, 1)
|
50
49
|
assert_equal [log1, @fn], Dir.glob(@glob).sort
|
@@ -67,8 +66,7 @@ module TestAppenders
|
|
67
66
|
FileUtils.touch(@fn)
|
68
67
|
|
69
68
|
# keep only five files
|
70
|
-
ap =
|
71
|
-
:filename => @fn, :keep => 5)
|
69
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :keep => 5)
|
72
70
|
|
73
71
|
# we still have 13 files because we did not truncate the log file,
|
74
72
|
# and hence, we did not roll all the log files
|
@@ -89,12 +87,10 @@ module TestAppenders
|
|
89
87
|
assert_equal [], Dir.glob(@glob)
|
90
88
|
|
91
89
|
assert_raise(ArgumentError) do
|
92
|
-
|
93
|
-
NAME, :filename => @fn, :age => 'bob')
|
90
|
+
Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 'bob')
|
94
91
|
end
|
95
92
|
|
96
|
-
ap =
|
97
|
-
:filename => @fn, :age => 1)
|
93
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 1)
|
98
94
|
ap << "random message\n"
|
99
95
|
assert_equal 1, Dir.glob(@glob).length
|
100
96
|
|
@@ -103,8 +99,7 @@ module TestAppenders
|
|
103
99
|
assert_equal 2, Dir.glob(@glob).length
|
104
100
|
|
105
101
|
cleanup
|
106
|
-
ap =
|
107
|
-
:filename => @fn, 'age' => 'daily')
|
102
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, 'age' => 'daily')
|
108
103
|
ap << "random message\n"
|
109
104
|
assert_equal 2, Dir.glob(@glob).length
|
110
105
|
|
@@ -118,8 +113,7 @@ module TestAppenders
|
|
118
113
|
assert_equal 3, Dir.glob(@glob).length
|
119
114
|
|
120
115
|
cleanup
|
121
|
-
ap =
|
122
|
-
:filename => @fn, :age => 'weekly')
|
116
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 'weekly')
|
123
117
|
ap << "random message\n"
|
124
118
|
assert_equal 3, Dir.glob(@glob).length
|
125
119
|
|
@@ -131,8 +125,7 @@ module TestAppenders
|
|
131
125
|
assert_equal 4, Dir.glob(@glob).length
|
132
126
|
|
133
127
|
cleanup
|
134
|
-
ap =
|
135
|
-
:filename => @fn, :age => 'monthly')
|
128
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :age => 'monthly')
|
136
129
|
ap << "random message\n"
|
137
130
|
assert_equal 4, Dir.glob(@glob).length
|
138
131
|
|
@@ -147,8 +140,7 @@ module TestAppenders
|
|
147
140
|
def test_size
|
148
141
|
assert_equal [], Dir.glob(@glob)
|
149
142
|
|
150
|
-
ap =
|
151
|
-
:filename => @fn, :size => 100)
|
143
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :size => 100)
|
152
144
|
|
153
145
|
ap << 'X' * 100; ap.flush
|
154
146
|
assert_equal 1, Dir.glob(@glob).length
|
@@ -174,8 +166,7 @@ module TestAppenders
|
|
174
166
|
def test_file_removed
|
175
167
|
assert_equal [], Dir.glob(@glob)
|
176
168
|
|
177
|
-
ap =
|
178
|
-
:filename => @fn, :size => 100)
|
169
|
+
ap = Logging.appenders.rolling_file(NAME, :filename => @fn, :size => 100)
|
179
170
|
|
180
171
|
ap << 'X' * 100; ap.flush
|
181
172
|
assert_equal 1, Dir.glob(@glob).length
|
@@ -194,9 +185,9 @@ module TestAppenders
|
|
194
185
|
|
195
186
|
private
|
196
187
|
def cleanup
|
197
|
-
unless
|
198
|
-
|
199
|
-
|
188
|
+
unless Logging.appenders[NAME].nil?
|
189
|
+
Logging.appenders[NAME].close false
|
190
|
+
Logging.appenders[NAME] = nil
|
200
191
|
end
|
201
192
|
end
|
202
193
|
|