I enabled tomcat access logs as per the spring boot reference documentation. But its not working properly. When I enabled it, access log file got created and I can see requests being logged there for that day. But at the start of the next day I don't see any new file. It started logging at 21hrs. Third day it started logging from 02hrs. From 4th day no access logs created.
Here are the properties that I used.
server.tomcat.access-log-enabled=true
server.tomcat.access-log-pattern=%h %l %u %t "%r" %s %b %D
server.tomcat.basedir=/var/lib/org_name/tracking_server
under tracking_server folder logs and work folder got created.
Please let me know if I'm missing something. Regular logging is working perfectly according to the configuration specified in logback.xml
Thanks for your help in advance.
The main Apache Tomcat configuration file is at /opt/bitnami/tomcat/conf/server. xml. Once Apache Tomcat starts, it will create several log files in the /opt/bitnami/tomcat/logs directory.
By default, the Tomcat HTTP Access Logs are stored in the dotserver/tomcat-X.x/logs/ folder within the dotCMS distribution, and the files are named dotcms_access. YYYY-MM-DD. log, where the YYYY-MM-DD in the file name is replaced by the date of the log file.
Java. Now we simply need to run the application and hit http://localhost:8080/log to see the log messages.
That configuration works for me in spring boot version 1.2.3.RELEASE. However, if you have the current version of spring boot, those parameters are a little bit different, reference here:
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.pattern=common # Format pattern for access logs.
As you note, the difference is the hyphen (-).
Additionally, tomcat access log configuration include the following parameters, according to this document:
However, in my version of spring boot (1.2.3.RELEASE) the class org.springframework.boot.autoconfigure.web.ServerProperties there are no values to change those properties (Tomcat subclass). But if you check org.apache.catalina.valves.AccessLogValve you could change this properties:
/** * Should we rotate our log file? Default is true (like old behavior) */ protected boolean rotatable = true; /** * Date format to place in log file name. */ protected String fileDateFormat = ".yyyy-MM-dd";
I know maybe you should play with those parameters. I hope this post help to solve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With