Skip to content

Fix gunicorn logging in docker#390

Open
deepanshutiwari27 wants to merge 1 commit into
chaoss:mainfrom
deepanshutiwari27:fix-issue-374
Open

Fix gunicorn logging in docker#390
deepanshutiwari27 wants to merge 1 commit into
chaoss:mainfrom
deepanshutiwari27:fix-issue-374

Conversation

@deepanshutiwari27

@deepanshutiwari27 deepanshutiwari27 commented Jun 13, 2026

Copy link
Copy Markdown

Implemented the Docker Gunicorn logging fix for CollectOSS #374.
Root cause: Docker already relies on gunicorn_conf.py setting errorlog = '-', but both CLI startup paths passed --log-file, which overrides the config and sends Gunicorn errors only to the file. Docker then has nothing useful to show via docker logs.
Changes:
Added internal Gunicorn command builder: collectoss/application/cli/_gunicorn.py (line 17)
Updated backend startup to omit --log-file in Docker: collectoss/application/cli/backend.py (line 108)
Updated API startup the same way: collectoss/application/cli/api.py (line 65)
Switched Gunicorn config to the current Docker env name and kept errorlog = '-': collectoss/api/gunicorn_conf.py (line 45)
Added focused regression tests: tests/test_application/test_cli/test_gunicorn_command.py (line 7)

Fixes #374

@MoralCode MoralCode changed the title Fix issue #374 Fix gunicorn logging in docker Jun 14, 2026
@MoralCode

Copy link
Copy Markdown
Contributor

is there a way to set gunicorn to log to both a file and dockers logs?


# this syntax satisfies the type checker
is_docker = SystemEnv.get_bool("AUGUR_DOCKER_DEPLOY", False)
is_docker = SystemEnv.get_bool("COLLECTOSS_DOCKER_DEPLOY", False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change that was made in another PR already. can you rebase your PR on top of current main?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why this was put in its own file/made into a function?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Gunicorn command now requires deployment-specific logic (Docker vs non-Docker). Extracting it into build_gunicorn_command() centralizes command construction, makes the behavior testable, avoids duplicating Docker logging logic elsewhere, and keeps start() focused on process startup rather than command assembly.

@deepanshutiwari27

Copy link
Copy Markdown
Author

Yes. Gunicorn can log to both a file and Docker's stdout/stderr, but not with a single --log-file option

Signed-off-by: Deepanshu Tiwari <tiwarideepanshu235@gmail.com>
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 this pull request may close these issues.

gunicorn failures do not log in docker

2 participants