Open andrejohansson opened 11 months ago
Hi André,
The explanation of these log events can be found here: https://unit.nginx.org/troubleshooting/#troubleshooting-log
All event/message severity levels are written to the Unit log file. For Docker images, these typically are redirected to stderr.
Currently there is no way to set a minimum severity level. Converting this issue to an enhancement request - it would be a nice feature.
Thanks for your reply and the information!
But I fail to understand your link, you say that logs are typically redirected to stderr but when I check the code it´s redirecting to stdout (which would have been fine for us):
&& ln -sf /dev/stdout /var/log/unit.log
Oops. My mistake - good catch!
I will propose that we change the official Dockerfiles so that the Unit log goes to stderr. Especially as we don't want to conflict with any application or access logging that might use stdout.
In the interim. You can start your containers with additional command line parameters to unitd
:
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock", "--log", "/dev/stderr"]
This will override the default log filename and therefore avoid the symlink.
I'm running the unit docker image and when it starts up it logs a message to stderr which in turns causes the logs to be picked up by our gcp logging streamer which sees it as an error.
Why is it defaulting to stderr for that info message? Can I turn it of or redirect it somehow?
I see that I can redirect application logs here on an application level but how do I do this on a global level (which I guess is were startup log messages reside): https://unit.nginx.org/configuration/#settings