semantic_logger 4.6.0.beta1 → 4.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +7 -7
  4. data/lib/semantic_logger.rb +23 -22
  5. data/lib/semantic_logger/appender.rb +32 -33
  6. data/lib/semantic_logger/appender/async.rb +9 -8
  7. data/lib/semantic_logger/appender/async_batch.rb +4 -2
  8. data/lib/semantic_logger/appender/bugsnag.rb +7 -7
  9. data/lib/semantic_logger/appender/elasticsearch.rb +10 -10
  10. data/lib/semantic_logger/appender/elasticsearch_http.rb +4 -4
  11. data/lib/semantic_logger/appender/file.rb +2 -1
  12. data/lib/semantic_logger/appender/graylog.rb +15 -10
  13. data/lib/semantic_logger/appender/honeybadger.rb +3 -3
  14. data/lib/semantic_logger/appender/http.rb +20 -18
  15. data/lib/semantic_logger/appender/kafka.rb +5 -5
  16. data/lib/semantic_logger/appender/mongodb.rb +6 -6
  17. data/lib/semantic_logger/appender/new_relic.rb +2 -2
  18. data/lib/semantic_logger/appender/rabbitmq.rb +5 -5
  19. data/lib/semantic_logger/appender/sentry.rb +7 -7
  20. data/lib/semantic_logger/appender/splunk.rb +5 -5
  21. data/lib/semantic_logger/appender/splunk_http.rb +3 -4
  22. data/lib/semantic_logger/appender/syslog.rb +20 -14
  23. data/lib/semantic_logger/appender/tcp.rb +5 -5
  24. data/lib/semantic_logger/appender/udp.rb +2 -2
  25. data/lib/semantic_logger/appenders.rb +11 -11
  26. data/lib/semantic_logger/base.rb +42 -18
  27. data/lib/semantic_logger/formatters.rb +11 -11
  28. data/lib/semantic_logger/formatters/base.rb +8 -3
  29. data/lib/semantic_logger/formatters/color.rb +10 -6
  30. data/lib/semantic_logger/formatters/default.rb +18 -5
  31. data/lib/semantic_logger/formatters/fluentd.rb +3 -3
  32. data/lib/semantic_logger/formatters/json.rb +1 -1
  33. data/lib/semantic_logger/formatters/raw.rb +31 -7
  34. data/lib/semantic_logger/formatters/signalfx.rb +10 -9
  35. data/lib/semantic_logger/formatters/syslog.rb +7 -6
  36. data/lib/semantic_logger/formatters/syslog_cee.rb +7 -6
  37. data/lib/semantic_logger/jruby/garbage_collection_logger.rb +4 -2
  38. data/lib/semantic_logger/levels.rb +9 -7
  39. data/lib/semantic_logger/log.rb +52 -60
  40. data/lib/semantic_logger/logger.rb +6 -8
  41. data/lib/semantic_logger/metric/new_relic.rb +3 -3
  42. data/lib/semantic_logger/metric/signalfx.rb +3 -3
  43. data/lib/semantic_logger/metric/statsd.rb +7 -7
  44. data/lib/semantic_logger/processor.rb +7 -5
  45. data/lib/semantic_logger/reporters/minitest.rb +4 -4
  46. data/lib/semantic_logger/semantic_logger.rb +24 -11
  47. data/lib/semantic_logger/subscriber.rb +6 -5
  48. data/lib/semantic_logger/sync.rb +12 -0
  49. data/lib/semantic_logger/sync_processor.rb +43 -0
  50. data/lib/semantic_logger/utils.rb +6 -6
  51. data/lib/semantic_logger/version.rb +1 -1
  52. metadata +7 -5
@@ -1,7 +1,7 @@
1
1
  begin
2
- require 'honeybadger'
2
+ require "honeybadger"
3
3
  rescue LoadError
4
- raise 'Gem honeybadger is required for logging purposes. Please add the gem "honeybadger" to your Gemfile.'
4
+ raise LoadError, 'Gem honeybadger is required for logging purposes. Please add the gem "honeybadger" to your Gemfile.'
5
5
  end
6
6
 
7
7
  # Send log messages to honeybadger
@@ -48,7 +48,7 @@ module SemanticLogger
48
48
  context.delete(:exception)
49
49
  ::Honeybadger.notify(log.exception, context)
50
50
  else
