# Logging bestpractice in production

**URL:** <https://www.ruby-forum.com/t/logging-bestpractice-in-production/189770>\
**Category:** Rails\
**Created:** [June 7, 2010, 1:45pm UTC](https://www.ruby-forum.com/t/logging-bestpractice-in-production/189770 "2010-06-07T13:45:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luckydeepak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/958977/32.png) [@luckydeepak](https://www.ruby-forum.com/u/luckydeepak)\
**Post date:** [June 7, 2010, 1:45pm UTC](https://www.ruby-forum.com/t/logging-bestpractice-in-production/189770/1 "2010-06-07T13:45:56Z")

</div>

hi,  
In production i wanted to reduce the loglevel, but when i set the  
log\_level to :warn, rails stops logging the request, params.  
completion time etc.

The code below works, but had some questions:

1. is it ok to dup the logger object
2. i am using BufferedLogger, can the logs be shuffled  
eg. i have two processes, P1 and P2

and P1 logs:  
hello i am P1  
the uptime is 1000

and P2 logs;  
hello i am P2  
the uptime is 250

and the actual log is:  
hello i am P1  
hello i am P2  
the uptime is 1000  
the uptime is 250

1. i am using passenger - will it make a difference in (2).  
Does it make a difference to logging if i am using mongrel, jruby or  
passenger.

Logging config:

# See everything in the log (default is :info)

# But this also stops logging of the request by rails

config.log\_level = :warn

config.logger =  
ActiveSupport::BufferedLogger.new(File.join(RAILS\_ROOT,  
“log”,"{RAILS\_ENV}.log"))  
config.logger.level = ActiveSupport::BufferedLogger::WARN

# is dup’ing the logger object correct/bestpractice

# will the logs be in order or can they be shuffled - i am using

passenger - will it make a difference?  
config.action\_controller.logger = config.logger.dup  
config.action\_controller.logger.level =  
ActiveSupport::BufferedLogger::INFO
