0

I'm running STS on a mac (10.11.5 El Capitan).

I created a basic Spring Boot application which needs to read an external log4j.properties file on my file system. I created a folder on my machine, set a system variable (LOG_CONFIG_HOME) in ~/.bash_profile and when i 'echo $LOG_CONFI_HOME', i see the correct path.

In the Boot application.yml file, i have this:

...
logging:
  config: ${LOG_CONFIG_HOME}/log4j.properties
...

When I run this as a Spring Boot application, i get

'Could not resolve placeholder 'LOG_CONFIG_HOME' in string value "${LOG_CONFIG_HOME}/log4j.properties".

I searched stack & googled trying to solve this.

One suggestion was to restart eclipse. I did that but still the error persists.

Another was to run 'eclipse' from the command line b/c otherwise, it doesn't have access to system variables (???). Doesn't seem legit - i tried to do this but in the STS folder, all i have is STS.app so no clue how to run this from the command line.

I even restarted my machine.

What do i have to do to fix this? This application (with the externalized log config) has to also run on windows as well, so any mac-specific tricks won't work.

Roman C
  • 49,761
  • 33
  • 66
  • 176
maspen
  • 301
  • 1
  • 6
  • 17
  • Did you try passing it as an argument to boot startup? like `--LOG_CONFIG_HOME=fileLocation` – K139 Jun 09 '16 at 21:04
  • i didn't. however, when i run the application from the command line, it works! there's something about 'eclipse' on the mac ... when i do this on windows, it works from within eclipse – maspen Jun 09 '16 at 21:12
  • eclipse fails to get a variable – Roman C Jun 09 '16 at 21:30
  • properties in `.bash_profile` are only available in the shell not for applications you launch from your desktop. See the answer on http://stackoverflow.com/questions/603785/environment-variables-in-mac-os-x on how to set environment variables. – M. Deinum Jun 10 '16 at 06:14

0 Answers0