ApplicationInsights-Java
ApplicationInsights-Java copied to clipboard
logging - apply layout for log4j event
Fix Custom layout pattern like "%d --- %m%n" can not be used with appinsights log4j v2.
The PatternLayout has no effect on the log4j sent to Azure AppInsights:
e.g:
<Configuration packages="com.microsoft.applicationinsights.log4j.v2">
<Appenders>
<ApplicationInsightsAppender name="aiAppender" instrumentationKey="my_instrumentation_key">
<PatternLayout pattern="%d --- %m%n" />
</ApplicationInsightsAppender>
</Appenders>
<Loggers>
<AsyncRoot level="INFO">
<AppenderRef ref="aiAppender" />
</AsyncRoot>
<!-- AsyncLogger -->
...
</Loggers>
</Configuration>
Hello @littleaj, can you please review this PR ?
Hi @skaabaoui, the MDC properties should already be getting captured under customDimensions
Hi @skaabaoui, the MDC properties should already be getting captured under
customDimensions
Hi @trask, thank you for your feedback. the issue here that for any custom pattern that you define using PatternLayout in the log4j2.xml file, has no effect in the format of the trace displayed on appinsights.
We have always the default trace format of appinsights logs. Using this fix, we can change the trace format of the logs sent to appinsights according to our custom PatternLayout.
Hi @trask, Can you please review this PR or ask someone to review it ?
Dear Members,
Can someone please review this PR ? Thank you.
Best Regards,
Dear Members,
Can you please review this PR ?
Kind Regards, Salah.
Any updates on this? I have the same issue: custom logback layout is not used in App Insights
@skaabaoui How did you solve it?