Not getting Information or Trace logs in Application Insights in .NET 8 function

62 Views Asked by At

I have create a function in VS 2022 using .NET8. Locally its working fine But info logs are not showing in application insights. I am able to see Warning logs and Error logs.

I thought my code could be the issue. I tried with a sample function too, its also not showing any info, or trace logs in Application Insights But locally its showing logs.

using System;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;

namespace Schedule
{
    public class Time
    {
        private readonly ILogger _logger;

        public Time(ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger<Time>();
        }

        [Function("Time")]
        public void Run([TimerTrigger("0 */50 * * * *")] TimerInfo myTimer)
        {
            _logger.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
            
            if (myTimer.ScheduleStatus is not null)
            {
                _logger.LogInformation($"Next timer schedule at: {myTimer.ScheduleStatus.Next}");
                _logger.LogTrace("testing trace logs in Application Insights");
            }
        }
    }
}
{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request"
            },
            "enableLiveMetricsFilters": true
        }
    }
}

Anyone else also facing any similar situation?

0

There are 0 best solutions below