我有一个 spring-boot 应用程序,在 application.yml 中具有以下配置
server:
contextPath: /rti
tomcat:
access-log-enabled: true
access-log-pattern: "%h %l %u %t \"%r\" %s %b %D"
basedir: tomcat
这会提示创建访问日志 tomcat/logs/access_log.2015-02-12.txt。
我希望能够配置访问日志的创建位置及其名称;但经过大量搜索后,我开始认为这是不可能的。有谁知道如何实现这一目标?
使用 logback 和 logback.xml 中的配置,应用程序日志记录工作正常
配置使用application.yml
(https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html):
server.tomcat.accesslog:
# Enable access log:
enabled: true
# Directory in which log files are created. Can be relative to the tomcat base dir or absolute:
directory: /var/log/test
# Format pattern for access logs:
# https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html#Access_Log_Valve
pattern: "%h %l %u %t "%r" %s %b %D"
# Log file name suffix:
suffix: ".log"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)