HotFix: Tune the chatwoot logs

Fixes : #616
This commit is contained in:
Sojan 2020-03-18 01:40:34 +05:30
parent 91bccd3c6d
commit 8d65e7db95
5 changed files with 29 additions and 8 deletions

View file

@ -58,6 +58,10 @@ AWS_REGION=
#sentry
SENTRY_DSN=
#Log settings
LOG_LEVEL=
LOG_SIZE=
# Credentials to access sidekiq dashboard in production
SIDEKIQ_AUTH_USERNAME=
SIDEKIQ_AUTH_PASSWORD=

View file

@ -93,6 +93,13 @@ Rails.application.configure do
# Disable host check during development
config.hosts = nil
# customize using the environment variables
config.log_level = ENV.fetch('LOG_LEVEL', 'debug').to_sym
# Use a different logger for distributed setups.
# require 'syslog/logger'
config.logger = ActiveSupport::Logger.new(Rails.root.join('log', Rails.env + '.log'), 1, ENV.fetch('LOG_SIZE', '1024').to_i.megabytes)
# Bullet configuration to fix the N+1 queries
config.after_initialize do
Bullet.enable = true

View file

@ -41,9 +41,8 @@ Rails.application.configure do
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = ENV.fetch('FORCE_SSL', false)
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# customize using the environment variables
config.log_level = ENV.fetch('LOG_LEVEL', 'info').to_sym
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
@ -85,7 +84,7 @@ Rails.application.configure do
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
config.logger = ActiveSupport::Logger.new(Rails.root.join('log', Rails.env + '.log'), 1, ENV.fetch('LOG_SIZE', '1024').to_i.megabytes)
if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new(STDOUT)

View file

@ -42,9 +42,8 @@ Rails.application.configure do
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = ENV.fetch('FORCE_SSL', false)
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# customize using the environment variables
config.log_level = ENV.fetch('LOG_LEVEL', 'info').to_sym
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
@ -85,7 +84,7 @@ Rails.application.configure do
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
config.logger = ActiveSupport::Logger.new(Rails.root.join('log', Rails.env + '.log'), 1, ENV.fetch('LOG_SIZE', '1024').to_i.megabytes)
if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new(STDOUT)

View file

@ -102,3 +102,15 @@ SECRET_KEY_BASE=replace_with_your_own_secret_string
You can generate `SECRET_KEY_BASE` using `rake secret` command from project root folder.
### Rails Logging Variables
By default chatwoot will capture `info` level logs in production. Ref [rails docs](https://guides.rubyonrails.org/debugging_rails_applications.html#log-levels) for the additional log level options.
We will also retain 1 GB of your recent logs and your last shifted log file.
You can fine tune these settings using the following environment variables
```bash
# possible values: 'debug', 'info', 'warn', 'error', 'fatal' and 'unknown'
LOG_LEVEL=
# value in megabytes
LOG_SIZE= 1024
```