Reputation: 1047
For example in Node.js container I do:
throw new Error('lol');
or console.error('lol');
But when I open container logs: docker-compose logs -f nodejs
there are no any statuses or colors like all logs have info status.
I use Datadog to collect logs from container - it also mark all logs as 'info'.
Upvotes: 0
Views: 819
Reputation: 158977
docker logs
and similar just collect the stdout and stderr streams from the main process running inside the container. There's not a "log level" associated with that, though some systems might treat or highlight the two streams differently.
As a basic example, you could run
docker run -d --name lister --rm busybox ls /
docker logs lister
The resulting file listing isn't especially "error" or "debug" level.
The production-oriented setups I'm used to include the log level in log messages (in a Node context, I've used the Winston logging library), and then use a tool like fluentd to collect and parse those messages.
Upvotes: 2