Is it possible to use logback rolling files with a Linux Tomcat Azure Web App?

Camilia Nalo 0 Reputation points
2023-11-08T08:09:48.0533333+00:00

I have a Java application that uses a daily rolling file setup with logback. This works perfectly well on my laptop, but when I deploy this to my Azure Web App (Tomcat on a Linux OS) these logs are not created. Instead I get default logs at the /home/LogFiles directory with names such as 2023_09_06_ln1sdlwk000181_default_docker. If I check the logs directory available in the actual tomcat directory (/usr/local/tomcat/logs), this directory is completely empty.

Do logback rolling files actually work with a Linux Azure Tomcat web app? If not, is there some other way to store the actual logs in a file somewhere?

I also have an appender using application insights, which does seem to work so the logback file is getting picked up. The ${LOGS} environment variable is set to ${HOME}/logs for my Azure Web App (although I've tried multiple paths, which does not seem to make a difference)

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,408 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Camilia Nalo 0 Reputation points
    2023-11-08T15:05:16.4333333+00:00

    I discovered $HOME actually referred to /root in linux and not to /home (strangely enough), so I was able to fix it by changing it to /home/logs instead of using $HOME.

    0 comments No comments

  2. Grmacjon-MSFT 17,456 Reputation points
    2023-11-13T21:33:53.5533333+00:00

    Hi @Camilia Nalo ,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll summazie your issue and repost your solution in case you'd like to "Accept " the answer.

    Issue:

    • You have a Java application that uses a daily rolling file setup with logback.
    • This works well locally, but not on your Azure Web App (Tomcat on a Linux OS).
    • Instead of creating the logback rolling files, the Azure Web App generates default logs in a different directory.
    • You also have an appender using application insights, which works fine. This means the logback file is getting picked up by the Azure Web App, but the rolling file appender is not working as expected.

    Solution:

    • You discovered $HOME was referring to /root in Linux and not to /home. changing it to /home/logs instead of using $HOME solved your problem

    Thank you again for your sharing what worked for you!

    Best,

    Grace

    0 comments No comments