SpringBoot内嵌tomcat日志配置
SpringBoot的应用程序日志配置已经用了一段时间了,在resources下配置logback.xml文件即可。
今天要讲的是tomcat的日志如何配置。
如果SpringBoot是运行在tomcat容器中的,那么tomcat会默认生成localhost_access_log日志,如果是在SpringBoot的内嵌tomcat中,则只需要配置server.tomcat.accesslog.*
server:
port: 8082
tomcat:
accesslog:
buffered: true
directory: E:/logs
enabled: true
file-date-format: .yyyy-MM-dd
pattern: common
prefix: access_log
rename-on-rotate: false
request-attributes-enabled: false
rotate: true
suffix: .log
详情参照官方文档:Configure Access Logging
运行后的结果是:
192.168.0.114 - - [13/Jun/2018:18:56:49 +0800] "OPTIONS /manage/login HTTP/1.1" 200 -
192.168.0.114 - - [13/Jun/2018:18:56:49 +0800] "POST /manage/login HTTP/1.1" 200 65
192.168.0.114 - - [13/Jun/2018:18:56:49 +0800] "OPTIONS /manage/device/getPage HTTP/1.1" 200 -
192.168.0.114 - - [13/Jun/2018:18:56:49 +0800] "POST /manage/device/getPage HTTP/1.1" 200 1379
192.168.0.114 - - [13/Jun/2018:18:56:52 +0800] "OPTIONS /manage/version/getPage HTTP/1.1" 200 -
192.168.0.114 - - [13/Jun/2018:18:56:52 +0800] "POST /manage/version/getPage HTTP/1.1" 200 3613
192.168.0.114 - - [13/Jun/2018:19:10:04 +0800] "OPTIONS /manage/config/getPage HTTP/1.1" 200 -
192.168.0.114 - - [13/Jun/2018:19:10:05 +0800] "POST /manage/config/getPage HTTP/1.1" 200 559
192.168.0.114 - - [13/Jun/2018:19:10:10 +0800] "OPTIONS /manage/config/add HTTP/1.1" 200 -
192.168.0.114 - - [13/Jun/2018:19:10:10 +0800] "POST /manage/config/add HTTP/1.1" 200 65
192.168.0.114 - - [13/Jun/2018:19:10:10 +0800] "POST /manage/config/getPage HTTP/1.1" 200 657
192.168.0.114 - - [13/Jun/2018:19:10:42 +0800] "OPTIONS /manage/device/getPage HTTP/1.1" 200 -
192.168.0.114 - - [13/Jun/2018:19:10:42 +0800] "POST /manage/device/getPage HTTP/1.1" 200 1379
192.168.0.114 - - [13/Jun/2018:19:10:45 +0800] "OPTIONS /manage/device/deleteByIds HTTP/1.1" 200 -
192.168.0.114 - - [13/Jun/2018:19:10:45 +0800] "POST /manage/device/deleteByIds HTTP/1.1" 200 65
192.168.0.114 - - [13/Jun/2018:19:10:45 +0800] "POST /manage/device/getPage HTTP/1.1" 200 1253
原文作者:普通网友
原文地址: https://blog.csdn.net/web18224617243/article/details/124419159
本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
原文地址: https://blog.csdn.net/web18224617243/article/details/124419159
本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
相关文章