diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-10-06 22:06:43 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-10-06 22:10:14 -0700 |
commit | 1a7049906ee6735bae058e9985a3806d08d9746b (patch) | |
tree | ddf4b7d9dc3f77467c5162609a018c83f8825ff1 /railties/lib/rails/rack/logger.rb | |
parent | f89ef12eb600bb7620e64216383fcba8d77f5736 (diff) | |
download | rails-1a7049906ee6735bae058e9985a3806d08d9746b.tar.gz rails-1a7049906ee6735bae058e9985a3806d08d9746b.tar.bz2 rails-1a7049906ee6735bae058e9985a3806d08d9746b.zip |
Tag the blank log line between dev requests so it's easier to filter out entire requests with grep -v without leaving a stray newline behind. Example:
# Tag asset requests so it's easy to filter them from dev logs
config.log_tags = [
-> request { :assets if request.path.starts_with?(config.assets.prefix) },
-> request { request.uuid }
]
# Watch the logs, ignoring asset requests
$ tail -100f log/development.log | grep -v assets
Diffstat (limited to 'railties/lib/rails/rack/logger.rb')
-rw-r--r-- | railties/lib/rails/rack/logger.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/lib/rails/rack/logger.rb b/railties/lib/rails/rack/logger.rb index d0d053e7ed..2b21922e9a 100644 --- a/railties/lib/rails/rack/logger.rb +++ b/railties/lib/rails/rack/logger.rb @@ -12,9 +12,6 @@ module Rails def call(env) request = ActionDispatch::Request.new(env) - # Put some space between requests in development logs. - Rails.logger.info "\n\n" if Rails.env.development? - if Rails.logger.respond_to?(:tagged) Rails.logger.tagged(compute_tags(request)) { call_app(request, env) } else @@ -25,6 +22,9 @@ module Rails protected def call_app(request, env) + # Put some space between requests in development logs. + Rails.logger.info "\n\n" if Rails.env.development? + Rails.logger.info started_request_message(request) @app.call(env) ensure |