将应用程序日志重定向到Docker日志 [英] Redirect application logs to docker logs

查看:305
本文介绍了将应用程序日志重定向到Docker日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Docker容器生成多个应用程序日志。

My Docker container produces multiple application logs.

docker logs 命令仅显示应用程序启动日志。有没有一种方法可以重定向其他日志文件,使它们由 docker logs 命令显示?

docker logs command only shows the app startup logs. Is there a way to redirect the other log files so they are shown by the docker logs command?

编辑:

我正在使用 WebSphere 传统docker映像。 Docker日志仅显示startServer.log,但还有其他日志,例如SystemOut.log...。

I'm using the WebSphere traditional docker image. Docker logs only shows the startServer.log but there are other logs like SystemOut.log ....

推荐答案

docker logs 将显示容器中运行的应用程序中的所有stdout和stderr。将应用程序配置为登录到stderr而不是日志文件,日志将从 docker日志中可见。

docker logs will display all the stdout and stderr from the application running in the container. Configure the application to log to stderr instead of a log file and the logs will be visible from docker logs.

这篇关于将应用程序日志重定向到Docker日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