![](/img/trans.png)
[英]How to filter access logs generated by tomcat under spring boot framework
[英]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.