I have a custom docker image with a Spring Boot App that I've deployed to Azure Container Registry and now it is running as an App Service. This container is running Tomcat 8.5 and so I have catalina.out
logs and my own custom webapp.log
file that are being created in /usr/local/tomcat/logs
directory. Running outside of Azure in a docker container I can access and view logs.
However, deployed in the App Service I am unable to retrieve the actual log files, and the only place I can see logs is in the Log Stream. I am using log4j2 and have a the proper config file.
Is there a way to access Tomcat catalina and webapp logs? Is it possible to direct the webapp.log to /home/LogFiles/
for a custom container?
I have tried using the following log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="filename">webapp.log</Property>
<Property name="path">$HOME\LogFiles</Property>
</Properties>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
</Console>
<File name="LOGFILE" fileName="${path}\${filename}">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
</File>
</Appenders>
<Loggers>
<Logger name="appLogger" level="debug">
<AppenderRef ref="LOGFILE" level="debug"/>
</Logger>
<Root level="info">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>