51
- message = {
51
+ message = {
52
52
  error_class: context.delete(:name),
53
53
  error_message: context.delete(:message),
54
54
  context: context
@@ -1,8 +1,8 @@
1
- require 'net/http'
2
- require 'uri'
3
- require 'socket'
4
- require 'json'
5
- require 'openssl'
1
+ require "net/http"
2
+ require "uri"
3
+ require "socket"
4
+ require "json"
5
+ require "openssl"
6
6
 
7
7
  # Log to any HTTP(S) server that accepts log messages in JSON form
8
8
  #
@@ -101,27 +101,29 @@ module SemanticLogger
101
101
  @continue_timeout = continue_timeout
102
102
 
103
103
  # On Ruby v2.0 and greater, Net::HTTP.new already uses a persistent connection if the server allows it
104
- @header = {
105
- 'Accept' => 'application/json',
106
- 'Content-Type' => 'application/json',
107
- 'Connection' => 'keep-alive',
108
- 'Keep-Alive' => '300'
104
+ @header = {
105
+ "Accept" => "application/json",
106
+ "Content-Type" => "application/json",
107
+ "Connection" => "keep-alive",
108
+ "Keep-Alive" => "300"
109
109
  }
110
- @header['Content-Encoding'] = 'gzip' if @compress
110
+ @header["Content-Encoding"] = "gzip" if @compress
111
111
 
112
112
  uri = URI.parse(@url)
113
113
  @server = uri.host
114
- raise(ArgumentError, "Invalid format for :url: #{@url.inspect}. Should be similar to: 'http://hostname:port/path'") unless @server
114
+ unless @server
115
+ raise(ArgumentError, "Invalid format for :url: #{@url.inspect}. Should be similar to: 'http://hostname:port/path'")
116
+ end
115
117
 
116
118
  @port = uri.port
117
119
  @username = uri.user if !@username && uri.user
118
120
  @password = uri.password if !@password && uri.password
119
121
  @path = uri.path
120
122
  # Path cannot be empty
121
- @path = '/' if @path == ''
123
+ @path = "/" if @path == ""
122
124
 
123
- if uri.scheme == 'https'
124
- @ssl_options[:use_ssl] = true
125
+ if uri.scheme == "https"
126
+ @ssl_options[:use_ssl] = true
125
127
  @ssl_options[:verify_mode] ||= OpenSSL::SSL::VERIFY_PEER
126
128
  @port ||= HTTP.https_default_port
127
129
  else
@@ -205,16 +207,16 @@ module SemanticLogger
205
207
  end
206
208
  request.basic_auth(@username, @password) if @username
207
209
  response = @http.request(request)
208
- if response.code == '200' || response.code == '201'
210
+ if response.code == "200" || response.code == "201"
209
211
  true
210
212
  else
211
213
  # Failures are logged to the global semantic logger failsafe logger (Usually stderr or file)
212
214
  logger.error("Bad HTTP response from: #{url} code: #{response.code}, #{response.body}")
213
215
  false
214
216
  end
215
- rescue RuntimeError => exc
217
+ rescue RuntimeError => e
216
218
  reopen
217
- raise exc
219
+ raise e
218
220
  end
219
221
  end
220
222
  end
@@ -1,10 +1,10 @@
1
1
  begin
2
- require 'kafka'
2
+ require "kafka"
3
3
  rescue LoadError
4
- raise 'Gem ruby-kafka is required for logging to Elasticsearch. Please add the gem "ruby-kafka" to your Gemfile.'
4
+ raise LoadError, 'Gem ruby-kafka is required for logging to Elasticsearch. Please add the gem "ruby-kafka" to your Gemfile.'
5
5
  end
6
6
 
7
- require 'date'
7
+ require "date"
8
8
 
9
9
  # Forward all log messages to Apache Kafka.
10
10
  #
@@ -115,9 +115,9 @@ module SemanticLogger
115
115
  # metrics: [Boolean]
116
116
  # Send metrics only events to kafka.
117
117
  # Default: true
118
- def initialize(seed_brokers:, client_id: 'semantic-logger', connect_timeout: nil, socket_timeout: nil,
118
+ def initialize(seed_brokers:, client_id: "semantic-logger", connect_timeout: nil, socket_timeout: nil,
119
119
  ssl_ca_cert: nil, ssl_client_cert: nil, ssl_client_cert_key: nil,
120
- topic: 'log_messages', partition: nil, partition_key: nil, key: nil,
120
+ topic: "log_messages", partition: nil, partition_key: nil, key: nil,
121
121
  delivery_threshold: 100, delivery_interval: 10,
122
122
  metrics: true, **args, &block)
123
123
 
@@ -1,8 +1,8 @@
1
- require 'socket'
1
+ require "socket"
2
2
  begin
3
- require 'mongo'
3
+ require "mongo"
4
4
  rescue LoadError
5
- raise 'Gem mongo is required for logging to MongoDB. Please add the gem "mongo" v2.0 or greater to your Gemfile.'
5
+ raise LoadError, 'Gem mongo is required for logging to MongoDB. Please add the gem "mongo" v2.0 or greater to your Gemfile.'
6
6
  end
7
7
 
8
8
  module SemanticLogger
@@ -104,9 +104,9 @@ module SemanticLogger
104
104
  # Name of this application to appear in log messages.
105
105
  # Default: SemanticLogger.application
106
106
  def initialize(uri:,
107
- collection_name: 'semantic_logger',
107
+ collection_name: "semantic_logger",
108
108
  write_concern: 0,
109
- collection_size: 1024 ** 3,
109
+ collection_size: 1024**3,
110
110
  collection_max: nil,
111
111
  **args,
112
112
  &block)
@@ -118,7 +118,7 @@ module SemanticLogger
118
118
  size: collection_size,
119
119
  write: {w: write_concern}
120
120
  }
121
- @options[:max] = collection_max if collection_max
121
+ @options[:max] = collection_max if collection_max
122
122
 
123
123
  reopen
124
124
 
@@ -1,7 +1,7 @@
1
1
  begin
2
- require 'newrelic_rpm'
2
+ require "newrelic_rpm"
3
3
  rescue LoadError
4
- raise 'Gem newrelic_rpm is required for logging to New Relic. Please add the gem "newrelic_rpm" to your Gemfile.'
4
+ raise LoadError, 'Gem newrelic_rpm is required for logging to New Relic. Please add the gem "newrelic_rpm" to your Gemfile.'
5
5
  end
6
6
 
7
7
  # Send log messages to NewRelic
@@ -1,7 +1,7 @@
1
1
  begin
2
- require 'bunny'
2
+ require "bunny"
3
3
  rescue LoadError
4
- raise 'Gem bunny is required for logging to RabbitMQ. Please add the gem "bunny" to your Gemfile.'
4
+ raise LoadError, 'Gem bunny is required for logging to RabbitMQ. Please add the gem "bunny" to your Gemfile.'
5
5
  end
6
6
 
7
7
  # Forward all log messages to RabbitMQ.
@@ -14,7 +14,7 @@ end
14
14
  # # Name of the queue in RabbitMQ where to publish the logs. This queue will be bound to "amqp.direct" exchange.
15
15
  # queue: 'semantic_logger',
16
16
  #
17
- # # This host will be used for RabbitMQ connection.
17
+ # # This host will be used for RabbitMQ connection.
18
18
  # # NOTE this is different than :host option which is used by the logger directly.
19
19
  # rabbitmq_host: '127.0.0.1',
20
20
  #
@@ -63,7 +63,7 @@ module SemanticLogger
63
63
  # RabbitMQ Parameters:
64
64
  #
65
65
  # rabbitmq_host: [String]
66
- # Host for AMQP connection. in Bunny this is called :host but here it has
66
+ # Host for AMQP connection. in Bunny this is called :host but here it has
67
67
  # been remapped to avoid conflicting with SemanticLogger's :host param.
68
68
  # Default: localhost
69
69
  #
@@ -76,7 +76,7 @@ module SemanticLogger
76
76
  # Default: nil
77
77
  #
78
78
  # more parameters supported by Bunny: http://rubybunny.info/articles/connecting.html
79
- def initialize(queue_name: 'semantic_logger', rabbitmq_host: nil, metrics: false, **args, &block)
79
+ def initialize(queue_name: "semantic_logger", rabbitmq_host: nil, metrics: false, **args, &block)
80
80
  @queue_name = queue_name
81
81
  @rabbitmq_args = args.dup
82
82
  @rabbitmq_args[:host] = rabbitmq_host
@@ -1,7 +1,7 @@
1
1
  begin
2
- require 'sentry-raven'
2
+ require "sentry-raven"
3
3
  rescue LoadError
4
- raise 'Gem sentry-raven is required for logging purposes. Please add the gem "sentry-raven" to your Gemfile.'
4
+ raise LoadError, 'Gem sentry-raven is required for logging purposes. Please add the gem "sentry-raven" to your Gemfile.'
5
5
  end
6
6
 
7
7
  # Send log messages to sentry
@@ -46,12 +46,12 @@ module SemanticLogger
46
46
  # Send an error notification to sentry
47
47
  def log(log)
48
48
  # Ignore logs coming from Raven itself
49
- return false if log.name == 'Raven'
49
+ return false if log.name == "Raven"
50
50
 
51
- context = formatter.call(log, self)
52
- user = context.delete(:user)
53
- tags = context.delete(:tags)
54
- attrs = {
51
+ context = formatter.call(log, self)
52
+ user = context.delete(:user)
53
+ tags = context.delete(:tags)
54
+ attrs = {
55
55
  level: context.delete(:level),
56
56
  extra: context
57
57
  }
@@ -1,7 +1,7 @@
1
1
  begin
2
- require 'splunk-sdk-ruby'
2
+ require "splunk-sdk-ruby"
3
3
  rescue LoadError
4
- raise 'Gem splunk-sdk-ruby is required for logging to Splunk. Please add the gem "splunk-sdk-ruby" to your Gemfile.'
4
+ raise LoadError, 'Gem splunk-sdk-ruby is required for logging to Splunk. Please add the gem "splunk-sdk-ruby" to your Gemfile.'
5
5
  end
6
6
 
7
7
  # Splunk log appender.
@@ -88,7 +88,7 @@ module SemanticLogger
88
88
  # regular expression. All other messages will be ignored.
89
89
  # Proc: Only include log messages where the supplied Proc returns true
90
90
  # The Proc must return true or false.
91
- def initialize(index: 'main', source_type: nil, **args, &block)
91
+ def initialize(index: "main", source_type: nil, **args, &block)
92
92
  @index = index
93
93
  @source_type = source_type
94
94
 
@@ -120,7 +120,7 @@ module SemanticLogger
120
120
  def call(log, logger)
121
121
  h = SemanticLogger::Formatters::Raw.new.call(log, logger)
122
122
  h.delete(:time)
123
- message = {
123
+ message = {
124
124
  source: logger.application,
125
125
  host: logger.host,
126
126
  time: log.time.utc.to_f,
@@ -128,7 +128,7 @@ module SemanticLogger
128
128
  event: h
129
129
  }
130
130
  message[:environment] = logger.environment if logger.environment
131
- message[:sourcetype] = source_type if source_type
131
+ message[:sourcetype] = source_type if source_type
132
132
  message
133
133
  end
134
134
  end
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require "json"
2
2
  # Splunk log appender using the Splunk HTTP(S) listener.
3
3
  #
4
4
  # Use the newer, faster and more complete JSON over HTTP interface for Splunk.
@@ -81,13 +81,13 @@ module SemanticLogger
81
81
  super(compress: compress, **args, &block)
82
82
 
83
83
  # Put splunk auth token in the header of every HTTP post.
84
- @header['Authorization'] = "Splunk #{token}"
84
+ @header["Authorization"] = "Splunk #{token}"
85
85
  end
86
86
 
87
87
  # Returns [String] JSON to send to Splunk.
88
88
  #
89
89
  # For splunk format requirements see:
90
- # http://dev.splunk.com/view/event-collector/SP-CAAAE6P
90
+ # https://docs.splunk.com/Documentation/Splunk/latest/Data/FormateventsforHTTPEventCollector
91
91
  def call(log, logger)
92
92
  h = SemanticLogger::Formatters::Raw.new(time_format: :seconds).call(log, logger)
93
93
  message = {
@@ -96,7 +96,6 @@ module SemanticLogger
96
96
  time: h.delete(:time),
97
97
  event: h
98
98
  }
99
- message[:environment] = logger.environment if logger.environment
100
99
  message[:sourcetype] = source_type if source_type
101
100
  message[:index] = index if index
102
101
  message.to_json
@@ -1,6 +1,6 @@
1
- require 'syslog'
2
- require 'uri'
3
- require 'socket'
1
+ require "syslog"
2
+ require "uri"
3
+ require "socket"
4
4
  # Send log messages to local syslog, or remote syslog servers over TCP or UDP.
5
5
  #
6
6
  # Example:
@@ -31,7 +31,7 @@ require 'socket'
31
31
  module SemanticLogger
32
32
  module Appender
33
33
  class Syslog < SemanticLogger::Subscriber
34
- attr_reader :remote_syslog, :url, :server, :port, :protocol, :facility, :options, :level_map
34
+ attr_reader :remote_syslog, :url, :server, :port, :protocol, :facility, :options, :level_map, :max_size
35
35
 
36
36
  # Create a Syslog appender instance.
37
37
  #
@@ -73,6 +73,10 @@ module SemanticLogger
73
73
  # Identity of the program.
74
74
  # Default: SemanticLogger.application
75
75
  #
76
+ # max_size: [Integer]
77
+ # Set your own packet size.
78
+ # Default: 1024 bytes
79
+ #
76
80
  # options: [Integer]
77
81
  # Default: ::Syslog::LOG_PID | ::Syslog::LOG_CONS
78
82
  # Any of the following (options can be logically OR'd together)
@@ -119,8 +123,9 @@ module SemanticLogger
119
123
  # Example:
120
124
  # # Change the warn level to LOG_NOTICE level instead of a the default of LOG_WARNING.
121
125
  # SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE})
122
- def initialize(url: 'syslog://localhost',
126
+ def initialize(url: "syslog://localhost",
123
127
  facility: ::Syslog::LOG_USER,
128
+ max_size: 1024,
124
129
  level_map: SemanticLogger::Formatters::Syslog::LevelMap.new,
125
130
  options: ::Syslog::LOG_PID | ::Syslog::LOG_CONS,
126
131
  tcp_client: {},
@@ -129,13 +134,14 @@ module SemanticLogger
129
134
 
130
135
  @options = options
131
136
  @facility = facility
137
+ @max_size = max_size
132
138
  @level_map = level_map
133
139
  @url = url
134
140
  uri = URI(@url)
135
- @server = uri.host || 'localhost'
141
+ @server = uri.host || "localhost"
136
142
  @protocol = (uri.scheme || :syslog).to_sym
137
143
  @port = uri.port || 514
138
- @server = 'localhost' if @protocol == :syslog
144
+ @server = "localhost" if @protocol == :syslog
139
145
  @tcp_client_options = tcp_client
140
146
 
141
147
  raise "Unknown protocol #{@protocol}!" unless %i[syslog tcp udp].include?(@protocol)
@@ -143,17 +149,17 @@ module SemanticLogger
143
149
  # The syslog_protocol gem is required when logging over TCP or UDP.
144
150
  if %i[tcp udp].include?(@protocol)
145
151
  begin
146
- require 'syslog_protocol'
152
+ require "syslog_protocol"
147
153
  rescue LoadError
148
- raise 'Missing gem: syslog_protocol. This gem is required when logging over TCP or UDP. To fix this error: gem install syslog_protocol'
154
+ raise LoadError, "Missing gem: syslog_protocol. This gem is required when logging over TCP or UDP. To fix this error: gem install syslog_protocol"
149
155
  end
150
156
 
151
157
  # The net_tcp_client gem is required when logging over TCP.
152
158
  if protocol == :tcp
153
159
  begin
154
- require 'net/tcp_client'
160
+ require "net/tcp_client"
155
161
  rescue LoadError
156
- raise 'Missing gem: net_tcp_client. This gem is required when logging over TCP. To fix this error: gem install net_tcp_client'
162
+ raise LoadError, "Missing gem: net_tcp_client. This gem is required when logging over TCP. To fix this error: gem install net_tcp_client"
157
163
  end
158
164
  end
159
165
  end
@@ -171,7 +177,7 @@ module SemanticLogger
171
177
  ::Syslog.send(method, application, options, facility)
172
178
  when :tcp
173
179
  @tcp_client_options[:server] = "#{@server}:#{@port}"
174
- @remote_syslog = Net::TCPClient.new(@tcp_client_options)
180
+ @remote_syslog = Net::TCPClient.new(**@tcp_client_options)
175
181
  # Use the local logger for @remote_syslog so errors with the remote logger can be recorded locally.
176
182
  @remote_syslog.logger = logger
177
183
  when :udp
@@ -186,7 +192,7 @@ module SemanticLogger
186
192
  case @protocol
187
193
  when :syslog
188
194
  # Since the Ruby Syslog API supports sprintf format strings, double up all existing '%'
189
- message = formatter.call(log, self).gsub '%', '%%'
195
+ message = formatter.call(log, self).gsub "%", "%%"
190
196
  ::Syslog.log @level_map[log.level], message
191
197
  when :tcp
192
198
  @remote_syslog.retry_on_connection_failure { @remote_syslog.write("#{formatter.call(log, self)}\r\n") }
@@ -209,7 +215,7 @@ module SemanticLogger
209
215
  # Format is text output without the time
210
216
  SemanticLogger::Formatters::Default.new(time_format: nil)
211
217
  else
212
- SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map)
218
+ SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map, max_size: max_size)
213
219
  end
214
220
  end
215
221
  end
@@ -1,10 +1,10 @@
1
1
  begin
2
- require 'net/tcp_client'
2
+ require "net/tcp_client"
3
3
  rescue LoadError
4
- raise 'Gem net_tcp_client is required for logging over TCP. Please add the gem "net_tcp_client" to your Gemfile.'
4
+ raise LoadError, 'Gem net_tcp_client is required for logging over TCP. Please add the gem "net_tcp_client" to your Gemfile.'
5
5
  end
6
6
 
7
- raise 'Net::TCPClient v2.0 or greater is required to log over TCP' unless Net::TCPClient::VERSION.to_f >= 2.0
7
+ raise "Net::TCPClient v2.0 or greater is required to log over TCP" unless Net::TCPClient::VERSION.to_f >= 2.0
8
8
 
9
9
  module SemanticLogger
10
10
  module Appender
@@ -189,7 +189,7 @@ module SemanticLogger
189
189
 
190
190
  # Use the internal logger so that errors with remote logging are only written locally.
191
191
  Net::TCPClient.logger = logger
192
- Net::TCPClient.logger.name = 'Net::TCPClient'
192
+ Net::TCPClient.logger.name = "Net::TCPClient"
193
193
 
194
194
  super(level: level, formatter: formatter, filter: filter, application: application, environment: environment, host: host, &block)
195
195
  reopen
@@ -198,7 +198,7 @@ module SemanticLogger
198
198
  # After forking an active process call #reopen to re-open the handles to resources.
199
199
  def reopen
200
200
  close
201
- @tcp_client = Net::TCPClient.new(@tcp_client_args)
201
+ @tcp_client = Net::TCPClient.new(**@tcp_client_args)
202
202
  end
203
203
 
204
204
  # Write the log using the specified protocol and server.
@@ -1,4 +1,4 @@
1
- require 'socket'
1
+ require "socket"
2
2
  module SemanticLogger
3
3
  module Appender
4
4
  # UDP log appender.
@@ -74,7 +74,7 @@ module SemanticLogger
74
74
  def reopen
75
75
  close
76
76
  @socket = UDPSocket.new
77
- host, port = server.split(':')
77
+ host, port = server.split(":")
78
78
  @socket.connect(host, port.to_i)
79
79
  end
80
80
 
@@ -18,8 +18,8 @@ module SemanticLogger
18
18
  each do |appender|
19
19
  begin
20
20
  appender.log(log) if appender.should_log?(log)
21
- rescue Exception => exc
22
- logger.error "Failed to log to appender: #{appender.inspect}", exc
21
+ rescue Exception => e
22
+ logger.error "Failed to log to appender: #{appender.name}", e
23
23
  end
24
24
  end
25
25
  end
@@ -29,11 +29,11 @@ module SemanticLogger
29
29
  begin
30
30
  logger.trace "Flushing appender: #{appender.name}"
31
31
  appender.flush
32
- rescue Exception => exc
33
- logger.error "Failed to flush appender: #{appender.inspect}", exc
32
+ rescue Exception => e
33
+ logger.error "Failed to flush appender: #{appender.name}", e
34
34
  end
35
35
  end
36
- logger.trace 'All appenders flushed'
36
+ logger.trace "All appenders flushed"
37
37
  end
38
38
 
39
39
  def close
@@ -43,11 +43,11 @@ module SemanticLogger
43
43
  appender.flush
44
44
  appender.close
45
45
  delete(appender)
46
- rescue Exception => exc
47
- logger.error "Failed to close appender: #{appender.inspect}", exc
46
+ rescue Exception => e
47
+ logger.error "Failed to close appender: #{appender.name}", e
48
48
  end
49
49
  end
50
- logger.trace 'All appenders closed and removed from appender list'
50
+ logger.trace "All appenders closed and removed from appender list"
51
51
  end
52
52
 
53
53
  # After a fork the appender thread is not running, start it if it is not running.
@@ -58,11 +58,11 @@ module SemanticLogger
58
58
 
59
59
  logger.trace "Reopening appender: #{appender.name}"
60
60
  appender.reopen
61
- rescue Exception => exc
62
- logger.error "Failed to re-open appender: #{appender.inspect}", exc
61
+ rescue Exception => e
62
+ logger.error "Failed to re-open appender: #{appender.name}", e
63
63
  end
64
64
  end
65
- logger.trace 'All appenders re-opened'
65
+ logger.trace "All appenders re-opened"
66
66
  end
67
67
  end
68
68
  end