3

Is there some simple placeholder I can use in the application.properties, something like:

logging.file=myApplication-${timestamp}.log

without any additional xml files or anything like that?

Trant
  • 3,461
  • 6
  • 35
  • 57

2 Answers2

2

No, you can't configure it without an additional logging configuration file specific to the logging framework itself (log4j, logback, ...). This is what the documentation mentions:

To configure the more fine-grained settings of a logging system you need to use the native configuration format supported by the LoggingSystem in question.

This answer explains how you could configure this for Logback.

Community
  • 1
  • 1
g00glen00b
  • 41,995
  • 13
  • 95
  • 133
0

If you are on unix based machine you can do so in shell script.

--logging.file=application-"$(date '+%Y-%m-%d:%H:::%M')".log

or

#!/bin/sh: append_date = "$(date '+%Y-%m-%d:%H:::%M')" java -jar spring-application.jar --logging.file=application-$append_date .log

Shahbaz
  • 141
  • 2
  • 7