How to add Azure Application insights to a Apache Tomcat application RRS feed

  • Question

  • Hi,

    The provided ms documentation does not offer much detailed information on how to add application insights to an existing tomcat application and could not find any relevant information on multiple google searches.

    Does anybody know how to do this? I am not a java developer and not sure how to add the dependencies to an existing java application on tomcat.

    What I did so far:

    1. Downloaded all the Application Insight JDK jar files into a folder on the tomcat server (windows)
    2. Created ApplicationInsights.xml and added the instrumentation key
    3. Created default AI-Agent.xml in the same folder as 1 and 2
    4. Disabled firewall
    5. Added java options to tomcat8w.exe
        a) -Dapplicationinsights.configurationDirectory=C:\appinsights
        b) -javaagent:C:\appinsights\applicationinsights-agent-2.5.0.jar
    6) Set logging level to debug
    7) Restart Tomcat service 

    We are using newest Tomcat 8.5.47 and Adopt Open JDK (JVM 1.8.0_232-b09).

    The application works but I see no entries in the tomcat logs about application insights and nothing is showing up in azure. 

    Any advice would be helpful. Thanks

    • Edited by Redbull81 Wednesday, October 23, 2019 8:34 AM dependencies
    Tuesday, October 22, 2019 11:16 AM

All replies

  • Setting up Application Insights for an existing app isn't that much different from adding it to a new one. It does depend on how you are configuring your application. If you are manually configuring it as opposed to using Maven or Gradle it is going to be more difficult.

    Have you gone through the standard troubleshooting guide for Java? You can find it here: https://docs.microsoft.com/en-us/azure/azure-monitor/app/java-troubleshoot 

    For troubleshooting purposes, you may also want to try placing the .jar and config files in their default directories instead of using options to load them.

    If you get any information by using the <SDKLogger /> option, could you please share it here?

    Monday, October 28, 2019 2:40 PM