1

I can't get logs from the Symfony workers in my supervisord/runit log/stdout when starting my Docker container. Yes, I tried with supervisord and runit, but still does not work. If I have some exception in code I can see it regularly in stdout, but only that.

I'm afraid that something is with my Monolog configuration because if I add regular echo in my code I can see the output.

Monolog file is very simple:

handlers:
    main:
        type: stream
        path: "%kernel.logs_dir%/%kernel.environment%.log"
        level: debug
        channels: ["!event"]
    console:
        type: console
        process_psr_3_messages: false
        channels: ["!event", "!doctrine", "!console"]

I tried with path: 'php://stdout' or path: 'php://stderr' with/out changes in the php.ini files like: display_errors = On, error_log = /proc/self/fd/2, catch_workers_output = yes, but obeviously does not work. I can't find right combination.

Symfony workers are long-life process and I need some init processor to start it like supervisord or runit.

For runit, I tried some trick from this: https://git.nixaid.com/arno/show-runit, but as I mentioned above, regular echo works, and PSR Symfony logs not.

For both supervisord and runit, tried this: Symfony logs to stdout inside Docker container, but same - does not work.

Any hint?

Kolesar
  • 1,265
  • 3
  • 19
  • 41
  • Usually you don't need supervisord or something similar to run a long-lived process in a Docker container; just run it directly, in the foreground, as the main container process, and its stdout/stderr will be the container's output. Is there a technical reason you need supervisord anyways? Can you include your image's `Dockerfile` in the question? – David Maze Jul 30 '19 at 10:34
  • Yes, I know, but I have multiple process/services. Dockerfile is not any special. Based on Alpine and some commands for install PHP – Kolesar Jul 30 '19 at 10:42
  • As I mention in question that I'm afraid is something with Monolog. Yes, there was a problem. With right configuration now I have logs – Kolesar Aug 02 '19 at 07:06
  • Great, maybe you can provide your solution? – R Picheta Mar 09 '22 at 21:13

0 Answers0