Reputation: 12621
I am using spring/hibernate application. i am using log4j for logging. the problem is i need to place a placeholder in log4j.properties file and i need to set the value to the place holder based on the environment(Dev, UAT or Production).
Environment=${environment}
is it possible? Please help me.
Thanks!
Upvotes: 0
Views: 4350
Reputation: 7899
You can pass the variable and value either by command line or set environment variable like below.
-DEnvironment=dev
then you can use this in log file like :
Environment=${Environment}
Upvotes: 4
Reputation: 11815
Why not just use seperate keys, and pick the right one at runtime?
Environment.dev=Development
Environment.prod=Production
Environment.qa=QA
bundle.getKey(ENVIRONMENT_KEY_PREFIX + ".dev");
Upvotes: 1