Base solution for your next web application
Open Closed

log4net stopped generating the logs #10034


User avatar
1
ricardo created
  • What is your product version: v10.0.0
  • What is your product type (Angular or MVC) : MVC
  • What is product framework type (.net framework or .net core):net core

Hi, after upgrading to version 10.0.0, Log4Net stopped logging the logs. I'm running visual Studio as an administrator and i have write access to the folder.

log4net.config:

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" >
    <file value="App_Data/Logs/Logs.txt" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="10000KB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%-5level %date [%-5.5thread] %-40.40logger - %message%newline" />
    </layout>
  </appender>
  <root>
    <appender-ref ref="RollingFileAppender" />
    <level value="DEBUG" />
  </root>
</log4net>
 //Configure Abp and Dependency Injection
            return services.AddAbp<EpmWebMvcModule>(options =>
            {
                //Configure Log4Net logging
                options.IocManager.IocContainer.AddFacility<LoggingFacility>(
                    f => f.UseAbpLog4Net().WithConfig(_hostingEnvironment.IsDevelopment()
                        ? "log4net.config"
                        : "log4net.Production.config")
                );

                options.PlugInSources.AddFolder(Path.Combine(_hostingEnvironment.WebRootPath, "Plugins"), SearchOption.AllDirectories);
            });

I'm forgetting something?


3 Answer(s)
  • User Avatar
    0
    ricardo created

    sorry i was looking in the wrong folder

  • User Avatar
    0
    alexanderpilhar created

    I have had the same problem just now - I couldn't find current log files ...

    For anyone wondering where to find them, the correct path is: <root>\src\CompanyName.ProjectName.Web.Host\bin\Debug\net5.0\App_Data\Logs

  • User Avatar
    0
    alexanderpilhar created

    With ASPNETZERO 10.2.0 the path has been changed back and log files can be found in: <root>\src\CompanyName.ProjectName.Web.Host\App_Data\Logs