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

Multiple orlo.log files being written by children #54

Open
wodify opened this issue May 30, 2018 · 1 comment
Open

Multiple orlo.log files being written by children #54

wodify opened this issue May 30, 2018 · 1 comment
Labels

Comments

@wodify
Copy link

wodify commented May 30, 2018

Two different orlo child processes have open two different log files (orlo.log and orlo.log.1) and both are being written to:

total 948
-rwxrwxr-x 1 orlo orlo 232550 May 30 16:15 gunicorn_access.log
-rwxrwxr-x 1 orlo orlo  86478 May 30 16:15 gunicorn_error.log
-rw-r--r-- 1 orlo orlo 265140 May 30 16:15 orlo.log
-rw-r--r-- 1 orlo orlo 361350 May 30 16:15 orlo.log.1
# lsof /var/log/orlo/orlo.log
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
orlo    1146 orlo    5w   REG  254,1   274488 105083 /var/log/orlo/orlo.log
# lsof /var/log/orlo/orlo.log.1
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
orlo    1145 orlo    5w   REG  254,1   378564 105060 /var/log/orlo/orlo.log.1

The orlo process tree:

 1103 ?        Ss     4:04 /opt/venvs/orlo/bin/python /usr/bin/orlo start
 1142 ?        R    477:23  \_ /opt/venvs/orlo/bin/python /usr/bin/orlo start
 1145 ?        R    478:10  \_ /opt/venvs/orlo/bin/python /usr/bin/orlo start
 1146 ?        S    478:43  \_ /opt/venvs/orlo/bin/python /usr/bin/orlo start
 1147 ?        S    478:43  \_ /opt/venvs/orlo/bin/python /usr/bin/orlo start
@al4 al4 added the bug label Jul 10, 2018
@al4
Copy link
Collaborator

al4 commented Jul 10, 2018

The solution to this is to use gunicorn logging. By default we create our own handler and log to a file, which is really only sensible with a single instance.

Unfortunately I don't think I'm going to be in a position to do this refactoring in the near future, but this article shows the way:
https://medium.com/@trstringer/logging-flask-and-gunicorn-the-manageable-way-2e6f0b8beb2f

Setup is done in https://github.com/eBayClassifiedsGroup/orlo/blob/master/orlo/app.py

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

No branches or pull requests

2 participants