1

I am using log4cpp for my C++ project. What I need is to generate log files in custom locations instead of current directory. For that, I have set some environment variables for log file path. The problem is how can I use this environment variables in log4cpp property file so that the log files are generated in that locations.

I tried various options like $(ENV_VAR), ${ENV_VAR}, %ENV_VAR% but none are working.

Thanks, Hemant

Hemant
  • 767
  • 6
  • 20
  • a line like `log4cpp.appender.logfile.fileName=${TEMP}\MyProgram.log` used to work with `log4cpp` for me on Windows – AntonK Feb 04 '20 at 17:16

1 Answers1

1

use ${sys:ENV_VAR} instead of ${ENV_VAR}

reference http://logging.apache.org/log4j/2.x/manual/lookups.html