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:35:08 -0700 |
commit | fb9c00116bb7277f61a9d3ef5c399457f26056a4 (patch) | |
tree | beb3024f9b30633dd1cdeeb6f3af3c0e0cbe1e68 | |
parent | bf07c79a02d7498c9025d97b1302a80d21066ba5 (diff) | |
download | rails-fb9c00116bb7277f61a9d3ef5c399457f26056a4.tar.gz rails-fb9c00116bb7277f61a9d3ef5c399457f26056a4.tar.bz2 rails-fb9c00116bb7277f61a9d3ef5c399457f26056a4.zip |
Backport 1a7049906ee6735bae058e9985a3806d08d9746b
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
-rw-r--r-- | railties/lib/rails/rack/logger.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/railties/lib/rails/rack/logger.rb b/railties/lib/rails/rack/logger.rb index d0d053e7ed..3f59bb8733 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,12 @@ module Rails protected def call_app(request, env) + # Put some space between requests in development logs. + if Rails.env.development? + Rails.logger.info '' + Rails.logger.info '' + end + Rails.logger.info started_request_message(request) @app.call(env) ensure |