I have following pattern in my log4j2.xml
config file and it is printing the FILE_NAME
variable as expected when it is present:
<Property name="LOG_PATTERN">
%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${hostName} --- $${sys:FILE_NAME} [%15.15t] %-40.40c{1.} : %m%n%ex
</Property>
However, in certain situation, the FILE_NAME property is null/not present, in those cases it is printing the value as ${sys:FILE_NAME}
.
How can I avoid printing this or at least print a null
or empty
value?