You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
general reference
Relation between container standard output and log levels
Copy page
Download PDF
Relation between container standard output and log levels
The log write path for applications inside a container is determined by the log framework configuration it used. The log level (such as info or error) is independent of container standard output (stdout) or error output (stderr) type.​
  • If the log framework calls os.Stdout, the log is written to the container's standard output (stdout).​
  • If the log framework calls os.Stderr, the log is written to the container's standard error output (stderr).​
Notice​
If the logging framework configuration is unclear, it is recommend to collect both stdout and stderr.​
View the log write pathway based on framework configuration​
Taking a Golang application as an example:​
Logger is configured with logger.SetOutput(os.Stderr), so all logs (including info and error levels) are written to standard error output (stderr).​
​
logger := logrus.New()​
logger.SetOutput(os.Stderr) # Log is redirect to stderr​
logger.SetLevel(logrus.DebugLevel)​
logger.Info("Service started") # write in stderr​
logger.Error("Disk full") # write in stderr​
​
View the log write pathway based on log content​
Taking the Containerd container runtime as an example:​
Check the /var/log/pods/<namespace>_<pod-name>_<pod-uid>/<container-name>/0.log log file. In the file, the stderr label indicates that logs are written to the standard error output (stderr).​
​
2025-05-12T10:39:39.477327246+08:00 stderr F 10.1.0.138 - - [12/May/2025 02:39:39] "GET / HTTP/1.1" 200 -​
2025-05-12T10:39:40.23676878+08:00 stderr F 10.1.0.138 - - [12/May/2025 02:39:40] "GET / HTTP/1.1" 200 -​
2025-05-12T10:39:49.477228162+08:00 stderr F 10.1.0.138 - - [12/May/2025 02:39:49] "GET / HTTP/1.1" 200 -​
​
​
Last updated: 2025.12.15 17:27:03