springboot中的access-log

编程知识 更新时间:2023-04-06 09:42:17

springboot中的access-log

 access-log 用于springboot查看连接数,访问IP、线程号、访问url、返回状态码、访问时间、持续时间
 在以往使用tomcat的过程中。tomcat 是会在logs下打印accesslog 的,来记录请求数,但是springboot内置的tomcat 默认情况下不打开。
 不过一般nignx上打印accesslog,开不开这个也无所谓

accesslog配置


server.tomcat.accesslog.enabled=true 默认是false
server.tomcat.accesslog.buffered=false
server.tomcat.accesslog.directory=E://mall1/logs
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd
server.tomcat.accesslog.pattern=%t [%I] %{X-Forwarded-For}i %a %r %q %s (%D ms) //默认值是common
 

引用配置

server.tomcat.accesslog.buffered=true # Buffer output such that it is only flushed periodically.
server.tomcat.accesslog.directory=logs # Directory in which log files are created. Can be relative to the tomcat base dir or absolute.
server.tomcat.accesslog.enabled=false # Enable access log.
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd # Date format to place in log file name.
server.tomcat.accesslog.pattern=common # Format pattern for access logs.
server.tomcat.accesslog.prefix=access_log # Log file name prefix.
server.tomcat.accesslog.rename-on-rotate=false # Defer inclusion of the date stamp in the file name until rotate time.
server.tomcat.accesslog.request-attributes-enabled=false # Set request attributes for IP address, Hostname, protocol and port used for the request.
server.tomcat.accesslog.rotate=true # Enable access log rotation.
server.tomcat.accesslog.suffix=.log # Log file name suffix.

更加详细的配置

技术交流群:809079777

更多推荐

springboot中的access-log

本文发布于:2023-04-06 09:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/2cb86346f0aaf4ac02fbbfbd4b1ba88d.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:springboot   access   log

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 48868文章数
  • 14阅读数
  • 0评论数