|
|
# Log
|
|
|
|
|
|
The Logger and ActiveSupport::Logger classes provides a simple but sophisticated logging utility that you can use to output messages. The main problem with the default configuration for the Logger utility is to allow the file to become too large and occupy all of the HD memory.
|
|
|
|
|
|
## Sane log configuration
|
|
|
|
|
|
In the instantiation of the Logger, when can configure the path, number of older files and max size of log. This is an example of a sane configuration:
|
|
|
|
|
|
```ruby
|
|
|
# Production
|
|
|
config.logger = ActiveSupport::Logger.new(config.paths['log'].first, 3, 104857600) # 4x100mb
|
|
|
|
|
|
# Staging
|
|
|
config.logger = ActiveSupport::Logger.new(config.paths['log'].first, 0, 10485760) # 10mb
|
|
|
|
|
|
# Development / Test
|
|
|
config.logger = ActiveSupport::Logger.new(config.paths['log'].first, 0, 5242880) # 5mb
|
|
|
```
|
|
|
|
|
|
## Sidekiq configuration
|
|
|
|
|
|
The Sidekiq's log may follow the same path:
|
|
|
|
|
|
```ruby
|
|
|
# Production
|
|
|
Sidekiq::Logging.logger = ActiveSupport::Logger.new(Sidekiq.options[:logfile] || 'log/sidekiq.log', 0, 104857600) # 100 mb
|
|
|
|
|
|
# Staging
|
|
|
Sidekiq::Logging.logger = ActiveSupport::Logger.new(Sidekiq.options[:logfile] || 'log/sidekiq.log', 0, 2097152) # 2mb
|
|
|
|
|
|
# Development / Test
|
|
|
Sidekiq::Logging.logger = ActiveSupport::Logger.new(Sidekiq.options[:logfile] || 'log/sidekiq.log', 0, 1048576) # 1mb
|
|
|
``` |
|
|
\ No newline at end of file |