Stdout logs not showing up at all

I am using the following docker compose for my traefik docker container

 traefik:
  image: traefik:v3.1.2
  container_name: traefik
  restart: unless-stopped
  command:
    - --global.sendanonymoususage=false
    - --api=true
    - --entrypoints.web.address=:80
    - --entrypoints.web.http.redirections.entrypoint.to=websecure
    - --entrypoints.web.http.redirections.entrypoint.scheme=https
    - --entrypoints.web.http.redirections.entrypoint.permanent=true
    - --entrypoints.websecure.address=:443
    - --entrypoints.websecure.asDefault=true
    - --entrypoints.websecure.http.tls=true
    - --providers.docker=true
    - --providers.docker.exposedbydefault=false
    - --providers.file.filename=/traefik/config.toml
    - --log.level=DEBUG
  ports:
    - 80:80
    - 443:443
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock:ro
    - /etc/letsencrypt:/etc/letsencrypt
    - /opt/containers/traefik:/traefik
  labels:
    - traefik.enable=true
    - traefik.http.routers.traefik.rule=Host(`traefik.domain.tld`)
    - traefik.http.routers.traefik.service=api@internal
    - traefik.http.routers.traefik.middlewares=authtraefik
    - traefik.http.middlewares.authtraefik.basicauth.users=user:pass

I can access the traefik dashboard, all the other docker container's reverse proxy is also working fine but for some weird reason, the stdout log just shows up empty for some reason. I have restarted traefik docker container many times but to no avail

❯ docker compose logs -f traefik produces literally nothing

The above seems correct.

But it seems strange that you can access the dashboard without --api.dashboard=true.

So is this the right compose file you used to start the service? You are in the right folder?


UPDATE: never mind

dashboard
Optional, Default=true

Yes, this is the very exact docker compose i used to start the traefik container. For some more context, it all working fine earlier. i had to make some change in my config.toml file to add a new router and service but it caused some error so i reverted that change and restarted traefik container but the logs would just not show up now

Did you try to restart Docker or the host?

I have tried restarting docker & my host as well but didn't helped

Edit - It gave me these errors on my host restart randomly. All of my container's reverse proxy + traefik dashboard still works fine, just stdout log is always empty and these errors show up once in a while

traefik  | 2024-09-03T09:40:22Z ERR error="accept tcp [::]:443: use of closed network connection" entryPointName=websecure
traefik  | 2024-09-03T09:40:22Z ERR Error while starting server error="accept tcp [::]:443: use of closed network connection" entryPointName=websecure
traefik  | 2024-09-03T09:40:22Z ERR error="accept tcp [::]:80: use of closed network connection" entryPointName=web
traefik  | 2024-09-03T09:40:22Z ERR Error while starting server error="accept tcp [::]:80: use of closed network connection" entryPointName=web
traefik  | 2024-09-03T09:40:23Z ERR Failed to list containers for docker error="Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json\": context canceled" providerName=docker
traefik  | 2024-09-03T09:47:34Z ERR error="accept tcp [::]:443: use of closed network connection" entryPointName=websecure
traefik  | 2024-09-03T09:47:34Z ERR error="close tcp [::]:443: use of closed network connection" entryPointName=websecure
traefik  | 2024-09-03T09:47:34Z ERR error="accept tcp [::]:80: use of closed network connection" entryPointName=web
traefik  | 2024-09-03T09:47:34Z ERR error="close tcp [::]:80: use of closed network connection" entryPointName=web

Hi @xd003

I'm encountering the same issue. I had misconfigured the mounted logs directory, accidentally saving them to /etc/traefik in the container. Before realizing my error, I was messing around with the logs settings in traefik.yml, switching between ERROR / INFO logs and trying to get traefik to save the output logs on the mapping of my host.

After one of the container reboots, traefik just stopped printing logs to docker. I'm getting the same error you got after rebooting.

Did you ever find the reason or a fix for your issue?

Edit: My log configuration in traefik.yml is the following:

log:
  level: "DEBUG"
  filePath: "/var/log/traefik/traefik.log"

What OS, how did you install Docker, what do your bind mounts look like?

OS is Ubuntu running on an ARM VPS. Docker was installed using the apt repository. Log output was working fine, until I tried fixing the wrong bind mounts for the log files that I had set in the docker compose file.

Bind mounts are:

volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro ## needed without docker socket proxy
      - ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro
      - ./traefik/config.yml:/etc/traefik/config.yml:ro
      - ../../data/traefik/acme:/etc/traefik/acme
      - ../../data/traefik/logs:/var/log/traefik

Are you using Docker Swarm?

no, using docker compose on a single host