簡體   English   中英

Java:Spring啟動Tomcat訪問日志不是在Tomcat Start創建的

[英]Java: Spring boot Tomcat Access Logs are not created at Tomcat Start

我想訪問我的服務的tomcat日志,該日志是在具有嵌入式tomcat 8的spring boot中構建的。 我在我的服務的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" ,當我點擊我的服務調用時,就不會在日志文件中創建日志。 當我停止我的tomcat時會創建日志。 我的代碼需要做哪些更改?

你能嘗試一下:

server.tomcat.accesslog.buffered=false

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM