superlogger 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d6fc0c35cbd0c13cb78cab56470fd4e052dbfb0
4
- data.tar.gz: 018b9488e84e2c6fb89ce167bfd164ddd27fa2a2
3
+ metadata.gz: 52724b7d98cc75fccce223481570e66ac3ed8681
4
+ data.tar.gz: 4a2c3f821bb6826a1d6488bb60514fadd56c9473
5
5
  SHA512:
6
- metadata.gz: 7e9e122a303d23436eb3e098166e1400569dbeb4c91383b65181e5763a9cbe69440303a2a55b4030fc7e4db7329494b3de1c681612e982d164cbcb538dee4098
7
- data.tar.gz: 1b73567f9b724ee95d4488a44a431e7801f96f4902d276d8e296840b8535da131eb115bceb2a8a0872a40d051490a582e7dd2bbef416088129e19d87699be654
6
+ metadata.gz: 51c34a0592ca4695d12705b0346694fb107c0d1d1a6ffe97e334b53daad1c2e9b80b7faac53a9db433d07321a9b20e37c98302fed35c29b602df00fe2998dcec
7
+ data.tar.gz: 3b63620e49aa82e43fc00d9c318e189b941708db2fdf8bf93b7537770f917f94f094e4601b9e473913417cf2afd678b5b071c1f8d04963fa98c056d6e4f774b6
data/README.md CHANGED
@@ -5,77 +5,88 @@
5
5
  Superlogger - Machine-readable logging for Rails
6
6
  =======
7
7
 
8
- Rails' default request logging is easy to read for humans but difficult for log aggregators such as Kibana, Graylog and Splunk. Superlogger transforms the logs into key-value pairs for easy parsing and adds useful details like Timestamp and Session ID for tracing purposes.
8
+ Rails' default request logging is easy to read for humans but difficult for log aggregators such as Kibana, Graylog and Splunk. Superlogger transforms the logs into key-value pairs for easy parsing and adds useful details like Timestamp, Session ID and Request ID for tracing purposes.
9
9
 
10
10
  Default rails logging:
11
11
  ```sh
12
- Started GET "/home/index" for ::1 at 2016-04-11 16:23:27 +0800
12
+ Started GET "/home/index" for ::1 at 2016-04-29 17:31:12 +0800
13
13
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
14
14
  Processing by HomeController#index as HTML
15
- Something Load (0.2ms) SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 [["paper", "123"], ["stone", "456"]]
15
+ Something Load (0.1ms) SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 [["paper", "123"], ["stone", "456"]]
16
16
  Rendered home/_partial.html.erb (0.2ms)
17
- Rendered home/index.html.erb within layouts/application (5.2ms)
18
- Completed 200 OK in 283ms (Views: 271.6ms | ActiveRecord: 0.6ms)
17
+ Rendered home/index.html.erb within layouts/application (3.4ms)
18
+ Completed 200 OK in 135ms (Views: 130.7ms | ActiveRecord: 0.3ms)
19
19
 
20
- Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-04-11 16:23:27 +0800
20
+ Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-04-29 17:31:12 +0800
21
+
22
+ Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2016-04-29 17:31:12 +0800
21
23
 
22
- Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2016-04-11 16:23:27 +0800
23
24
  ```
24
25
 
25
26
  Machine-readable logging with Superlogger:
26
27
  ```sh
27
- 2016-04-11 16:18:22.279 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
28
- 2016-04-11 16:18:22.293 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
29
- 2016-04-11 16:18:22.305 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.48
30
- 2016-04-11 16:18:22.316 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.3
31
- 2016-04-11 16:18:22.316 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=5.6
32
- 2016-04-11 16:18:22.541 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=247.16 | view_duration=235.25 | db_duration=0.78
28
+ # first request
29
+ 2016-04-29 17:29:45.841 | 12dc0e484869 | 68d63a8cf920 | I | superlogger_middleware:30 | method=GET | path=/home/index | ip=::1
30
+ 2016-04-29 17:29:45.847 | 12dc0e484869 | 68d63a8cf920 | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
31
+ 2016-04-29 17:29:45.852 | 12dc0e484869 | 68d63a8cf920 | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["123", "456"] | duration=0.13
32
+ 2016-04-29 17:29:45.861 | 12dc0e484869 | 68d63a8cf920 | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.2
33
+ 2016-04-29 17:29:45.861 | 12dc0e484869 | 68d63a8cf920 | D | action_view_log_subscriber:6 | view=index.html.erb | duration=3.2
34
+ 2016-04-29 17:29:45.983 | 12dc0e484869 | 68d63a8cf920 | I | action_controller_log_subscriber:29 | status=200 | total_duration=135.92 | view_duration=130.38 | db_duration=0.33
35
+
36
+ # second request
37
+ 2016-04-29 17:39:54.879 | 12dc0e484869 | e463d380fb63 | I | superlogger_middleware:30 | method=GET | path=/home/show | ip=::1
38
+ 2016-04-29 17:39:54.879 | 12dc0e484869 | e463d380fb63 | D | action_controller_log_subscriber:9 | controller=HomeController | action=show | params={}
39
+ 2016-04-29 17:39:54.882 | 12dc0e484869 | e463d380fb63 | D | action_view_log_subscriber:6 | view=show.html.erb | duration=0.2
40
+ 2016-04-29 17:39:54.884 | 12dc0e484869 | e463d380fb63 | I | action_controller_log_subscriber:29 | status=200 | total_duration=4.64 | view_duration=4.55 | db_duration=0.0
33
41
  ```
34
42
 
35
43
  ## Features ##
36
44
  - Timestamp (milliseconds)
37
- - Session ID for logs across requests
38
- - Key-value pairs for log data
39
- - Muting of assets logging
40
- - File and line numbers
41
- - Recording of IP address
45
+ - Session ID for logs belonging to the same user session (notice above that both the requests have the same session id)
46
+ - Request ID for logs belonging to the same page request (notice above that each request have a different request id)
47
+ - Hashes will be logged as key-value pairs automatically
48
+ - Requests for assets will not be logged
49
+ - File and line numbers
50
+ - IP address of request
42
51
 
43
52
  ## Installation ##
44
53
 
45
54
  Add superlogger to your application's Gemfile
46
-
47
55
  ```ruby
48
56
  gem "superlogger"
49
57
  ```
50
58
 
51
- And then execute:
52
-
59
+ Execute:
53
60
  ```sh
54
61
  $ bundle
55
62
  ```
56
63
 
