No logs shown in CloudWatch when lograge is enabled (Rails/ECS/Fargate)
philipjkim opened this issue · 1 comments
philipjkim commented
I see no logs in CloudWatch after enabling lograge on my Rails app. When I disable lograge, logs are shown in CloudWatch. I don't know the root cause. (AWS ECS with Fargate)
No problem when I run the Rails app on localhost. (all logs shown in STDOUT & log file not created)
- OK when running
bin/rails s
- OK when running via
docker run
Here's the codes related to logging:
config/environments/development.rb
:
config.log_formatter = ::Logger::Formatter.new
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = logger
config.after_initialize do
HttpLog.configure do |config|
config.logger = Rails.logger
end
end
config/initializers/lograge.rb
:
Rails.application.configure do
# I can see CloudWatch logs if I comment out the following 2 lines.
config.lograge.enabled = true
config.lograge.ignore_actions = ['MiscController#ping']
end
More info:
- Rails: 6.1.3
- Puma 5.2.1
- lograge: 0.11.2
stevenpitts commented
I've also experienced this, but in my case all the logs showed up in a group after ~1 hour of the app running, possibly after some number of log lines were queued up. Might be the case here too?