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

rest: logging does not work correctly in production mode #417

Closed
audrium opened this issue Nov 12, 2021 · 2 comments · Fixed by reanahub/reana#603 or #425
Closed

rest: logging does not work correctly in production mode #417

audrium opened this issue Nov 12, 2021 · 2 comments · Fixed by reanahub/reana#603 or #425
Assignees

Comments

@audrium
Copy link
Member

audrium commented Nov 12, 2021

Currently on production mode installation there are some issues with rest-api logging:

  1. It is only working for limited amount of endpoints. E.g. /ping is not being logged while /api/you logged as expected

  2. There are lots of deprecation warnings in the logs like this:

<unknown>:1: DeprecationWarning: invalid escape sequence \[

2021-11-12 16:01:59,147 | py.warnings | uWSGIWorker2Core0 | WARNING | <unknown>:1: DeprecationWarning: invalid escape sequence \[

which are repeated for almost 1.5k lines after application starts. This could be due to outdated invenio dependencies. However it's not trivial to upgrade it because we have a conflicting celery dependency (from outdated kombu version which requires celery<5.0.0 pinning).

  1. Logging level set in reana-commons is not respected: logger: basic configuration does not work because of the invenio-logging handlers #298

  2. It seems that factory.py and create_app() are only being used in reana-admin and scheduler (defined here). Needs a deeper investigation, but if that's the case there is no point in registering the blueprints there. Looks like invenio-base is taking care for starting up the application. To reproduce try to:

    • comment/remove factory.py and app.py
    • reana-dev docker-build -c . -b DEBUG=1
    • reana-dev kind-load-docker-image -c .
    • kill the old pod and inspect the new one - works as expected
    • it does not work while redeploying the cluster because it can't start flask reana-admin create-admin-user
@mvidalgarcia mvidalgarcia self-assigned this Dec 1, 2021
@mvidalgarcia
Copy link
Member

mvidalgarcia commented Dec 2, 2021

After some research, I've discovered that we're only printing 4xx and 5xx logs when using uwsgi. IIRC this was our decision, perhaps to avoid too much output and thus be able to detect errors easier. Should we keep it like this? @tiborsimko

  1. It is only working for limited amount of endpoints. E.g. /ping is not being logged while /api/you logged as expected

Probably you were not logged in so the HTTP code was 401.

@tiborsimko
Copy link
Member

Good catch! I think printing everything is a better default, and if that is really too verbose, let's allow admins to change it easily.
This calls for making the behaviour configurable via Helm values...

mvidalgarcia added a commit to mvidalgarcia/reana that referenced this issue Dec 2, 2021
- by default, log all HTTP requests
- allow logging only HTTP error requests (status code 4xx and 5xx)

closes reanahub/reana-server#417
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this issue Dec 3, 2021
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this issue Dec 6, 2021
mvidalgarcia added a commit to mvidalgarcia/reana-server that referenced this issue Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants