Java:Spring boot Tomcat Access Logs不是在Tomcat Start时创建的



我想访问我的服务的tomcat日志,该服务是在Spring boot中构建的,其中嵌入了tomcat 8。我在服务bootstrap.yml编写了以下代码。

server:
  port: 8320 
  context-path: /luggage-service
  tomcat:
   accesslog:
      directory: "/var/log/tomcat"
      enabled: true
      pattern: "{"Hostname":"%h", "Logical username from identd":"%l", "Remote user":"%u", "Date&Time":"%t", "HTTP Status code":"%s", "Bytes Sent":"%b", "Time taken to process the request":"%D", "Local IPAdderss":"%A", "Local port":"%p", "Time taken to Commit the Request":"%F", "Request Method:%m User SessionID":"%S", "Requested URL path":"%U", "Local ServerName":"%v"}"

当我构建并运行我的服务时,会创建一个文件"access_log.yyyy-mm-dd.log",当我点击我的服务的调用时,不会在日志文件中创建任何日志。当我停止我的雄猫时,就会创建日志。我需要在代码中执行哪些更改?

你能试试吗:

server.tomcat.accesslog.buffered=false

最新更新