2

My Docker container produces multiple application 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?

EDIT:

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

DarVar
  • 16,882
  • 29
  • 97
  • 146
  • 4
    This depends on your application right? Docker logs is only showing the aggregation of stdout and stderr from the process running in the container. – johnharris85 Nov 04 '16 at 20:29
  • This could be a hacking operation I think. Not for such a case with docker design. Like @johnharris85 said, only STDOUT and STDERR could be shown by `docker logs`. All u wanna achieve, that maybe could be done with several `tail -f` in your Dockerfile, but it's really not recommended. – Light.G Apr 09 '20 at 02:26

2 Answers2

0

We need more information, like which application, your Dockerfile, etc.

As a general answer you must have an entry point script which will send your application log to stdout:

runapp &
tail -f logfile

Something like that.

Regards

Carlos Rafael Ramirez
  • 5,984
  • 1
  • 29
  • 36
0

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.

dnephin
  • 25,944
  • 9
  • 55
  • 45