export logback.configurationFile=123
on mac os x got this:
"-bash: export: `logback.configurationFile=123': not a valid identifier"
Tried export logback_configurationFile=123
that worked. but logback does not seem to recognize that env variable. Any suggestions?
-Dlogback.configurationFile
is not the same as setting it as an Environment variable.
The -D flag is a Java parameter to your program (accessible by System.getProperty()
) while the environment variable defined by export
will be accessible by System.getenv()
.
Looking at the Logback code it looks like it uses System.getProperty()
to read the logback.configurationFile
value.
So in reality you have to pass the parameter to the JVM on startup, this means that you can set the environment variable to whatever you like and then just use it in when you start the JVM.
export LOGBACK_CONFIG_FILE_LOCATION=/tmp/logback.conf
java -Dlogback.configurationFile=${LOGBACK_CONFIG_FILE_LOCATION}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With