public AppLogManager(string fullConfigFilePath, Assembly assembly) { var logRepo = log4net.LogManager.GetRepository(assembly); log4net.Config.XmlConfigurator.Configure(logRepo, new FileInfo(fullConfigFilePath)); _logManager = new AppLogManager(); }
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .ConfigureLogging((hostingContext, logging) => { var assembly = Assembly.GetAssembly(typeof(Program)); var pathToConfig = Path.Combine( hostingContext.HostingEnvironment.ContentRootPath , "log4net.config"); var logManager = new AppLogManager(pathToConfig, assembly); logging.AddLog4Net(new Log4NetProviderOptions { ExternalConfigurationSetup = true }); }) .UseStartup <Startup>() .CaptureStartupErrors(true) .UseSetting(WebHostDefaults.DetailedErrorsKey, "true") //.UseSetting("detailedErrors", "true") ;