locked
.net core 3.1 Microsoft.Extensions.Logging.Log4Net.AspNetCore not logging to a file RRS feed

All replies

  • User-939850651 posted

    Hi comicrage,

    According to the code you provided, I have some confusion.

    Did you modify part of the code? There are many problems with the code you have given, such as:

    1. UserStartup<Startup>() 
    UseStartup<Startup>()
    2. public static void SetupConfiguration(WebHostBuilderContext ctx, IConfiguration builder)
    IConfigurationBuilder interface.
    3. AddEnvironmentalVariables()
    AddEnvironmentVariables()
    4. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory)
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
    5. <staticLogFileName value="false">
    <staticLogFileName value="false"/>

    I'm not sure if this is all the existing problems, I modified them and ran the code. And found that the log file has been generated, it is located in the bin\Debug folder under the project path. Just like this:

    If there is no exception during the code execution, you can check under the Bin file. I think this is because of the path configuration.

    Hope this can help you.

    Best regards,

    Xudong Peng

    Thursday, May 6, 2021 7:21 AM
  • User956626884 posted

    Thanks for the help

    Thursday, May 6, 2021 11:08 AM