Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker tomcat Log issue

Tags:

docker

logfile

Docker container can only to daemon mode: I run catalina.sh to start the tomcat.
But the problem is my log will not appear in catalina.out.

I can look at `docker logs , but this certainly cannot run in a production environment.
I would like to ask how, in production environment, can I have the Tomcat log stored in the document and without the container stopping?

like image 975
zhangyi Avatar asked Jun 28 '16 06:06

zhangyi


1 Answers

If you look at the official tomcat docker image, it runs

CMD ["catalina.sh", "run"]

That is enough to starts tomcat in the foreground, displaying the logs on the console.
But, as you said, that might not populate catalina.out.

An alternative would be:

CMD service tomcat start && tail -f /var/lib/tomcat/logs/catalina.out
like image 190
VonC Avatar answered Sep 21 '22 03:09

VonC