Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning logs are written to eventlog.xml file by default #10721

Open
soninaren opened this issue Jan 6, 2025 · 0 comments
Open

Warning logs are written to eventlog.xml file by default #10721

soninaren opened this issue Jan 6, 2025 · 0 comments

Comments

@soninaren
Copy link
Member

For dotnet-isolated app, All the warning log statements are written to C:\home\LogFiles\eventlog.xml. The issue can be reproduced by creating a dotnet-isolated app on windows with consumption plan and adding a warning statement like the one below to an httpTrigger function.

We should not be warning logs to eventlog.xml file by default.

Sample Host.json

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request"
            },
            "enableLiveMetricsFilters": true
        }
    }
}

Sample httpTrigger

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;

namespace FunctionApp1
{
    public class HttpTrigger1
    {
        private readonly ILogger<HttpTrigger1> _logger;

        public HttpTrigger1(ILogger<HttpTrigger1> logger)
        {
            _logger = logger;
        }

        [Function("HttpTrigger1")]
        public IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req)
        {
            _logger.LogInformation("C# HTTP trigger function processed a request.");
            _logger.LogWarning("Warning: C# HTTP trigger function processed a request.");
            return new OkObjectResult("Welcome to Azure Functions!");
        }
    }
}

EventLog.xml

<Event>
        <System>
            <Provider Name=".NET Runtime"/>
            <EventID>1000</EventID>
            <Level>2</Level>
            <Task>0</Task>
            <Keywords>Keywords</Keywords>
            <TimeCreated SystemTime="2025-01-06T23:29:45Z"/>
            <EventRecordID>215192484</EventRecordID>
            <Channel>Application</Channel>
            <Computer>10-30-0-213</Computer>
            <Security/>
        </System>
        <EventData>
            <Data>Category: Company.Function.HttpTrigger1
EventId: 0
SpanId: 7bc6584d3be812b1
TraceId: 320e172a69ac9a7823693d63e127194a
ParentId: 0000000000000000
AzureFunctions_InvocationId: 1b651c08-5a7d-4eab-bb27-268e60698613
AzureFunctions_FunctionName: HttpTrigger1

Warning: C# HTTP trigger function processed a request.
</Data>
        </EventData>
    </Event>
</Events>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant