Skip to content

Commit

Permalink
Changed gunicorn config to send stderr to stdout (#439)
Browse files Browse the repository at this point in the history
* Changed gunicorn config to send stderr to stdout

* Changed workflow path

* Changing the basic config logger to use stdout

---------

Co-authored-by: Jorgen-5 <[email protected]>
  • Loading branch information
Jorgen-5 and Jorgen-5 authored Nov 15, 2024
1 parent 3eb2b20 commit 91ab335
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "poetry.lock"
- ".nais/test-pr.yaml"
- ".github/workflows/integration-test.yml"
- "gunicorn.conf.py"

env:
REGISTRY: europe-north1-docker.pkg.dev/nais-management-b3a7/dapla-metadata
Expand Down
34 changes: 34 additions & 0 deletions gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
"""Configuration for the Gunicorn server."""

import sys

bind = "0.0.0.0:8050"
workers = 1
loglevel = "info"
preload = True

logconfig_dict = GUNICORN_LOG_CONFIG = {
"handlers": {
"console_stdout": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"stream": sys.stdout,
},
},
"loggers": {
"": {"handlers": ["console_stdout"], "level": "INFO", "propagate": False},
"gunicorn": {
"handlers": ["console_stdout"],
"level": "INFO",
"propagate": False,
},
"gunicorn.access": {
"handlers": ["console_stdout"],
"level": "INFO",
"propagate": False,
},
"gunicorn.error": {
"handlers": ["console_stdout"],
"level": "INFO",
"propagate": False,
},
},
"root": {
"level": "INFO",
"handlers": ["console_stdout"],
},
}
3 changes: 2 additions & 1 deletion src/datadoc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import logging
import os
import sys
from pathlib import Path
from pprint import pformat
from typing import Literal
Expand All @@ -15,7 +16,7 @@
from datadoc.constants import DAPLA_MANUAL_TEXT
from datadoc.frontend.components.builders import build_link_object

logging.basicConfig(level=logging.DEBUG, force=True)
logging.basicConfig(level=logging.DEBUG, force=True, stream=sys.stdout)

logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 91ab335

Please sign in to comment.