leafy-rack 0.3.0 → 0.3.1

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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +34 -4
  3. data/.travis.yml +19 -0
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +1 -8
  6. data/README.md +10 -148
  7. data/examples/datadog/.gitignore +2 -0
  8. data/examples/datadog/Gemfile +12 -0
  9. data/examples/datadog/Mavenfile +22 -0
  10. data/examples/datadog/README.md +16 -0
  11. data/examples/datadog/lib/java_gauge.rb +20 -0
  12. data/examples/datadog/lib/metrics.rb +18 -0
  13. data/examples/datadog/lib/ruby_gauge.rb +19 -0
  14. data/examples/hellowarld/.gitignore +3 -0
  15. data/examples/hellowarld/Gemfile +15 -0
  16. data/examples/hellowarld/Mavenfile +162 -0
  17. data/examples/hellowarld/README.md +44 -0
  18. data/examples/hellowarld/Rakefile +13 -0
  19. data/examples/hellowarld/WEB-INF/web.xml +31 -0
  20. data/examples/hellowarld/app/hellowarld.rb +55 -0
  21. data/examples/hellowarld/app/views/person.erb +52 -0
  22. data/examples/hellowarld/config.ru +12 -0
  23. data/leafy-complete.gemspec +22 -0
  24. data/leafy-health/.gitignore +4 -0
  25. data/leafy-health/Gemfile +7 -0
  26. data/leafy-health/LICENSE +22 -0
  27. data/leafy-health/README.md +123 -0
  28. data/leafy-health/Rakefile +14 -0
  29. data/leafy-health/leafy-health.gemspec +27 -0
  30. data/leafy-health/lib/leafy-health.rb +2 -0
  31. data/leafy-health/lib/leafy-health_jars.rb +7 -0
  32. data/leafy-health/lib/leafy/health.rb +2 -0
  33. data/leafy-health/lib/leafy/health/health_check.rb +72 -0
  34. data/leafy-health/lib/leafy/health/registry.rb +55 -0
  35. data/leafy-health/lib/leafy/health/version.rb +6 -0
  36. data/leafy-health/spec/registry_spec.rb +164 -0
  37. data/leafy-health/spec/setup.rb +1 -0
  38. data/leafy-logger/.gitignore +5 -0
  39. data/leafy-logger/Gemfile +9 -0
  40. data/leafy-logger/LICENSE +22 -0
  41. data/leafy-logger/README.md +174 -0
  42. data/{Rakefile → leafy-logger/Rakefile} +0 -0
  43. data/leafy-logger/leafy-logger.gemspec +32 -0
  44. data/leafy-logger/lib/leafy-logger.rb +1 -0
  45. data/leafy-logger/lib/leafy-logger_jars.rb +33 -0
  46. data/leafy-logger/lib/leafy/logger.rb +1 -0
  47. data/leafy-logger/lib/leafy/logger/appender_factories.rb +89 -0
  48. data/leafy-logger/lib/leafy/logger/factory.rb +141 -0
  49. data/leafy-logger/lib/leafy/logger/version.rb +6 -0
  50. data/leafy-logger/spec/appender_factories_spec.rb +147 -0
  51. data/leafy-logger/spec/factory_spec.rb +176 -0
  52. data/leafy-logger/spec/logging.yml +16 -0
  53. data/leafy-logger/spec/setup.rb +2 -0
  54. data/leafy-metrics/.gitignore +5 -0
  55. data/leafy-metrics/Gemfile +7 -0
  56. data/leafy-metrics/LICENSE +22 -0
  57. data/leafy-metrics/README.md +221 -0
  58. data/leafy-metrics/Rakefile +14 -0
  59. data/leafy-metrics/leafy-metrics.gemspec +29 -0
  60. data/leafy-metrics/lib/leafy-metrics.rb +2 -0
  61. data/leafy-metrics/lib/leafy-metrics_jars.rb +5 -0
  62. data/leafy-metrics/lib/leafy/metrics.rb +2 -0
  63. data/leafy-metrics/lib/leafy/metrics/console_reporter.rb +32 -0
  64. data/leafy-metrics/lib/leafy/metrics/csv_reporter.rb +26 -0
  65. data/leafy-metrics/lib/leafy/metrics/graphite/graphite.rb +28 -0
  66. data/leafy-metrics/lib/leafy/metrics/graphite/graphite_reporter.rb +43 -0
  67. data/leafy-metrics/lib/leafy/metrics/registry.rb +108 -0
  68. data/leafy-metrics/lib/leafy/metrics/reporter.rb +51 -0
  69. data/leafy-metrics/lib/leafy/metrics/version.rb +6 -0
  70. data/leafy-metrics/spec/console_reporter_spec.rb +72 -0
  71. data/leafy-metrics/spec/csv_reporter_spec.rb +75 -0
  72. data/leafy-metrics/spec/graphite_reporter_spec.rb +72 -0
  73. data/leafy-metrics/spec/graphite_spec.rb +23 -0
  74. data/leafy-metrics/spec/registry_spec.rb +106 -0
  75. data/leafy-metrics/spec/setup.rb +10 -0
  76. data/leafy-rack/.gitignore +4 -0
  77. data/leafy-rack/Gemfile +10 -0
  78. data/leafy-rack/LICENSE +22 -0
  79. data/leafy-rack/README.md +155 -0
  80. data/leafy-rack/Rakefile +14 -0
  81. data/{leafy-rack.gemspec → leafy-rack/leafy-rack.gemspec} +2 -2
  82. data/{lib → leafy-rack/lib}/leafy-rack.rb +0 -0
  83. data/{lib → leafy-rack/lib}/leafy-rack_jars.rb +0 -0
  84. data/{lib → leafy-rack/lib}/leafy/instrumented/basic_instrumented.rb +0 -0
  85. data/{lib → leafy-rack/lib}/leafy/instrumented/instrumented.rb +0 -0
  86. data/{lib → leafy-rack/lib}/leafy/json/health_writer.rb +0 -0
  87. data/{lib → leafy-rack/lib}/leafy/json/json_writer.rb +0 -0
  88. data/{lib → leafy-rack/lib}/leafy/json/metrics_writer.rb +0 -0
  89. data/{lib → leafy-rack/lib}/leafy/rack.rb +0 -0
  90. data/{lib → leafy-rack/lib}/leafy/rack/admin.rb +0 -0
  91. data/{lib → leafy-rack/lib}/leafy/rack/health.rb +0 -0
  92. data/{lib → leafy-rack/lib}/leafy/rack/instrumented.rb +0 -0
  93. data/{lib → leafy-rack/lib}/leafy/rack/metrics.rb +0 -0
  94. data/{lib → leafy-rack/lib}/leafy/rack/ping.rb +0 -0
  95. data/{lib → leafy-rack/lib}/leafy/rack/thread_dump.rb +0 -0
  96. data/{lib → leafy-rack/lib}/leafy/rack/version.rb +1 -1
  97. data/{spec → leafy-rack/spec}/admin_rack_spec.rb +0 -0
  98. data/{spec → leafy-rack/spec}/basic_instrumented_spec.rb +0 -0
  99. data/{spec → leafy-rack/spec}/health_rack_spec.rb +0 -0
  100. data/{spec → leafy-rack/spec}/health_writer_spec.rb +0 -0
  101. data/{spec → leafy-rack/spec}/instrumented_rack_spec.rb +0 -0
  102. data/{spec → leafy-rack/spec}/instrumented_spec.rb +0 -0
  103. data/{spec → leafy-rack/spec}/metrics_rack_spec.rb +0 -0
  104. data/{spec → leafy-rack/spec}/metrics_writer_spec.rb +0 -0
  105. data/{spec → leafy-rack/spec}/ping_rack_spec.rb +0 -0
  106. data/{spec → leafy-rack/spec}/setup.rb +0 -0
  107. data/{spec → leafy-rack/spec}/thread_dump_spec.rb +0 -0
  108. metadata +110 -34
