Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do we set default value for log4j2 log level instead of environment variable

I'm working with log4j2 configuration xml where in i'm using the environment variable for setting the log level something like this

<Root level="${env:LOG_LEVEL}">

But i want to have some default value in case env var is not set i tried defining some properties in xml but no luck.Thanks

like image 855
Mikey Avatar asked Jun 10 '26 04:06

Mikey


1 Answers

I believe you can specify a default value by specifying another colon followed by a hyphen:

${env:LOG_LEVEL:-WARN}
like image 58
Remko Popma Avatar answered Jun 11 '26 16:06

Remko Popma