Example #1
0
        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>();
Example #3
0
        public static ILog Log <T>(this T thing)
        {
            var log = AppLogManager.GetLogger <T>();

            return(log);
        }