File without changes
@@ -0,0 +1,32 @@
1
+ #-*- mode: ruby -*-
2
+
3
+ require File.expand_path( '../lib/leafy/logger/version', __FILE__ )
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'leafy-logger'
7
+ s.version = Leafy::Logger::VERSION
8
+ s.author = 'christian meier'
9
+ s.email = [ 'christian.meier@lookout.com' ]
10
+
11
+ s.license = 'MIT'
12
+ s.summary = %q(adding logback to leafy)
13
+ s.homepage = 'https://github.com/lookout/leafy'
14
+ s.description = %q(adding logback to leafy with yaml configuration and bridges to log4j and jul)
15
+
16
+ s.files = `git ls-files`.split($/)
17
+
18
+ # exclude the dependencies which come with jruby itself
19
+ # TODO needs something in jar-dependencies since those jruby dependencies can
20
+ # be different from version to version
21
+
22
+ s.requirements << 'jar io.dropwizard:dropwizard-logging, 0.8.0-rc5, [ joda-time:joda-time ]'
23
+ s.requirements << 'jar io.dropwizard:dropwizard-configuration, 0.8.0-rc5, [ org.yaml:snakeyaml ]'
24
+
25
+ s.add_runtime_dependency 'jar-dependencies', '~> 0.1.8'
26
+ s.add_runtime_dependency 'leafy-metrics', "~> #{Leafy::Rack::VERSION}"
27
+ s.add_development_dependency 'rspec', '~> 3.1.0'
28
+ s.add_development_dependency 'yard', '~> 0.8.7'
29
+ s.add_development_dependency 'rake', '~> 10.2'
30
+ end
31
+
32
+ # vim: syntax=Ruby
@@ -0,0 +1 @@
1
+ require 'leafy-logger_jars'
@@ -0,0 +1,33 @@
1
+ # this is a generated file, to avoid over-writing it just delete this comment
2
+ require 'jar_dependencies'
3
+
4
+ require_jar( 'org.slf4j', 'log4j-over-slf4j', '1.7.10' )
5
+ require_jar( 'com.google.guava', 'guava', '18.0' )
6
+ require_jar( 'org.slf4j', 'jul-to-slf4j', '1.7.10' )
7
+ require_jar( 'io.dropwizard', 'dropwizard-logging', '0.8.0-rc5' )
8
+ require_jar( 'org.slf4j', 'jcl-over-slf4j', '1.7.10' )
9
+ require_jar( 'org.jboss.logging', 'jboss-logging', '3.1.3.GA' )
10
+ require_jar( 'io.dropwizard', 'dropwizard-util', '0.8.0-rc5' )
11
+ require_jar( 'com.fasterxml.jackson.datatype', 'jackson-datatype-jdk7', '2.5.1' )
12
+ require_jar( 'org.apache.commons', 'commons-lang3', '3.3.2' )
13
+ require_jar( 'javax.validation', 'validation-api', '1.1.0.Final' )
14
+ require_jar( 'com.fasterxml.jackson.datatype', 'jackson-datatype-joda', '2.5.1' )
15
+ require_jar( 'com.fasterxml', 'classmate', '1.0.0' )
16
+ require_jar( 'org.hibernate', 'hibernate-validator', '5.1.3.Final' )
17
+ require_jar( 'org.eclipse.jetty', 'jetty-util', '9.2.9.v20150224' )
18
+ require_jar( 'io.dropwizard', 'dropwizard-configuration', '0.8.0-rc5' )
19
+ require_jar( 'com.fasterxml.jackson.datatype', 'jackson-datatype-guava', '2.5.1' )
20
+ require_jar( 'io.dropwizard', 'dropwizard-jackson', '0.8.0-rc5' )
21
+ require_jar( 'com.fasterxml.jackson.dataformat', 'jackson-dataformat-yaml', '2.5.1' )
22
+ require_jar( 'org.glassfish', 'javax.el', '3.0.0' )
23
+ require_jar( 'com.fasterxml.jackson.core', 'jackson-databind', '2.5.1' )
24
+ require_jar( 'ch.qos.logback', 'logback-classic', '1.1.2' )
25
+ require_jar( 'com.google.code.findbugs', 'jsr305', '3.0.0' )
26
+ require_jar( 'com.fasterxml.jackson.core', 'jackson-core', '2.5.1' )
27
+ require_jar( 'io.dropwizard.metrics', 'metrics-logback', '3.1.0' )
28
+ require_jar( 'io.dropwizard', 'dropwizard-validation', '0.8.0-rc5' )
29
+ require_jar( 'org.slf4j', 'slf4j-api', '1.7.10' )
30
+ require_jar( 'ch.qos.logback', 'logback-core', '1.1.2' )
31
+ require_jar( 'com.fasterxml.jackson.module', 'jackson-module-afterburner', '2.5.1' )
32
+ require_jar( 'com.fasterxml.jackson.core', 'jackson-annotations', '2.5.0' )
33
+ require_jar( 'io.dropwizard.metrics', 'metrics-core', '3.1.0' )
@@ -0,0 +1 @@
1
+ require 'leafy-logger_jars'
@@ -0,0 +1,89 @@
1
+ require 'leafy/logger'
2
+ module Leafy
3
+ module Logger
4
+ module AppenderFactory
5
+
6
+ def threshold
7
+ super.to_s
8
+ end
9
+
10
+ def threshold= t
11
+ super Java::ChQosLogbackClassic::Level.const_get( t.to_s.upcase )
12
+ end
13
+
14
+ def attributes
15
+ self.methods.select { |m| m.to_s =~ /^set_/ }.collect { |m| m.to_s.sub( /^set_/, '' ) }
16
+ end
17
+
18
+ module ClassMethods
19
+ def new( *args, &block )
20
+ if block
21
+ f = new( *args )
22
+ f.instance_eval( &block )
23
+ f
24
+ else
25
+ super
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ class Java::IoDropwizardLogging::FileAppenderFactory
32
+
33
+ include AppenderFactory
34
+ extend AppenderFactory::ClassMethods
35
+
36
+ def initialize( file = nil )
37
+ super()
38
+ if file
39
+ self.current_log_filename = file
40
+ self.archive = false
41
+ end
42
+ end
43
+ end
44
+ FileAppenderFactory = Java::IoDropwizardLogging::FileAppenderFactory
45
+
46
+ class Java::IoDropwizardLogging::ConsoleAppenderFactory
47
+
48
+ include AppenderFactory
49
+ extend AppenderFactory::ClassMethods
50
+
51
+ alias :_target :target
52
+ def target( arg = nil )
53
+ if arg
54
+ self.target = arg
55
+ else
56
+ _target.to_s
57
+ end
58
+ end
59
+
60
+ alias :_target= :target=
61
+ def target= t
62
+ self._target = Java::IoDropwizardLogging::ConsoleAppenderFactory::ConsoleStream.value_of( t.to_s.upcase )
63
+ end
64
+ end
65
+ ConsoleAppenderFactory = Java::IoDropwizardLogging::ConsoleAppenderFactory
66
+
67
+
68
+ class Java::IoDropwizardLogging::SyslogAppenderFactory
69
+
70
+ include AppenderFactory
71
+ extend AppenderFactory::ClassMethods
72
+
73
+ def self.all_facilities
74
+ Java::IoDropwizardLogging::SyslogAppenderFactory::Facility.values.collect { |f| f.to_s }
75
+ end
76
+
77
+ alias :_facility :facility
78
+ def facility
79
+ _facility.to_s
80
+ end
81
+
82
+ alias :_facility= :facility=
83
+ def facility= t
84
+ self._facility = Java::IoDropwizardLogging::SyslogAppenderFactory::Facility.value_of( t.to_s.upcase )
85
+ end
86
+ end
87
+ SyslogAppenderFactory = Java::IoDropwizardLogging::SyslogAppenderFactory
88
+ end
89
+ end
@@ -0,0 +1,141 @@
1
+ require 'leafy/logger'
2
+ require 'leafy/logger/appender_factories'
3
+ require 'yaml'
4
+ require 'stringio'
5
+ require 'jruby/synchronized'
6
+
7
+ module Leafy
8
+ module Logger
9
+ class Factory
10
+ include JRuby::Synchronized
11
+
12
+ class HashSourceProvider
13
+ include Java::IoDropwizardConfiguration::ConfigurationSourceProvider
14
+
15
+ def initialize( config )
16
+ @config = config
17
+ end
18
+
19
+ def open(path)
20
+ StringIO.new( @config.to_yaml ).to_inputstream
21
+ end
22
+ end
23
+
24
+ def self.get_logger( name )
25
+ org.slf4j.LoggerFactory.get_logger name
26
+ end
27
+
28
+ def self.bootstrap
29
+ Java::IoDropwizardLogging::LoggingFactory.bootstrap
30
+ end
31
+
32
+ def self.configurator
33
+ objectMapper = Java::IoDropwizardJackson::Jackson.newObjectMapper
34
+ validator = javax.validation.Validation.buildDefaultValidatorFactory.validator
35
+ Java::IoDropwizardConfiguration::ConfigurationFactory.new( Java::IoDropwizardLogging::LoggingFactory.java_class, validator, objectMapper, "" )
36
+ end
37
+
38
+ def self.new_from_options( options )
39
+ new( configurator.build( HashSourceProvider.new( options ), 'dummy') )
40
+ end
41
+
42
+ def self.new_from_yaml( yamlfile )
43
+ raise "no such file #{yamlfile}" unless File.exists?( yamlfile )
44
+ new( configurator.build( java.io.File.new( yamlfile ) ) )
45
+ end
46
+
47
+ def initialize( factory = nil )
48
+ @factory = factory || Java::IoDropwizardLogging::LoggingFactory.new
49
+ end
50
+
51
+ def reconfigure_from_options( options )
52
+ do_reconfigure( self.class.configurator.build( HashSourceProvider.new( options ), 'dummy') )
53
+ end
54
+
55
+ def reconfigure_from_yaml( yamlfile )
56
+ raise "no such file #{yamlfile}" unless File.exists?( yamlfile )
57
+ do_reconfigure( self.class.configurator.build( java.io.File.new( yamlfile ) ) )
58
+ end
59
+
60
+ def do_reconfigure( factory )
61
+ @factory.stop
62
+ @factory = factory
63
+ reconfigure
64
+ end
65
+ private :do_reconfigure
66
+
67
+ def level args = nil
68
+ if args
69
+ self.level = args
70
+ else
71
+ @factory.level.to_s
72
+ end
73
+ end
74
+
75
+ def level_set level
76
+ l = level.to_s.upcase
77
+ @factory.level = Java::ChQosLogbackClassic::Level.const_get( l )
78
+ end
79
+ private :level_set
80
+
81
+ def level= level
82
+ l = level.to_s.upcase
83
+ @factory.level = Java::ChQosLogbackClassic::Level.const_get( l )
84
+ reconfigure
85
+ end
86
+
87
+ def appenders( *args )
88
+ if args.size > 0
89
+ self.appenders = args
90
+ else
91
+ @factory.appenders.to_a
92
+ end
93
+ end
94
+
95
+ def appenders= args
96
+ @factory.appenders = args
97
+ reconfigure
98
+ end
99
+
100
+ def loggers( map = nil )
101
+ if map
102
+ self.loggers = map
103
+ else
104
+ Hash[ @factory.loggers.collect {|k,v| [k, v.to_s ] } ]
105
+ end
106
+ end
107
+
108
+ def []=( name, level )
109
+ m = @factory.loggers.to_hash
110
+ m[ name ] = level
111
+ self.loggers = m
112
+ end
113
+
114
+ def loggers_set map
115
+ m = {}
116
+ map.each { |k,v| m[k] = Java::ChQosLogbackClassic::Level.const_get( v.to_s.upcase ) }
117
+ @factory.loggers = m
118
+ end
119
+ private :loggers_set
120
+
121
+ def loggers= map
122
+ loggers_set( map )
123
+ reconfigure
124
+ end
125
+
126
+ def configure( metrics, name )
127
+ @metrics = metrics
128
+ @name = name
129
+ reconfigure
130
+ end
131
+
132
+ def reconfigure
133
+ @factory.configure( @metrics.metrics, @name ) if @metrics
134
+ end
135
+
136
+ def stop
137
+ @factory.stop
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,6 @@
1
+ module Leafy
2
+ module Logger
3
+ VERSION = '0.3.1'.freeze
4
+ end
5
+ end
6
+
@@ -0,0 +1,147 @@
1
+ require_relative 'setup'
2
+ require 'leafy/metrics/registry'
3
+ require 'leafy/logger/factory'
4
+ require 'leafy/logger/appender_factories'
5
+ require 'fileutils'
6
+
7
+ describe Leafy::Logger do
8
+
9
+ let( :factory ) do
10
+ f = Leafy::Logger::Factory.new
11
+ f.level :debug
12
+ f.configure( Leafy::Metrics::Registry.new, 'tester' )
13
+ f
14
+ end
15
+
16
+ let( :logger ) { Leafy::Logger::Factory.get_logger 'ROOT' }
17
+
18
+ describe Leafy::Logger::ConsoleAppenderFactory do
19
+
20
+ subject do
21
+ Leafy::Logger::ConsoleAppenderFactory.new do
22
+ target 'STDOUT'
23
+ end
24
+ end
25
+
26
+ it 'can set the target' do
27
+ expect(subject.target).to eq 'STDOUT'
28
+
29
+ subject.target = 'STDERR'
30
+ expect(subject.target).to eq 'STDERR'
31
+ end
32
+ end
33
+
34
+ describe Leafy::Logger::SyslogAppenderFactory do
35
+
36
+ subject do
37
+ Leafy::Logger::SyslogAppenderFactory.new
38
+ end
39
+
40
+ it 'can use default configuration with syslog' do
41
+
42
+ factory.appenders subject
43
+
44
+ logger.debug( 'debug' )
45
+ logger.info( 'info' )
46
+
47
+ factory.stop
48
+
49
+ if not system("netstat -uln |grep :514")
50
+ last = File.read( '/var/log/syslog' ).split( /\n/ ).last
51
+ expect(last).to match /info$/
52
+ end
53
+ end
54
+
55
+ it 'can configure syslog' do
56
+ subject.port = 514
57
+ subject.include_stack_trace = false
58
+ subject.host = '127.0.0.1'
59
+ subject.facility = :auth
60
+ subject.stack_trace_prefix = '__'
61
+ subject.threshold = :debug
62
+
63
+ factory.appenders subject
64
+
65
+ logger.debug( 'debug' )
66
+ logger.info( 'info', java.lang.Exception.new( 'help me' ) )
67
+
68
+ factory.stop
69
+
70
+ if not system("netstat -uln |grep :514") and File.exist?( '/var/log/auth.log' )
71
+ last = File.read( '/var/log/auth.log' ).split( /\n/ ).last
72
+ expect(last).to match /info$/
73
+ end
74
+ end
75
+ end
76
+
77
+ describe Leafy::Logger::FileAppenderFactory do
78
+
79
+ subject do
80
+ Leafy::Logger::FileAppenderFactory.new
81
+ end
82
+
83
+ let( :log ) { File.join( File.dirname( __FILE__ ), 'test.log' ) }
84
+
85
+ before { FileUtils.rm_f log }
86
+ after { FileUtils.rm_f log }
87
+
88
+ it 'can be configured with single file' do
89
+ subject.current_log_filename = log
90
+ subject.archive = false
91
+ subject.threshold = 'INFO'
92
+ subject.log_format = "%-5p [%d{ISO8601,UTC}] %c: %m%n%ex"
93
+
94
+ factory.appenders subject
95
+ logger.debug( 'debug' )
96
+ logger.info( 'info', java.lang.Exception.new( 'help' ) )
97
+
98
+ factory.stop
99
+
100
+ lines = File.read( log ).split( /\n/ )
101
+ lines.each do |line|
102
+ expect( line ).to match /^INFO.*info|^!.*help|^!.*at/
103
+ end
104
+ end
105
+
106
+ it 'can be configured via block' do
107
+ l = log
108
+ s = subject.class.new do
109
+ self.current_log_filename = l
110
+ self.archive = false
111
+ self.threshold = 'DEBUG'
112
+ self.log_format = "%-5p [%d{ISO8601,UTC}] %c: %m%n%rEx"
113
+ end
114
+
115
+ factory.appenders s
116
+ logger.debug( 'debug' )
117
+ logger.info( 'info', java.lang.Exception.new( 'help' ) )
118
+
119
+ factory.stop
120
+
121
+ lines = File.read( log ).split( /\n/ )
122
+ lines.each do |line|
123
+ expect( line ).to match /^INFO.*info|^DEBUG.*debug|^!.*help|^!.*at/
124
+ end
125
+ end
126
+
127
+ it 'can be configured with archived files' do
128
+ subject.current_log_filename = log
129
+ subject.archived_log_filename_pattern = "#{log}-%d.gz"
130
+ subject.archived_file_count = 2
131
+ subject.threshold = 'DEBUG'
132
+ subject.log_format = "%-5p [%d{ISO8601,UTC}] %c: %m%n%rEx"
133
+
134
+ factory.appenders subject
135
+
136
+ logger.debug( 'debug' )
137
+ logger.info( 'info', java.lang.Exception.new( 'help' ) )
138
+
139
+ factory.stop
140
+
141
+ lines = File.read( log ).split( /\n/ )
142
+ lines.each do |line|
143
+ expect( line ).to match /^INFO.*info|^DEBUG.*debug|^!.*help|^!.*at/
144
+ end
145
+ end
146
+ end
147
+ end