Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • funkwhale funkwhale
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 389
    • Issues 389
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • funkwhale
  • funkwhalefunkwhale
  • Issues
  • #1592

Closed
Open
Created Oct 17, 2021 by petitminion@petitminionMaintainer

Get logger output to docker-compose logs

In a funkwhale_api module :

import logging
logger = logging.getLogger(__name__)
logger.info("blabla")

In .env file :

LOGLEVEL=debug
DJANGO_DEBUG=True
PYTHONUNBUFFERED=True

When running sudo docker-compose -f dev.yml logs -f api the logger.info("blabla") do not appears

When running the module inside a shell (sudo docker-compose -f dev.yml run --rm api python manage.py shell) The logger works fine. -> django logger is properly configured. ?

in django settings we can read :

 "handlers": {
            "console": {"class": "logging.StreamHandler", "formatter": "console"},
        },

this means logs are sent to sys.stderr. Docker do not catch them ?

this show univorn logs are handeled by django ? :

api_1           | INFO:     Finished server process [10]
api_1           | 2021-10-23 08:28:25,140 uvicorn.error INFO     Finished server process [10]

Another strange thing is that funkwhale_api.config logger works fine but it seems its the only module logger that works :

api_1           | 2021-10-23 06:38:37,847 funkwhale_api.config INFO     Running with the following plugins enabled: funkwhale_api.contrib.scrobbler, funkwhale_api.contrib.listenbrainz
Edited Oct 23, 2021 by petitminion
Assignee
Assign to
Time tracking