Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tomcat not creating access logs in springboot

I followed the instructions in this answer and springboot documentation to add the following in application.properties.

I can see these properties at https://localhost:9999/actuator/configprops and the requests I make at https://localhost:9999/actuator/httptrace but no access log file gets created.

I have to log4j2 logs files created in the same folder, so I do not think it is a file write problem or similar.

How can I debug this further?

server.tomcat.accesslog.buffered=false
server.tomcat.accesslog.directory=logs
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.file-date-format=.yyyy-MM-dd
server.tomcat.accesslog.pattern=common
server.tomcat.accesslog.prefix=access_log
server.tomcat.accesslog.rename-on-rotate=false
server.tomcat.accesslog.request-attributes-enabled=true
server.tomcat.accesslog.rotate=true
server.tomcat.accesslog.suffix=.log
like image 447
Miserable Variable Avatar asked Apr 03 '19 21:04

Miserable Variable


People also ask

What is spring boot embedded Tomcat?

Spring Boot is a popular Java-based framework to develop microservices. By default, the Spring Tool Suite (STS) IDE -- which is used to build a Spring Boot application -- will automatically create an embedded Tomcat server with the microservices developed each time a build or deployment occurs.


Video Answer


1 Answers

Access logs are getting created after I defined server.tomcat.basedir in application.properties. Its value seems to be relative to to where I am running it from.

catalina.base default value is a temporary directory in my $TMP, which is where the access logs get created without this setting

like image 89
Miserable Variable Avatar answered Oct 09 '22 10:10

Miserable Variable