0

I want to set default file path for my application, in case ${custom.log.path} is not defined or by any means can't be created than logs should be generated at default location.

I am using spring application, not sure how to configure the default file path.

log4j.properties :

# Root logger option
log4j.rootLogger=DEBUG, file

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=${custom.log.path}/Application.log
log4j.appender.file.MaxFileSize=5MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d [%t] %-5p (%F:%L) - %m%n
Richa Khetan
  • 37
  • 1
  • 12

1 Answers1

1

Check this topic and answers: Is there a way to specify a default property value in Spring XML?

Spring Framework supports the following syntax: ${my.variable:defaultValue}

Marcin Rzepecki
  • 578
  • 4
  • 10