Closed githubpratibha closed 5 years ago
@githubpratibha thanks for creating a new ticket. First of all : you do not need:
azure.application-insights.logger.type=console
azure.application-insights.logger.level=trace
These properties have nothing to do with configuring logging appender. Instead these are meant to enable debug logs for Application Insight Java SDK. (nonetheless its good that you have kept it enabled. Do you see any wired exceptions etc that come out of Application Insights SDK in your stack trace? They should be prefixed with AI: ).
Some clarification questions that will help me. Do you see, any logs at all on your AI resource?
If yes, do you only see the logs for the module in which the AI dependencies are added but not for the transitive module you depend on?
Also where is your log4j config file placed? Is it configured in the main application?
The easiest and most quick way to debug might also be if you can possibly upload a sample dummy application to test the behavior.
Thanks @dhaval24 for looking into this I just fixed it by updating pom.xml for core module.Just excluded the unnecessary dependencies specially the ones which have logging dependencies included in their dependency tree. Because we are already providing appinsights log4j2 dependency in app module pom.xml we should exclude all other dependencies which have logging dependencies included in their dependency tree. Otherwise, they clash and no logs are sent to app-insight.
Awesome @githubpratibha that is great! Thanks for updating. Please feel free to open any issues on Github if you face further problems.
Expected behavior
logs should be captured in azure app insight for all the modules Following document for Configure Springboot Application to send log4j logs to Application Insights
Actual behavior
unable to see spring boot app logs in appinsight while using different spring modules
To Reproduce
@dhaval24 I have two separate spring boot java modules. One is added as dependency in another. I am not able to push spring boot logs to app insight.Kindly help please
==============log4j2.xml in app module resources folder===============
<?xml version="1.0" encoding="UTF-8" ?>
===========application.properties in app module==========
azure.application-insights.instrumentation-key=XXXXXX
spring.application.name=preferencecenter-app
azure.application-insights.enabled=true
azure.application-insights.logger.type=console
azure.application-insights.logger.level=trace
===============pom.xml for core module================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
========pom.xml for app module in which core module is added as dependency====
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
System information
Please provide the following information: