Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct logging setup with docker image #345

Open
col-panic opened this issue Nov 12, 2024 · 0 comments · May be fixed by #346
Open

Correct logging setup with docker image #345

col-panic opened this issue Nov 12, 2024 · 0 comments · May be fixed by #346

Comments

@col-panic
Copy link

I am using redmine:5.1 (alpine) docker image.

I want to configure config.log_tags = [:request_id] to send logs to fluentd and collect the requests for opensearch.

Adding config.log_tags = [:request_id] to config/additional_environment.rb does not work.

And while https://github.com/redmine/redmine/blob/1d1c5c3a2c50ac0e47f15ccbd08f9ec46496a3b3/config/environments/production.rb#L61 would already provide support for an environment variables based usage of STDOUT as logging facility,
this line

echo 'config.logger = Logger.new(STDOUT)' > config/additional_environment.rb; \
overrides all settings.

So for my scenario i could make it run by creating config/additional_environment.rb with content

config.log_tags = [:request_id]
logger           = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger    = ActiveSupport::TaggedLogging.new(logger)

but I think the correct way would be to remove the line in

echo 'config.logger = Logger.new(STDOUT)' > config/additional_environment.rb; \
and use the environment variable
RAILS_LOG_TO_STDOUT

LaurentGoderre added a commit to LaurentGoderre/redmine that referenced this issue Nov 12, 2024
@LaurentGoderre LaurentGoderre linked a pull request Nov 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant