I am trying to configure my azure asp.net website to send log4net traces to Azure Application Insights. I can see in my azure console page views etc, hence I know that is wo
I also had some problems with sending my Log4Net logs to AI in a Sitecore website. Sitecore has their own implementation of Log4Net so it didn't worked with the AI Nuget package. I've made my own Apprender in which I send the logs to AI.
public class CustomLogFileAppender : SitecoreLogFileAppender
{
protected override void Append(LoggingEvent loggingEvent)
{
if (Sitecore.Context.Site != null )
{
if(loggingEvent.Level == Level.FATAL)
{
AppsInsightsLogHelper.Critical(loggingEvent.RenderedMessage);
}
if (loggingEvent.Level == Level.ERROR)
{
AppsInsightsLogHelper.Error(loggingEvent.RenderedMessage);
}
if (loggingEvent.Level == Level.WARN)
{
AppsInsightsLogHelper.Warning(loggingEvent.RenderedMessage);
}
if(loggingEvent.Level == Level.INFO)
{
AppsInsightsLogHelper.Info(loggingEvent.RenderedMessage);
}
}
base.Append(loggingEvent);
}
}
In sitecore.config:
...