We are sending alert emails out on the fatal log level. But we want to get the context name dynamically.
we are using the same war file for different context. We just rename the war file. So we need a generic solution in the .xml file. Best in the subject line.
I think you can use
Web Lookupfeature provided bylog4j2. It allows to accesscontext pathof the web application using${web:contextPath}syntax. Your configuration file would look like -Check more details of
Web Lookuphere