启动一个tomcat容器,然后使用命令查看tomcat启动日志。
docker logs 8efed1c23ff5 02-Aug-2021 07:19:06.894 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/8.5.69 02-Aug-2021 07:19:06.895 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 30 2021 18:00:00 UTC 02-Aug-2021 07:19:06.895 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 8.5.69.0 02-Aug-2021 07:19:06.895 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux 02-Aug-2021 07:19:06.895 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.18.0-147.el8.x86_64 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/local/openjdk-8/jre 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_302-b08 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=http://www.likecs.com/usr/local/tomcat/conf/logging.properties 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 02-Aug-2021 07:19:06.896 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=http://www.likecs.com/usr/local/tomcat 02-Aug-2021 07:19:06.897 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=http://www.likecs.com/usr/local/tomcat 02-Aug-2021 07:19:06.897 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=http://www.likecs.com/usr/local/tomcat/temp 02-Aug-2021 07:19:06.897 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.30] using APR version [1.6.5]. 02-Aug-2021 07:19:06.897 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 02-Aug-2021 07:19:06.897 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 02-Aug-2021 07:19:06.900 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1d 10 Sep 2019] 02-Aug-2021 07:19:06.976 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 02-Aug-2021 07:19:06.990 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 02-Aug-2021 07:19:07.001 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 582 ms 02-Aug-2021 07:19:07.030 INFO [main] org.apache.tomcat.util.digester.FactoryCreateRule.begin [FactoryCreateRule] Create exception ignored: java.lang.NullPointerException 02-Aug-2021 07:19:07.034 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 02-Aug-2021 07:19:07.035 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/8.5.69] 02-Aug-2021 07:19:07.045 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/ROOT] 02-Aug-2021 07:19:07.267 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/ROOT] has finished in [221] ms 02-Aug-2021 07:19:07.267 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/docs] 02-Aug-2021 07:19:07.281 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/docs] has finished in [14] ms 02-Aug-2021 07:19:07.281 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/examples] 02-Aug-2021 07:19:07.504 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/examples] has finished in [223] ms 02-Aug-2021 07:19:07.504 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/host-manager] 02-Aug-2021 07:19:07.524 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/host-manager] has finished in [19] ms 02-Aug-2021 07:19:07.524 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/manager] 02-Aug-2021 07:19:07.539 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/manager] has finished in [15] ms 02-Aug-2021 07:19:07.544 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 02-Aug-2021 07:19:07.573 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 571 ms从结果可以看出日志输出了tomcat的启动日志,如果需要时时查看日志,可以增加参数-f,就可以时时跟踪日志。
ls