0

I am running a SpringBoot application and wanted tomcat access logs to be stored in a directory whose path has to be passed in runtime JVM arguments, because it has to be run on 2 different application containers and the paths can be given by java runtime argument only.

application.properties

server.tomcat.basedir=${log.location}
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%t %a "%r" %s (%D ms)

Giving this tomcat base directory location for work and logs as :

java -jar SpringBoot.jar -Dlog.location=/apps/pricing/logs

But unfortunately it is not affecting. Tomcat work and log directories are being created from the place I am running java command inside a new directory with name "${log.location}", but not creating inside actual log.location=/apps/pricing/logs which is existing directory.

If anyone has any idea please reply.

1 Answers1

0

The -D options belong before the -jar option:

More info: Proper usage of Java -D command-line parameters

Strelok
  • 50,229
  • 9
  • 102
  • 115