Base solution for your next web application

Activities of "epro1"

Hi,

I figured out what was the problem. The problem was in encoding of log4net.config file. I changed encoding to UTF-8 without BOM and I now can se logs.txt file under *.WebHost project's bin folder.

Regards.

Hello,

I'm using Angular 2 + .NET core tempate and I have the same configuration as @codemonkey21. My project references are: abp.castle.log4net (1.5.1) castle.loggingfacility.mslogging (1.1.0)

Startup.cs

public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            //MVC
            services.AddMvc(options =>
            {
                options.Filters.Add(new CorsAuthorizationFilterFactory(DefaultCorsPolicyName));
            });

            //Configure CORS for angular2 UI
            services.AddCors(options =>
            {
                options.AddPolicy(DefaultCorsPolicyName, p =>
                {
                    //todo: Get from confiuration
                    p.WithOrigins("http://localhost:4200").AllowAnyHeader().AllowAnyMethod();
                });
            });

            //Swagger - Enable this line and the related lines in Configure method to enable swagger UI
            services.AddSwaggerGen();

            

            //Configure Abp and Dependency Injection
            return services.AddAbp<SuperhikWebHostModule>(options =>
            {
                //Configure Log4Net logging
                options.IocManager.IocContainer.AddFacility<LoggingFacility>(
                    f => f.UseAbpLog4Net().WithConfig("log4net.config")
                );
            });
        }

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>

I can't find log file on location that @codemonkey21 find his or in any other part of my project. I tried to change location of file in log4net.config but nothing helps. What could be the problem? Is there any way to debug log4net?

Any help would be appreciated

Hi,

thanks for your reply. This is exactly what I did :)

Hi,

I was still in initial phase of project and I download template again and since then it is working ok.

Thanks for reply.

Showing 1 to 4 of 4 entries