Description
Using logback 1.1.1
In my logback XML, I have a rolling file appender with the following file:
<file>${HOME:-${USERPROFILE}}/.company/app/logs/app.log</file>
First, logback checks for ${HOME}, and then uses ${USERPROFILE} when it is not defined. This works fantastic in both windows and linux.
One user, in Windows 7, had an environment variable defined:
set HOME=%USERPROFILE%
This is a windows-specific double reference very similar to how %PATH% is defined.
Log back was taking ${HOME}, seeing that it was "%USERPROFILE%", and using that text directly as the file path. During testing / debugging, multiple different exceptions were found, and are included in the attachment.
I suspect that that environment variable should be evaluated until it no longer contains a reference to another environment variable (or infinite evaluation loop is detected). So, %HOME% set to %USERPROFILE% should be evaluated again to set it to "c:\Users\kieveli". In Windows, it's reasonable to have two, three, or maybe more levels of evaluation before the correct value of the environment variable is acquired.
The first exception is with:
<file>${HOME:-${USERPROFILE}}/.company/app/logs/app.log</file>
The second exception is with:
<file>${HOME:-${USERPROFILE}}/app/logs/app.log</file>