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 Answer 1

0

The -D options belong before the -jar option:

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.