Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

improve log handling when using Docker #637

Closed
rriemann opened this issue Feb 4, 2022 · 3 comments
Closed

improve log handling when using Docker #637

rriemann opened this issue Feb 4, 2022 · 3 comments

Comments

@rriemann
Copy link
Contributor

rriemann commented Feb 4, 2022

Hello!

I am quite advanced with a docker-compose setup that integrates mastodon and the crossposter.

During debugging, I noticed that logs are put into logs/production.log. However, it would be much better if when launched from within docker, the logs would be send to STDERR or STDOUT. This way, they can be easily viewed with docker compose logs crossposter. Also, we can get logrotate for free.

I suggest that we add one line to the Dockerfile to make the webserver send output instead of to production.log to STDOUT and if it's an error, STDERR.

I quickly searched and found two possible paths:

add this to config/environment/test.rb (here: production.rb)

# Enable stdout logger
config.logger = Logger.new(STDOUT)

There seems to be also an environment variable: RAILS_LOG_TO_STDOUT=1.

In any case, if a log file remains in the docker container, it should respect a file size limit.

Best,
Robert

@renatolond
Copy link
Owner

Hey, yeah, on my production env I have RAILS_LOG_TO_STDOUT=enabled in my .env
I believe it's better to set that one directly in the Dockerfile directly, since I doubt anyone would rather have it on a file in a Docker setup 🤔
Would you like to do it or would you rather I pick it up here?

@rriemann
Copy link
Contributor Author

rriemann commented Feb 5, 2022

I'm in deep troubles with getting the mastodon streaming component working. I would appreciate it you can make this one happen.

@renatolond
Copy link
Owner

Sorry, didn't had time before, should be fixed now :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants