0

I have the following file appender

log4j.appender.file.File=${myFileLoc}/log/mylog.log

However, I want to make sure it still functions properly if someone forgets to set the system property. Is there a way to specify a default value in the properties file?

I do not want to change the log4j.xml in any way. I just want to change the log4j properties file or if possible, make some code change to reflect what i need.

For example, if possible, i can check for the system property in the code and if it is not set, then pass the default value to the logger. Is that feasible?

AbtPst
  • 7,778
  • 17
  • 91
  • 172

1 Answers1

0

I think you can define it like this in properties file. See here.

property.myFileLoc = target/rolling/rollingtest.log

For property substitution in xml file see here. Also please refer to this answer.

Community
  • 1
  • 1
Rajind Ruparathna
  • 2,215
  • 24
  • 55