64
+ And add the following in `config/application.rb`
65
+ ```ruby
66
+ config.logger = Superlogger::Logger.new(STDOUT)
67
+ ```
68
+
57
69
  ## Usage ##
58
70
 
59
- ```ruby
60
- require 'superlogger'
71
+ Log as per normal using `Rails.logger`.
61
72
 
73
+ ```ruby
62
74
  class SomeClass
63
- include Superlogger
64
-
65
75
  def some_method
66
- Logger.debug name:'john', age: '21'
67
- Logger.info name:'john', age: '21'
68
- Logger.warn name:'john', age: '21'
69
- Logger.error name:'john', age: '21'
70
- Logger.fatal name:'john', age: '21'
76
+ Rails.logger.debug foo:'true', bar: 'false'
77
+ Rails.logger.info foo:'true', bar: 'false'
78
+ Rails.logger.warn foo:'true', bar: 'false'
79
+ Rails.logger.error foo:'true', bar: 'false'
80
+ Rails.logger.fatal foo:'true', bar: 'false'
71
81
  end
72
82
  end
73
83
  ```
74
84
 
75
- ## Output Format ##
85
+ ## Log Format ##
76
86
  ```sh
77
- 2015-03-26 23:37:38.086 | 970298669a40 | I | log_subscriber:24 | status:200 | total:858.35 | view:597.46 | db:34.96
78
- < timestamp > | < session id > | < severity > | < file >:< line num > | < data you pass in ... >
87
+ 2015-03-26 23:37:38.086 | 12dc0e484869 | e463d380fb63 | I | action_controller_log_subscriber:29 | status=200 | total_duration=4.64 | view_duration=4.55 | db_duration=0.0
88
+ < timestamp > | < session id > | < request id > | < severity > | < file >:< line num > | < data you pass in ... >
89
+ < 23 chars > | < 12 chars > | <12 chars > | < 1 char > | < ? chars > | < ? chars >
79
90
  ```
80
91
 
81
92
  ### Severity Levels ###
@@ -6,7 +6,7 @@ module Superlogger
6
6
  def start_processing(event)
7
7
  payload = event.payload
8
8
 
9
- Logger.debug controller: payload[:controller], action: payload[:action], params: payload[:params].except(*INTERNAL_PARAMS)
9
+ logger.debug controller: payload[:controller], action: payload[:action], params: payload[:params].except(*INTERNAL_PARAMS)
10
10
  end
11
11
 
12
12
  # end of controller action
@@ -16,7 +16,7 @@ module Superlogger
16
16
  if payload[:exception]
17
17
  status = ActionDispatch::ExceptionWrapper.status_code_for_exception(payload[:exception][0])
18
18
 
19
- Logger.fatal status: status, exception: payload[:exception]
19
+ logger.fatal status: status, exception: payload[:exception]
20
20
  else
21
21
  # Assume status 401 if action finishes without status code and no exception
22
22
  # https://github.com/pcg79/devise/commit/1e2dab3c0ce49efe2b5940c15f47388c69d6731b
@@ -26,7 +26,7 @@ module Superlogger
26
26
  view_duration = payload[:view_runtime].to_f.round(2) if payload.key?(:view_runtime)
27
27
  db_duration = payload[:db_runtime].to_f.round(2) if payload.key?(:db_runtime)
28
28
 
29
- Logger.info status: payload[:status], total_duration: total_duration, view_duration: view_duration, db_duration: db_duration
29
+ logger.info status: payload[:status], total_duration: total_duration, view_duration: view_duration, db_duration: db_duration
30
30
  end
31
31
  end
32
32
  end
@@ -3,7 +3,7 @@ module Superlogger
3
3
  def render_template(event)
4
4
  payload = event.payload
5
5
 
6
- Logger.debug view: payload[:identifier].split('/').last, duration: event.duration.round(1)
6
+ logger.debug view: payload[:identifier].split('/').last, duration: event.duration.round(1)
7
7
  end
8
8
  alias :render_partial :render_template
9
9
  alias :render_collection :render_template
@@ -19,9 +19,9 @@ module Superlogger
19
19
  return if IGNORE_PAYLOAD_NAMES.include?(payload[:name])
20
20
 
21
21
  sql = payload[:sql]
22
- params = payload[:binds].map { |_, value| "'#{value}'"}
22
+ params = payload[:binds].map { |_, value| value.to_s }
23
23
 
24
- Logger.debug sql: sql, params: params, duration: event.duration.round(2)
24
+ logger.debug sql: sql, params: params, duration: event.duration.round(2)
25
25
  end
26
26
  end
27
27
  end
@@ -1,80 +1,62 @@
1
1
  require 'request_store'
2
2
 
3
3
  module Superlogger
4
- module Logger
5
- def self.session_id=(session_id)
6
- RequestStore.store[:superlogger_session_id] = session_id
4
+ class Logger < ActiveSupport::Logger
5
+ def initialize(*args)
6
+ super
7
+ @formatter = SimpleFormatter.new
7
8
  end
8
9
 
9
- def self.session_id
10
- RequestStore.store[:superlogger_session_id] || "NS-#{Thread.current.object_id}"
11
- end
10
+ def format_message(severity, time, _progname, msg)
11
+ return nil if msg.blank? # Silence nil and empty msg
12
+ return nil if is_rails_rack_logger_msg?(msg) # Silence rack logger msg
12
13
 
13
- def self.debug(*args)
14
- Rails.logger.debug { format_msg(args) }
15
- end
14
+ timestamp = time.strftime('%Y-%m-%d %H:%M:%S.%L')
15
+ session_id = Superlogger.session_id[0..11]
16
+ request_id = Superlogger.request_id[0..11]
17
+ severity = severity.to_s.upcase[0]
18
+ caller_location = get_caller_location
19
+ args = format_args(msg)
16
20
 
17
- def self.info(*args)
18
- Rails.logger.info { format_msg(args) }
21
+ "#{timestamp} | #{session_id} | #{request_id} | #{severity} | #{caller_location} | #{args}\n"
19
22
  end
20
23
 
21
- def self.warn(*args)
22
- Rails.logger.warn { format_msg(args) }
23
- end
24
-
25
- def self.error(*args)
26
- Rails.logger.error { format_msg(args) }
27
- end
28
-
29
- def self.fatal(*args)
30
- Rails.logger.fatal { format_msg(args) }
31
- end
32
-
33
- private
34
-
35
- def self.format_msg(args)
36
- "#{get_caller_location} | #{format_args(args)}"
24
+ def is_rails_rack_logger_msg?(msg)
25
+ msg =~ /Started (GET|POST|PUT|PATCH|DELETE)/
37
26
  end
38
27
 
39
- def self.get_caller_location
40
- # Find the last method call on Superlogger::Logger
41
- count = 0
42
- location_index = caller_locations(0).find_index do |location|
43
- count += 1 if location && location.path.include?('superlogger/logger.rb')
44
- count == 4
45
- end
46
-
47
- # Add 1 to get the caller of the logger
48
- location = caller_locations(location_index + 1).first
28
+ def get_caller_location
29
+ index = caller_locations(4, 1).first.label.include?('broadcast') ? 6 : 5
30
+ location = caller_locations(index, 1).first
49
31
 
50
- # extract filename without file extension from location.path
32
+ # Extract filename without file extension from location.path
51
33
  # eg. superlogger/lib/superlogger/logger.rb
52
34
  file = location.path.split('/').last.split('.').first
53
35
 
54
36
  "#{file}:#{location.lineno}"
55
37
  end
56
38
 
57
- def self.format_args(args)
58
- # format args in key=value pair, separated by pipes
59
- args.map do |arg|
60
- arg = {nil: arg} unless arg.is_a?(Hash)
39
+ def format_args(args)
40
+ output = if args.is_a?(Hash)
41
+ # Format args in key=value pair, separated by pipes
42
+ args.map do |key, value|
43
+ "#{key}=#{value}"
44
+ end.join(' | ')
45
+ else
46
+ args.to_s
47
+ end
61
48
 
62
- arg.map do |key, value|
63
- "#{key}=#{value}"
64
- end
65
- end.flatten.join(' | ')
49
+ output.gsub("\n", '\\n') # Escape newlines
66
50
  end
67
- end
68
- end
69
51
 
70
- # for overriding default Rails Logger format
71
- class Logger
72
- def format_message(severity, time, _progname, msg)
73
- timestamp = time.strftime('%Y-%m-%d %H:%M:%S.%L')
74
- session_id = Superlogger::Logger.session_id[0..11]
75
- severity = severity.to_s.upcase[0]
76
- msg.to_s.gsub!("\n", '\\n') # escape newlines
77
-
78
- "#{timestamp} | #{session_id} | #{severity} | #{msg}\n"
52
+ # To silence double logging when running `rails server` in development mode
53
+ # See: https://github.com/rails/rails/commit/3d10d9d6c3b831fe9632c43a0ffec46104f912a7
54
+ if Rails.env.development?
55
+ class SimpleFormatter < ::Logger::Formatter
56
+ def call(_severity, _timestamp, _progname, _msg)
57
+ nil
58
+ end
59
+ end
60
+ end
79
61
  end
80
62
  end
@@ -1,5 +1,5 @@
1
1
  module Superlogger
2
- class Middleware
2
+ class SuperloggerMiddleware
3
3
  def initialize(app)
4
4
  @app = app
5
5
  end
@@ -7,7 +7,7 @@ module Superlogger
7
7
  def call(env)
8
8
  request = ActionDispatch::Request.new(env)
9
9
 
10
- # only process the actual request, less the assets
10
+ # only process actual requests, less the assets
11
11
  if request.path.start_with?('/assets/') == false
12
12
  process_request(request)
13
13
  end
@@ -21,11 +21,13 @@ module Superlogger
21
21
  request.env['rack.session'].send(:load!) unless request.env['rack.session'].id
22
22
 
23
23
  # Store session id before any actual logging is done
24
- Superlogger::Logger.session_id = request.env['rack.session'].id
24
+ Superlogger.session_id = request.env['rack.session'].id
25
25
  end
26
26
 
27
+ Superlogger.request_id = SecureRandom.hex
28
+
27
29
  # Start of request logging
28
- Logger.info method: request.method, path: request.fullpath, ip: request.ip
30
+ Rails.logger.info method: request.method, path: request.fullpath, ip: request.ip
29
31
  end
30
32
  end
31
33
  end
@@ -1,3 +1,3 @@
1
1
  module Superlogger
2
- VERSION = "0.0.2"
2
+ VERSION = '0.1.0'
3
3
  end
data/lib/superlogger.rb CHANGED
@@ -5,43 +5,37 @@ module Superlogger
5
5
  module_function
6
6
 
7
7
  def setup(app)
8
- overwrite_rails_rack_logger
9
- overwrite_action_dispatch_debug_exceptions
10
8
  insert_superlogger_middleware(app)
11
- detach_all_existing_log_subscribers
9
+ detach_existing_log_subscribers
12
10
  attach_superlogger_log_subscribers
13
11
  end
14
12
 
15
- def overwrite_rails_rack_logger
16
- require 'superlogger/rails_rack_logger'
17
- end
18
-
19
- def overwrite_action_dispatch_debug_exceptions
20
- require 'superlogger/action_dispatch_debug_exceptions'
21
- end
22
-
23
13
  def insert_superlogger_middleware(app)
24
- require 'superlogger/middleware'
14
+ require 'superlogger/superlogger_middleware'
25
15
 
26
16
  # important to insert after session middleware so we can get the session id
27
- app.middleware.use Superlogger::Middleware
17
+ app.middleware.use Superlogger::SuperloggerMiddleware
28
18
  end
29
19
 
30
- def detach_all_existing_log_subscribers
20
+ def detach_existing_log_subscribers
31
21
  # force log subscribers to attach first so we can remove them all
32
22
  require 'action_controller/log_subscriber'
33
23
  require 'active_record/log_subscriber'
34
24
  require 'action_view/log_subscriber'
35
- require 'action_mailer/log_subscriber'
36
25
 
37
26
  # remove log subscribers
27
+ patterns = %w(sql.active_record
28
+ start_processing.action_controller
29
+ process_action.action_controller
30
+ render_template.action_view
31
+ render_partial.action_view
32
+ render_collection.action_view)
33
+
38
34
  ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
39
35
  subscriber.patterns.each do |pattern|
40
- ActiveSupport::Notifications.unsubscribe pattern
36
+ ActiveSupport::Notifications.unsubscribe pattern if patterns.include?(pattern)
41
37
  end
42
38
  end
43
-
44
- ActiveSupport::LogSubscriber.log_subscribers.clear
45
39
  end
46
40
 
47
41
  def attach_superlogger_log_subscribers
@@ -49,6 +43,22 @@ module Superlogger
49
43
  require 'superlogger/action_view_log_subscriber'
50
44
  require 'superlogger/active_record_log_subscriber'
51
45
  end
46
+
47
+ def session_id=(session_id)
48
+ RequestStore.store[:superlogger_session_id] = session_id
49
+ end
50
+
51
+ def session_id
52
+ RequestStore.store[:superlogger_session_id] || "NS-#{Thread.current.object_id}"
53
+ end
54
+
55
+ def request_id=(request_id)
56
+ RequestStore.store[:superlogger_request_id] = request_id
57
+ end
58
+
59
+ def request_id
60
+ RequestStore.store[:superlogger_request_id] || "NR-#{Thread.current.object_id}"
61
+ end
52
62
  end
53
63
 
54
64
  require 'superlogger/railtie' if defined?(Rails)
@@ -20,6 +20,7 @@ module Dummy
20
20
 
21
21
  # Do not swallow errors in after_commit/after_rollback callbacks.
22
22
  config.active_record.raise_in_transactional_callbacks = true
23
+
24
+ config.logger = Superlogger::Logger.new(STDOUT)
23
25
  end
24
26
  end
25
-
@@ -324,3 +324,222 @@ ZeroDivisionError (divided by 0):
324
324
  2016-04-19 15:48:20.537 | b48534ea049a | D | action_view_log_subscriber:6 | view=_trace.html.erb | duration=3.4
325
325
  2016-04-19 15:48:20.553 | b48534ea049a | D | action_view_log_subscriber:6 | view=_request_and_response.html.erb | duration=1.2
326
326
  2016-04-19 15:48:20.553 | b48534ea049a | D | action_view_log_subscriber:6 | view=diagnostics.html.erb | duration=54.2
327
+ 2016-04-24 22:38:11.606 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
328
+ 2016-04-24 22:38:11.620 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
329
+ 2016-04-24 22:38:11.635 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.1
330
+ 2016-04-24 22:38:11.636 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=15.88 | view_duration=15.7 | db_duration=0.0
331
+ 2016-04-25 18:33:47.569 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
332
+ 2016-04-25 18:33:47.582 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
333
+ 2016-04-25 18:33:47.596 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.2
334
+ 2016-04-25 18:33:47.597 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=14.76 | view_duration=14.55 | db_duration=0.0
335
+ 2016-04-25 18:34:45.554 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
336
+ 2016-04-25 18:34:45.556 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
337
+ 2016-04-25 18:34:45.558 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
338
+ 2016-04-25 18:34:45.559 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=2.89 | view_duration=2.71 | db_duration=0.0
339
+ 2016-04-25 18:34:46.338 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
340
+ 2016-04-25 18:34:46.339 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
341
+ 2016-04-25 18:34:46.343 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
342
+ 2016-04-25 18:34:46.343 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=3.56 | view_duration=3.34 | db_duration=0.0
343
+ 2016-04-25 18:34:46.891 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
344
+ 2016-04-25 18:34:46.893 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
345
+ 2016-04-25 18:34:46.896 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
346
+ 2016-04-25 18:34:46.897 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=3.85 | view_duration=3.66 | db_duration=0.0
347
+ 2016-04-25 18:40:34.341 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
348
+ 2016-04-25 18:40:34.342 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
349
+ 2016-04-25 18:40:34.345 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
350
+ 2016-04-25 18:40:34.345 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=2.73 | view_duration=2.61 | db_duration=0.0
351
+ 2016-04-25 18:40:34.603 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
352
+ 2016-04-25 18:40:34.604 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
353
+ 2016-04-25 18:40:34.608 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
354
+ 2016-04-25 18:40:34.609 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=4.03 | view_duration=3.81 | db_duration=0.0
355
+ 2016-04-25 18:40:34.784 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
356
+ 2016-04-25 18:40:34.785 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
357
+ 2016-04-25 18:40:34.789 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.2
358
+ 2016-04-25 18:40:34.790 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=4.01 | view_duration=3.84 | db_duration=0.0
359
+ 2016-04-25 18:40:34.940 | b48534ea049a | I | middleware:28 | method=GET | path=/ | ip=::1
360
+ 2016-04-25 18:40:34.941 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
361
+ 2016-04-25 18:40:34.945 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
362
+ 2016-04-25 18:40:34.945 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=3.64 | view_duration=3.47 | db_duration=0.0
363
+ 2016-04-25 18:41:17.843 | b48534ea049a | I | middleware:28 | method=GET | path=/%20/sdf | ip=::1
364
+ 2016-04-25 18:41:17.844 | b48534ea049a | W | action_dispatch_debug_exceptions:6 | routing_error="/%20/sdf"
365
+ 2016-04-25 18:41:17.901 | b48534ea049a | D | action_view_log_subscriber:6 | view=_trace.html.erb | duration=1.5
366
+ 2016-04-25 18:41:17.923 | b48534ea049a | D | action_view_log_subscriber:6 | view=_route.html.erb | duration=1.1
367
+ 2016-04-25 18:41:17.951 | b48534ea049a | D | action_view_log_subscriber:6 | view=_table.html.erb | duration=10.9
368
+ 2016-04-25 18:41:17.970 | b48534ea049a | D | action_view_log_subscriber:6 | view=_request_and_response.html.erb | duration=1.6
369
+ 2016-04-25 18:41:17.970 | b48534ea049a | D | action_view_log_subscriber:6 | view=routing_error.html.erb | duration=92.3
370
+ 2016-04-25 18:41:43.521 | b48534ea049a | I | middleware:28 | method=GET | path=/?params=a%20b | ip=::1
371
+ 2016-04-25 18:41:43.523 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={"params"=>"a b"}
372
+ 2016-04-25 18:41:43.527 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
373
+ 2016-04-25 18:41:43.527 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=4.13 | view_duration=3.96 | db_duration=0.0
374
+ 2016-04-25 18:42:37.245 | b48534ea049a | I | middleware:28 | method=GET | path=/?params=a%20b | ip=::1
375
+ 2016-04-25 18:42:37.247 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={"params"=>"a b"}
376
+ 2016-04-25 18:42:37.250 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
377
+ 2016-04-25 18:42:37.251 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=3.07 | view_duration=2.92 | db_duration=0.0
378
+ 2016-04-25 18:42:39.710 | b48534ea049a | I | middleware:28 | method=GET | path=/?params=a%20b | ip=::1
379
+ 2016-04-25 18:42:39.711 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={"params"=>"a b"}
380
+ 2016-04-25 18:42:39.714 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
381
+ 2016-04-25 18:42:39.715 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=3.37 | view_duration=3.12 | db_duration=0.0
382
+ 2016-04-25 18:43:01.160 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
383
+ 2016-04-25 18:43:01.197 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
384
+ 2016-04-25 18:43:01.221 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.66
385
+ 2016-04-25 18:43:01.222 | b48534ea049a | F | action_controller_log_subscriber:19 | status=500 | exception=["NoMethodError", "undefined method `info' for Logger:Class"]
386
+ 2016-04-25 18:43:01.224 | b48534ea049a | F | debug_exceptions:92 | \nNoMethodError (undefined method `info' for Logger:Class):\n app/controllers/home_controller.rb:4:in `index'\n\n
387
+ 2016-04-25 18:43:01.422 | b48534ea049a | D | action_view_log_subscriber:6 | view=_source.erb | duration=5.9
388
+ 2016-04-25 18:43:01.444 | b48534ea049a | D | action_view_log_subscriber:6 | view=_trace.html.erb | duration=2.8
389
+ 2016-04-25 18:43:01.471 | b48534ea049a | D | action_view_log_subscriber:6 | view=_request_and_response.html.erb | duration=3.6
390
+ 2016-04-25 18:43:01.472 | b48534ea049a | D | action_view_log_subscriber:6 | view=diagnostics.html.erb | duration=73.7
391
+ 2016-04-25 18:43:13.032 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
392
+ 2016-04-25 18:43:13.046 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
393
+ 2016-04-25 18:43:13.051 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.39
394
+ 2016-04-25 18:43:13.051 | b48534ea049a | I | home_controller:5 | abc=s n
395
+ 2016-04-25 18:43:13.065 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.6
396
+ 2016-04-25 18:43:13.066 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=6.1
397
+ 2016-04-25 18:43:13.445 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=398.82 | view_duration=393.26 | db_duration=0.87
398
+ 2016-04-25 18:43:30.940 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
399
+ 2016-04-25 18:43:30.942 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
400
+ 2016-04-25 18:43:30.943 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.15
401
+ 2016-04-25 18:43:30.944 | b48534ea049a | I | home_controller:5 | abc=s n
402
+ 2016-04-25 18:43:30.949 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
403
+ 2016-04-25 18:43:30.950 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=1.7
404
+ 2016-04-25 18:43:30.957 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=14.84 | view_duration=12.45 | db_duration=0.15
405
+ 2016-04-25 18:51:39.653 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
406
+ 2016-04-25 18:51:39.654 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
407
+ 2016-04-25 18:51:39.655 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.17
408
+ 2016-04-25 18:51:39.656 | b48534ea049a | I | home_controller:5 | abc=s n
409
+ 2016-04-25 18:51:39.662 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.0
410
+ 2016-04-25 18:51:39.662 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=1.8
411
+ 2016-04-25 18:51:39.669 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=14.74 | view_duration=12.93 | db_duration=0.17
412
+ 2016-04-25 18:51:39.953 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
413
+ 2016-04-25 18:51:39.954 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
414
+ 2016-04-25 18:51:39.955 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.11
415
+ 2016-04-25 18:51:39.956 | b48534ea049a | I | home_controller:5 | abc=s n
416
+ 2016-04-25 18:51:39.965 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
417
+ 2016-04-25 18:51:39.966 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.4
418
+ 2016-04-25 18:51:39.975 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=20.27 | view_duration=18.39 | db_duration=0.11
419
+ 2016-04-25 18:51:40.097 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
420
+ 2016-04-25 18:51:40.098 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
421
+ 2016-04-25 18:51:40.099 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.13
422
+ 2016-04-25 18:51:40.100 | b48534ea049a | I | home_controller:5 | abc=s n
423
+ 2016-04-25 18:51:40.107 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
424
+ 2016-04-25 18:51:40.108 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.5
425
+ 2016-04-25 18:51:40.119 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=20.84 | view_duration=18.81 | db_duration=0.13
426
+ 2016-04-25 18:51:40.247 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
427
+ 2016-04-25 18:51:40.248 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
428
+ 2016-04-25 18:51:40.249 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.13
429
+ 2016-04-25 18:51:40.250 | b48534ea049a | I | home_controller:5 | abc=s n
430
+ 2016-04-25 18:51:40.255 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.0
431
+ 2016-04-25 18:51:40.256 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=1.7
432
+ 2016-04-25 18:51:40.260 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=12.15 | view_duration=10.37 | db_duration=0.13
433
+ 2016-04-25 18:53:21.048 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
434
+ 2016-04-25 18:53:21.049 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
435
+ 2016-04-25 18:53:21.050 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.2
436
+ 2016-04-25 18:53:21.051 | b48534ea049a | I | home_controller:5 | abc=s n
437
+ 2016-04-25 18:53:21.059 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.0
438
+ 2016-04-25 18:53:21.060 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.4
439
+ 2016-04-25 18:53:21.066 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=17.09 | view_duration=14.25 | db_duration=0.2
440
+ 2016-04-25 18:53:44.882 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
441
+ 2016-04-25 18:53:44.884 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
442
+ 2016-04-25 18:53:44.886 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.12
443
+ 2016-04-25 18:53:44.886 | b48534ea049a | I | home_controller:5 | abc=s n
444
+ 2016-04-25 18:53:44.892 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.0
445
+ 2016-04-25 18:53:44.892 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=1.6
446
+ 2016-04-25 18:53:44.898 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=13.69 | view_duration=11.12 | db_duration=0.12
447
+ 2016-04-25 18:53:46.165 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
448
+ 2016-04-25 18:53:46.166 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
449
+ 2016-04-25 18:53:46.168 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.14
450
+ 2016-04-25 18:53:46.169 | b48534ea049a | I | home_controller:5 | abc=s n
451
+ 2016-04-25 18:53:46.178 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
452
+ 2016-04-25 18:53:46.179 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=3.0
453
+ 2016-04-25 18:53:46.185 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=18.46 | view_duration=16.08 | db_duration=0.14
454
+ 2016-04-25 18:55:13.696 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
455
+ 2016-04-25 18:55:13.697 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
456
+ 2016-04-25 18:55:13.699 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.14
457
+ 2016-04-25 18:55:13.700 | b48534ea049a | I | home_controller:5 | abc=s n
458
+ 2016-04-25 18:55:13.706 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.0
459
+ 2016-04-25 18:55:13.707 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=1.8
460
+ 2016-04-25 18:55:13.714 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=16.04 | view_duration=13.47 | db_duration=0.14
461
+ 2016-04-25 18:55:14.773 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
462
+ 2016-04-25 18:55:14.775 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
463
+ 2016-04-25 18:55:14.777 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.15
464
+ 2016-04-25 18:55:14.777 | b48534ea049a | I | home_controller:5 | abc=s n
465
+ 2016-04-25 18:55:14.785 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
466
+ 2016-04-25 18:55:14.786 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.8
467
+ 2016-04-25 18:55:14.793 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=17.73 | view_duration=15.14 | db_duration=0.15
468
+ 2016-04-25 18:55:15.176 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
469
+ 2016-04-25 18:55:15.177 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
470
+ 2016-04-25 18:55:15.179 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.17
471
+ 2016-04-25 18:55:15.180 | b48534ea049a | I | home_controller:5 | abc=s n
472
+ 2016-04-25 18:55:15.187 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
473
+ 2016-04-25 18:55:15.188 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.6
474
+ 2016-04-25 18:55:15.193 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=15.42 | view_duration=12.53 | db_duration=0.17
475
+ 2016-04-25 18:55:16.193 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
476
+ 2016-04-25 18:55:16.194 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
477
+ 2016-04-25 18:55:16.195 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.12
478
+ 2016-04-25 18:55:16.196 | b48534ea049a | I | home_controller:5 | abc=s n
479
+ 2016-04-25 18:55:16.202 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
480
+ 2016-04-25 18:55:16.202 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.1
481
+ 2016-04-25 18:55:16.209 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=15.03 | view_duration=12.48 | db_duration=0.12
482
+ 2016-04-25 18:55:19.155 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
483
+ 2016-04-25 18:55:19.157 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
484
+ 2016-04-25 18:55:19.158 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.15
485
+ 2016-04-25 18:55:19.159 | b48534ea049a | I | home_controller:5 | abc=s n
486
+ 2016-04-25 18:55:19.168 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
487
+ 2016-04-25 18:55:19.169 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.7
488
+ 2016-04-25 18:55:19.179 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=21.96 | view_duration=19.38 | db_duration=0.15
489
+ 2016-04-26 10:05:43.270 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
490
+ 2016-04-26 10:05:43.277 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
491
+ 2016-04-26 10:05:43.283 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.65
492
+ 2016-04-26 10:05:43.284 | b48534ea049a | I | home_controller:5 | abc=s n
493
+ 2016-04-26 10:05:43.295 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
494
+ 2016-04-26 10:05:43.297 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=3.6
495
+ 2016-04-26 10:05:43.312 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=34.62 | view_duration=26.21 | db_duration=0.65
496
+ 2016-04-26 10:06:00.848 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index?sort=true | ip=::1
497
+ 2016-04-26 10:06:00.851 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={"sort"=>"true"}
498
+ 2016-04-26 10:06:00.855 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.15
499
+ 2016-04-26 10:06:00.857 | b48534ea049a | I | home_controller:5 | abc=s n
500
+ 2016-04-26 10:06:00.863 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.0
501
+ 2016-04-26 10:06:00.865 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.5
502
+ 2016-04-26 10:06:00.874 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=21.7 | view_duration=16.7 | db_duration=0.15
503
+ 2016-04-26 10:06:05.812 | b48534ea049a | I | middleware:28 | method=GET | path=/home/indexa | ip=::1
504
+ 2016-04-26 10:06:05.813 | b48534ea049a | W | action_dispatch_debug_exceptions:6 | routing_error="/home/indexa"
505
+ 2016-04-26 10:06:05.922 | b48534ea049a | D | action_view_log_subscriber:6 | view=_trace.html.erb | duration=4.6
506
+ 2016-04-26 10:06:05.951 | b48534ea049a | D | action_view_log_subscriber:6 | view=_route.html.erb | duration=2.5
507
+ 2016-04-26 10:06:05.978 | b48534ea049a | D | action_view_log_subscriber:6 | view=_table.html.erb | duration=3.5
508
+ 2016-04-26 10:06:06.002 | b48534ea049a | D | action_view_log_subscriber:6 | view=_request_and_response.html.erb | duration=2.7
509
+ 2016-04-26 10:06:06.003 | b48534ea049a | D | action_view_log_subscriber:6 | view=routing_error.html.erb | duration=118.8
510
+ 2016-04-26 10:11:16.267 | 39ec102f17fd | I | middleware:28 | method=GET | path=/home/index | ip=::1
511
+ 2016-04-26 10:11:16.277 | 39ec102f17fd | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
512
+ 2016-04-26 10:11:16.295 | 39ec102f17fd | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.91
513
+ 2016-04-26 10:11:16.297 | 39ec102f17fd | I | home_controller:5 | abc=s n
514
+ 2016-04-26 10:11:16.314 | 39ec102f17fd | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.2
515
+ 2016-04-26 10:11:16.318 | 39ec102f17fd | D | action_view_log_subscriber:6 | view=index.html.erb | duration=9.7
516
+ 2016-04-26 10:11:16.338 | 39ec102f17fd | I | action_controller_log_subscriber:29 | status=200 | total_duration=58.99 | view_duration=39.02 | db_duration=0.91
517
+ 2016-04-26 10:11:21.421 | 39ec102f17fd | I | middleware:28 | method=GET | path=/home/b | ip=::1
518
+ 2016-04-26 10:11:21.422 | 39ec102f17fd | W | action_dispatch_debug_exceptions:6 | routing_error="/home/b"
519
+ 2016-04-26 10:11:21.499 | 39ec102f17fd | D | action_view_log_subscriber:6 | view=_trace.html.erb | duration=5.6
520
+ 2016-04-26 10:11:21.519 | 39ec102f17fd | D | action_view_log_subscriber:6 | view=_route.html.erb | duration=1.7
521
+ 2016-04-26 10:11:21.541 | 39ec102f17fd | D | action_view_log_subscriber:6 | view=_table.html.erb | duration=6.2
522
+ 2016-04-26 10:11:21.566 | 39ec102f17fd | D | action_view_log_subscriber:6 | view=_request_and_response.html.erb | duration=4.2
523
+ 2016-04-26 10:11:21.567 | 39ec102f17fd | D | action_view_log_subscriber:6 | view=routing_error.html.erb | duration=91.6
524
+ 2016-04-26 10:11:24.681 | 39ec102f17fd | I | middleware:28 | method=GET | path=/ | ip=::1
525
+ 2016-04-26 10:11:24.686 | 39ec102f17fd | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
526
+ 2016-04-26 10:11:24.693 | 39ec102f17fd | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
527
+ 2016-04-26 10:11:24.695 | 39ec102f17fd | I | action_controller_log_subscriber:29 | status=200 | total_duration=7.33 | view_duration=6.86 | db_duration=0.0
528
+ 2016-04-26 10:12:39.505 | 0aa0cd8c94e8 | I | middleware:28 | method=GET | path=/ | ip=::1
529
+ 2016-04-26 10:12:39.506 | 0aa0cd8c94e8 | D | action_controller_log_subscriber:9 | controller=Rails::WelcomeController | action=index | params={}
530
+ 2016-04-26 10:12:39.509 | 0aa0cd8c94e8 | D | action_view_log_subscriber:6 | view=index.html.erb | duration=0.1
531
+ 2016-04-26 10:12:39.510 | 0aa0cd8c94e8 | I | action_controller_log_subscriber:29 | status=200 | total_duration=3.65 | view_duration=3.53 | db_duration=0.0
532
+ 2016-04-26 10:12:52.416 | 0aa0cd8c94e8 | I | middleware:28 | method=GET | path=/home | ip=::1
533
+ 2016-04-26 10:12:52.417 | 0aa0cd8c94e8 | W | action_dispatch_debug_exceptions:6 | routing_error="/home"
534
+ 2016-04-26 10:12:52.477 | 0aa0cd8c94e8 | D | action_view_log_subscriber:6 | view=_trace.html.erb | duration=2.2
535
+ 2016-04-26 10:12:52.493 | 0aa0cd8c94e8 | D | action_view_log_subscriber:6 | view=_route.html.erb | duration=0.7
536
+ 2016-04-26 10:12:52.513 | 0aa0cd8c94e8 | D | action_view_log_subscriber:6 | view=_table.html.erb | duration=1.5
537
+ 2016-04-26 10:12:52.536 | 0aa0cd8c94e8 | D | action_view_log_subscriber:6 | view=_request_and_response.html.erb | duration=1.7
538
+ 2016-04-26 10:12:52.536 | 0aa0cd8c94e8 | D | action_view_log_subscriber:6 | view=routing_error.html.erb | duration=82.0
539
+ 2016-04-26 10:12:55.162 | 0aa0cd8c94e8 | I | middleware:28 | method=GET | path=/home/index | ip=::1
540
+ 2016-04-26 10:12:55.163 | 0aa0cd8c94e8 | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
541
+ 2016-04-26 10:12:55.166 | 0aa0cd8c94e8 | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.44
542
+ 2016-04-26 10:12:55.167 | 0aa0cd8c94e8 | I | home_controller:5 | abc=s n
543
+ 2016-04-26 10:12:55.176 | 0aa0cd8c94e8 | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.1
544
+ 2016-04-26 10:12:55.176 | 0aa0cd8c94e8 | D | action_view_log_subscriber:6 | view=index.html.erb | duration=2.2
545
+ 2016-04-26 10:12:55.185 | 0aa0cd8c94e8 | I | action_controller_log_subscriber:29 | status=200 | total_duration=21.41 | view_duration=17.04 | db_duration=0.44
@@ -5,7 +5,7 @@ require 'pp'
5
5
  class SuperloggerTest < ActiveSupport::TestCase
6
6
  def setup
7
7
  @output = StringIO.new
8
- Rails.logger = Logger.new(@output)
8
+ Rails.logger.extend(ActiveSupport::Logger.broadcast(Superlogger::Logger.new(@output)))
9
9
 
10
10
  Dummy::Application.configure do
11
11
  # Set to true so that routing error will not raise error in test
@@ -20,7 +20,7 @@ class SuperloggerTest < ActiveSupport::TestCase
20
20
  env
21
21
  ensure
22
22
  # Must close to prevent recursive locking error when calling app.call(env) multiple times
23
- body.close if body.respond_to?(:close)
23
+ body.try(:close)
24
24
  end
25
25
 
26
26
  def output
@@ -37,104 +37,118 @@ class SuperloggerTest < ActiveSupport::TestCase
37
37
  request('home/index')
38
38
 
39
39
  fields = output.first
40
- assert DateTime.parse(fields[0]).to_date == Date.today
41
40
  assert fields[0].length == 23
42
41
  assert fields[1].length == 12
43
- assert fields[2].length == 1
44
- assert_match(/\w:\d+/, fields[3])
42
+ assert fields[2].length == 12
43
+ assert fields[3].length == 1
44
+ assert_match(/\w:\d+/, fields[4])
45
45
  end
46
46
 
47
- test 'log levels' do
48
- Superlogger::Logger.debug var: 'test'
49
- Superlogger::Logger.info var: 'test'
50
- Superlogger::Logger.warn var: 'test'
51
- Superlogger::Logger.error var: 'test'
52
- Superlogger::Logger.fatal var: 'test'
47
+ test 'timestamp' do
48
+ request('home/index')
49
+ assert DateTime.parse(output[0][0]).to_date == Date.today
50
+ end
53
51
 
54
- assert output[0][2] == 'D'
55
- assert output[1][2] == 'I'
56
- assert output[2][2] == 'W'
57
- assert output[3][2] == 'E'
58
- assert output[4][2] == 'F'
52
+ test 'with session_id' do
53
+ env = request('home/index')
54
+ assert_match env['rack.session'].id[0..11], output[0][1]
59
55
  end
60
56
 
61
- test 'caller location' do
62
- Superlogger::Logger.debug var: 'test'
63
- assert output[0][3] == "superlogger_test:#{__LINE__ - 1}"
57
+ test 'without session_id' do
58
+ Rails.logger.debug var: 'test'
59
+ assert_match(/NS-[[:alnum:]]+/, output[0][1])
64
60
  end
65
61
 
66
- test 'overwrite_rails_rack_logger' do
62
+ test 'with request_id' do
67
63
  request('home/index')
68
- assert_no_match 'Started GET', output[0][4]
64
+ assert_no_match(/NR-[[:alnum:]]+/, output[0][2])
69
65
  end
70
66
 
71
- test 'overwrite_action_dispatch_debug_exceptions' do
72
- request('invalid_path')
73
- assert_match 'routing_error="/invalid_path"', output[1][4]
67
+ test 'without request_id' do
68
+ Rails.logger.debug var: 'test'
69
+ assert_match(/NR-[[:alnum:]]+/, output[0][2])
74
70
  end
75
71
 
76
- test 'middleware' do
77
- request('home/index', 'REMOTE_ADDR' => '::1')
72
+ test 'log levels' do
73
+ Rails.logger.debug var: 'test'
74
+ Rails.logger.info var: 'test'
75
+ Rails.logger.warn var: 'test'
76
+ Rails.logger.error var: 'test'
77
+ Rails.logger.fatal var: 'test'
78
+
79
+ assert output[0][3] == 'D'
80
+ assert output[1][3] == 'I'
81
+ assert output[2][3] == 'W'
82
+ assert output[3][3] == 'E'
83
+ assert output[4][3] == 'F'
84
+ end
78
85
 
79
- fields = output[0]
80
- assert_match 'method=GET', fields[4]
81
- assert_match 'path=/home/index', fields[5]
82
- assert_match 'ip=::1', fields[6]
86
+ test 'caller location' do
87
+ Rails.logger.debug var: 'test'
88
+ assert output[0][4] == "superlogger_test:#{__LINE__ - 1}"
83
89
  end
84
90
 
85
- test 'without session_id' do
86
- Superlogger::Logger.debug var: 'test'
87
- assert_match(/NS-[[:alnum:]]+/, output[0][1])
91
+ test 'silence_rails_rack_logger' do
92
+ request('home/index')
93
+ assert_no_match 'Started GET', output[0][5]
88
94
  end
89
95
 
90
- test 'with session_id' do
91
- env = request('home/index')
92
- assert_match env['rack.session'].id[0..11], output[0][1]
96
+ test 'middleware' do
97
+ request('home/index', 'REMOTE_ADDR' => '::1')
98
+
99
+ fields = output[0]
100
+ assert_match 'method=GET', fields[5]
101
+ assert_match 'path=/home/index', fields[6]
102
+ assert_match 'ip=::1', fields[7]
93
103
  end
94
104
 
95
- test 'action_controller_log_subscriber' do
105
+ test 'action_controller_log_subscriber.start_processing' do
96
106
  request('home/index?a=1')
97
107
 
98
108
  fields = output[1]
99
- assert_match 'controller=HomeController', fields[4]
100
- assert_match 'action=index', fields[5]
101
- assert_match 'params={"a"=>"1"}', fields[6]
109
+ assert_match 'controller=HomeController', fields[5]
110
+ assert_match 'action=index', fields[6]
111
+ assert_match 'params={"a"=>"1"}', fields[7]
112
+ end
113
+
114
+ test 'action_controller_log_subscriber.process_action' do
115
+ request('home/index')
102
116
 
103
117
  fields = output.last
104
- assert_match 'status=200', fields[4]
105
- assert_match(/total_duration=\d.\d/, fields[5])
106
- assert_operator fields[5].split('=').last.to_f, :>, 0
107
- assert_match(/view_duration=\d.\d/, fields[6])
118
+ assert_match 'status=200', fields[5]
119
+ assert_match(/total_duration=\d.\d/, fields[6])
108
120
  assert_operator fields[6].split('=').last.to_f, :>, 0
109
- assert_match(/db_duration=\d.\d/, fields[7])
121
+ assert_match(/view_duration=\d.\d/, fields[7])
110
122
  assert_operator fields[7].split('=').last.to_f, :>, 0
123
+ assert_match(/db_duration=\d.\d/, fields[8])
124
+ assert_operator fields[8].split('=').last.to_f, :>, 0
111
125
  end
112
126
 
113
- test 'action_view_log_subscriber' do
127
+ test 'action_view_log_subscriber.render_template.render_partial.render_collection' do
114
128
  request('home/index')
115
129
 
116
130
  fields = output[3]
117
- assert_match 'view=_partial.html.erb', fields[4]
118
- assert_match 'duration=', fields[5]
131
+ assert_match 'view=_partial.html.erb', fields[5]
132
+ assert_match 'duration=', fields[6]
119
133
 
120
134
  fields = output[4]
121
- assert_match 'view=index.html.erb', fields[4]
122
- assert_match 'duration=', fields[5]
135
+ assert_match 'view=index.html.erb', fields[5]
136
+ assert_match 'duration=', fields[6]
123
137
  end
124
138
 
125
- test 'active_record_log_subscriber' do
139
+ test 'active_record_log_subscriber.sql' do
126
140
  request('home/index')
127
141
 
128
142
  fields = output[2]
129
- assert_match 'sql=SELECT', fields[4]
130
- assert_match 'params=[', fields[5]
131
- assert_match(/duration=\d.\d/, fields[6])
132
- assert_operator fields[6].split('=').last.to_f, :>, 0
143
+ assert_match 'sql=SELECT', fields[5]
144
+ assert_match 'params=[', fields[6]
145
+ assert_match(/duration=\d.\d/, fields[7])
146
+ assert_operator fields[7].split('=').last.to_f, :>, 0
133
147
  end
134
148
 
135
- test 'escape new lines' do
136
- Superlogger::Logger.debug var: 'first\nsecond'
149
+ test 'escape new lines' do
150
+ Rails.logger.debug var: 'first\nsecond'
137
151
 
138
- assert_match 'first\\nsecond', output[0].last
139
- end
152
+ assert_match 'first\\nsecond', output[0].last
153
+ end
140
154
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superlogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soh Yu Ming
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -50,13 +50,11 @@ files:
50
50
  - Rakefile
51
51
  - lib/superlogger.rb
52
52
  - lib/superlogger/action_controller_log_subscriber.rb
53
- - lib/superlogger/action_dispatch_debug_exceptions.rb
54
53
  - lib/superlogger/action_view_log_subscriber.rb
55
54
  - lib/superlogger/active_record_log_subscriber.rb
56
55
  - lib/superlogger/logger.rb
57
- - lib/superlogger/middleware.rb
58
- - lib/superlogger/rails_rack_logger.rb
59
56
  - lib/superlogger/railtie.rb
57
+ - lib/superlogger/superlogger_middleware.rb
60
58
  - lib/superlogger/version.rb
61
59
  - test/dummy/README.rdoc
62
60
  - test/dummy/Rakefile
@@ -1,11 +0,0 @@
1
- class ActionDispatch::DebugExceptions
2
- alias_method :old_log_error, :log_error
3
- def log_error(request, wrapper)
4
- if wrapper.exception.is_a? ActionController::RoutingError
5
- # Change routing errors to warn instead
6
- Superlogger::Logger.warn routing_error: request['PATH_INFO'].inspect
7
- else
8
- old_log_error request, wrapper
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- class Rails::Rack::Logger
2
- # Overwrite the default call_app method to mute the following line:
3
- # Started GET “/session/new” for 127.0.0.1 at 2012-09-26 14:51:42 -0700
4
- def call_app(_request, env)
5
- @app.call(env)
6
- ensure
7
- ActiveSupport::LogSubscriber.flush_all!
8
- end
9
- end
10
-
11
-