Use ServletContext.getContextPath()?
If you have a more complex deployment you might want to preface it with
ServletContext.getVirtualServerName()
Mark
On 10/01/2022 05:00, Makarov Alexey wrote:
Hello! I want to print application name in my log files. As I know, I
must implemet custom log formatter. How I can get application name?
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
public class MyCustomLogFormatter extends Formatter {
@Override
public String format(LogRecord record) {
String webappName = ...;
return String.format("%s/n", webappName); // only application
name for testing
}
}
I use Tomcat 9.0.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]