/// <summary> /// Create NLog config to log in 2 targets: file and console /// </summary> public static N.Config.LoggingConfiguration CreateConfigFileAndConsole(string filePath, string pattern) { var config = new N.Config.LoggingConfiguration(); N.Targets.FileTarget targetFile = GetFileTarget(filePath, pattern); N.Targets.ConsoleTarget targetConsole = GetConsoleTarget(pattern); config.AddRule(N.LogLevel.Trace, N.LogLevel.Fatal, targetFile); config.AddRule(N.LogLevel.Trace, N.LogLevel.Fatal, targetConsole); config.DefaultCultureInfo = CultureInfo.InvariantCulture; return(config); }
private static void StartLogger() { //logging var config = new NLog.Config.LoggingConfiguration(); var traceTarget = new NLog.Targets.TraceTarget(); var consoleTarget = new NLog.Targets.ConsoleTarget(); config.AddRule(LogLevel.Trace, LogLevel.Fatal, traceTarget); config.AddRule(LogLevel.Trace, LogLevel.Fatal, consoleTarget); LogManager.Configuration = config; LogManager.GetCurrentClassLogger().Info("Application started."); }
public MainWindow() { InitializeComponent(); Title = $"外观检查自动报告 v{Application.ResourceAssembly.GetName().Version.ToString()}"; //Nlog var config = new NLog.Config.LoggingConfiguration(); // Targets where to log to: File and Console var logfile = new NLog.Targets.FileTarget("logfile") { FileName = @"Log\LogFile.txt" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); // Rules for mapping loggers to targets config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); // Apply config LogManager.Configuration = config; log = LogManager.GetCurrentClassLogger(); //TODO:考虑放到App.xaml中 //IKernel kernel = new StandardKernel(new NinjectDependencyResolver()); //var dataRepository = kernel.Get<IDataRepository>(); BridgeDeckGrid.DataContext = new GridViewModel(); SuperSpaceGrid.DataContext = new GridViewModel(BridgePart.SuperSpace); SubSpaceGrid.DataContext = new GridViewModel(BridgePart.SubSpace); var appConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); bool commentColumnInsertTable; commentColumnInsertTable = Convert.ToBoolean(appConfig.AppSettings.Settings["CommentColumnInsertTable"].Value); if (commentColumnInsertTable) { CommentColumnInsertTableCheckBox.IsChecked = true; } else { CommentColumnInsertTableCheckBox.IsChecked = false; } CheckForUpdateInStarup(); //启动时检查更新 }
void ConfigureLogging() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = String.Format("{0}.log", AppDomain.CurrentDomain.FriendlyName) }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(_minConsoleLogLevel, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); LogManager.Configuration = config; }
/// <summary> /// Generates the properly connection for each log /// </summary> private static void ConfigureLog() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "log.txt" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); LogManager.Configuration = config; }
private static void PreparaLog() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "Monitor.log" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); LogManager.Configuration = config; Log = LogManager.GetCurrentClassLogger(); }
private MyLogger() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "system.log" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Trace, LogLevel.Error, logconsole); config.AddRule(LogLevel.Trace, LogLevel.Error, logfile); NLog.LogManager.Configuration = config; mLogger = NLog.LogManager.GetCurrentClassLogger(); }
public App() { var config = new NLog.Config.LoggingConfiguration(); // Setup loggers. var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "file.txt" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); // Rules for mapping loggers. config.AddRule(LogLevel.Debug, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); // Apply configuration to logger. LogManager.Configuration = config; // Initialize MessageBus Using Dispatcher Action <Action> uiThreadMarshaller = action => Dispatcher.Invoke(DispatcherPriority.Normal, action); Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // Configure the tray icon. Assembly a = Assembly.GetExecutingAssembly(); Stream st = a.GetManifestResourceStream("Brizbee.Integration.Utility.Images.favicon.ico"); icon.Icon = new Icon(st); icon.Visible = true; icon.ShowBalloonTip(2000, "BRIZBEE Integration Utility", "Started", ToolTipIcon.Info); icon.MouseClick += icon_MouseClick; var strip = new ContextMenuStrip(); strip.Items.Add("Open..."); strip.Items.Add("-"); strip.Items.Add("Send Log Files..."); strip.Items.Add("-"); strip.Items.Add("Exit"); strip.ItemClicked += contexMenuStrip_ItemClicked; icon.ContextMenuStrip = strip; // Show the main window on first startup. MainWindow = new WizardWindow(); MainWindow.Show(); MainWindow.Focus(); }
private void ConfigLogger() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget() { FileName = Settings.LoggingFile }; var logconsole = new NLog.Targets.ConsoleTarget(); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); LogManager.Configuration = config; }
private void InitLogger(string _logFile = DefaultLogFile) { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = _logFile }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); LogManager.Configuration = config; }
public Logging() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = Setting.LoggingLocation }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); NLog.LogManager.Configuration = config; }
public static void Initialize() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "BellScheduler.log" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); NLog.LogManager.Configuration = config; }
static LoggerController() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "Log.txt" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); NLog.LogManager.Configuration = config; }
public OpenWeatherMapService() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "log.txt" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); LogManager.Configuration = config; }
public MainWindow() { InitializeComponent(); var config = new NLog.Config.LoggingConfiguration(); // Targets where to log to: File and Console string logFilePath = "migration-" + DateTime.Now.ToFileTime().ToString() + ".log"; var logfile = new NLog.Targets.FileTarget("logfile") { FileName = logFilePath, Layout = "${longdate} | ${level:uppercase=true:padding=-5:fixedLength=true} | ${logger:padding=-35:fixedLength=true} | ${message}" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole") { Layout = "${longdate} | ${level:uppercase=true:padding=-5:fixedLength=true} | ${logger:padding=-35:fixedLength=true} | ${message}" }; // Rules for mapping loggers to targets config.AddRule(LogLevel.Trace, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); // Apply config NLog.LogManager.Configuration = config; MigrationGridList = (GridList)this.Resources["MigrationGridList"]; _Timer = new DispatcherTimer(DispatcherPriority.Background) { Interval = TimeSpan.FromSeconds(3) }; _Timer.Tick += (s, e) => { var nextMigration = MigrationGridList.FirstOrDefault(x => x.State == "waiting"); if ((nextMigration != null) && (MigrationGridList.Where(x => x.State == "running").Count() < vapiConnection.MAX_MIGRATIONS)) { nextMigration.State = "running"; SortGridCollection(); RunMigration(nextMigration); } else if ((MigrationGridList.Where(x => x.State == "running").Count() == 0) && (nextMigration == null)) { _Timer.Stop(); btnSelectFile.IsEnabled = true; btnStartMigration.Content = "Migration Complete"; vapiConnection.Disconnect(); } }; }
static void Main() { //ConfigurationManager.AppSettings.Add("Bill Info", "Billing Info --"); //Application.ApplicationExit += Application_ApplicationExit; // Application.ThreadExit += Application_ThreadExit; //Application. ImageIO.CheckNCreateDirectory(Globals.logDirPath); ImageIO.CheckNCreateDirectory(Globals.receiptDir); ImageIO.CheckNCreateDirectory(Globals.PrintDir); ImageIO.CheckNCreateDirectory(Globals.ProcessedImagesDir); ImageIO.CheckNCreateDirectory(ConfigurationManager.AppSettings["ReceiptBackupDir"]); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = Globals.logDir }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); NLog.LogManager.Configuration = config; NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { if (ConfigurationManager.AppSettings["Mode"] == "Diagnostic") { logger.Log(NLog.LogLevel.Info, "Starting application....................................."); } Application.Run(new PrintaPic()); } catch (Exception e) { if (ConfigurationManager.AppSettings["Mode"] == "Diagnostic") { logger.Log(NLog.LogLevel.Error, e.Message); } } }
public static void Register(HttpConfiguration config) { var fileConfig = new AutoConfigField <FileTarget>( key: "logging.file.settings", description: "Logger settings for logging to a file", defaultVal: new FileTarget() { Name = "file", Layout = @"${longdate}|${logger:shortName=true}|${level:uppercase=true}|${message}", FileName = @"C:\Users\Nolan\Desktop\${shortdate}.txt", } ); var fileLevel = new AutoConfigField <string>( key: "logging.file.level", description: "What level the file logger should log at", defaultVal: "Info" ); // Setup logging var logConfig = new NLog.Config.LoggingConfiguration(); // File logging if (!string.Equals("off", fileLevel, StringComparison.InvariantCultureIgnoreCase)) { logConfig.AddTarget(fileConfig); logConfig.AddRule(LogLevel.FromString(fileLevel), LogLevel.Off, fileConfig.Value.Name); } LogManager.Configuration = logConfig; }
public static IServiceCollection AddCommonLogging(this IServiceCollection services) { var properties = new NameValueCollection(); var nlogAdapter = new NLogLoggerFactoryAdapter(properties); LogManager.Adapter = nlogAdapter; var config = new NLog.Config.LoggingConfiguration(); config.AddTarget("console", new ConsoleTarget { Layout = "${my-layout}" }); config.AddRule(NLog.LogLevel.Trace, NLog.LogLevel.Fatal, "console"); NLog.Config.ConfigurationItemFactory.Default.RegisterItemsFromAssembly(Assembly.GetExecutingAssembly()); NLog.LogManager.Configuration = config; return(services.AddScoped <ILog>(sp => { var context = sp.GetRequiredService <DefaultServiceContext>(); // inject context info to Logger NLog.MappedDiagnosticsLogicalContext.Set("corp-id", context.CorpId); NLog.MappedDiagnosticsLogicalContext.Set("user-id", context.UserId); return LogManager.GetLogger("app"); })); }
public static void Initialize(ScriptContext context) { var config = new NLog.Config.LoggingConfiguration(); // Targets where to log to: File and Console var logfile = new NLog.Targets.FileTarget("logfile") { FileName = GetDefaultLogPath(), Layout = "${date:format=HH\\:mm\\:ss:padding=-10:fixedlength=true} ${gdc:item=Script:padding=-20:fixedlength=true} ${level:uppercase=true:padding=-10:fixedlength=true} ${gdc:item=User:padding=-35:fixedlength=true} ${gdc:item=Patient:padding=-35:fixedlength=true} ${message}${onexception:${newline} ${exception:format=Message,StackTrace:separator=\r\n}}" }; // Rules for mapping loggers to targets config.AddRule(LogLevel.Trace, LogLevel.Fatal, logfile); // Apply config LogManager.Configuration = config; GlobalDiagnosticsContext.Set("Script", "Dosimetry Helper"); GlobalDiagnosticsContext.Set("User", $"{context.CurrentUser.Name} ({context.CurrentUser.Id})"); GlobalDiagnosticsContext.Set("Patient", $"{context.Patient.LastName}, {context.Patient.FirstName} ({context.Patient.Id})"); // Clear the log every day and save yesterday's log in case there were errors that need to be looked into if (File.Exists(GetDefaultLogPath()) && DateTime.Now.Day != File.GetLastWriteTime(GetDefaultLogPath()).Day) { File.Delete(GetOldLogPath()); File.Copy(GetDefaultLogPath(), GetOldLogPath()); File.Delete(GetDefaultLogPath()); } }
/// <summary> /// Inizialize log /// </summary> private void InizializeLog() { var config = new NLog.Config.LoggingConfiguration(); // Targets where to log to: File and Console var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "Log.txt" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); // Apply config NLog.LogManager.Configuration = config; }
// ModLoader Injection public static void InitMod() { var caller = Assembly.GetEntryAssembly()?.GetName().Name; var server = caller != null && caller.Equals("TerrariaServer"); if (caller == null || server) { return; } var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = $"{AssemblyDirectory}/logs/client.log", MaxArchiveFiles = 10, Layout = Layout.FromString("${longdate}|${level:uppercase=true}|${logger}|${threadid}|${message}|${exception:format=tostring}"), ArchiveOldFileOnStartup = true }; config.AddRule(LogLevel.Trace, LogLevel.Fatal, logfile); LogManager.Configuration = config; try { Main.OnEnginePreload += () => { var myMod = new MyMod(LogManager.GetLogger("StreamIntegration")); }; } catch (Exception e) { var logger = LogManager.GetCurrentClassLogger(); logger.Error(e, "Error loading mod"); } }
public WPFLogger(MainWindow userForm) { form = userForm; //Cleanup old log if (File.Exists(Path.Combine(Directory.GetParent(App.GetExecutablePath()).FullName, "CaptureLog.txt"))) { File.Delete(Path.Combine(Directory.GetParent(App.GetExecutablePath()).FullName, "CaptureLog.txt")); } var LoggingConfig = new NLog.Config.LoggingConfiguration(); FileVersionInfo v = FileVersionInfo.GetVersionInfo(App.GetExecutablePath()); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "${specialfolder:folder=ApplicationData:cached=true}/AmongUsCapture/logs/latest.log", ArchiveFileName = "${specialfolder:folder=ApplicationData:cached=true}/AmongUsCapture/logs/{#}.log", ArchiveNumbering = ArchiveNumberingMode.Date, Layout = "${time:universalTime=True} | ${message}", MaxArchiveFiles = 5, ArchiveOldFileOnStartup = true, ArchiveDateFormat = "yyyy-MM-dd HH_mm_ss", Header = $"Capture version: {v.FileMajorPart}.{v.FileMinorPart}.{v.FileBuildPart}.{v.FilePrivatePart}\n", Footer = $"\nCapture version: {v.FileMajorPart}.{v.FileMinorPart}.{v.FileBuildPart}.{v.FilePrivatePart}" }; LoggingConfig.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); NLog.LogManager.Configuration = LoggingConfig; logger = LogManager.GetLogger("WPFLogger"); }
private void InitializeLogger() { var logFile = LayerBlockchainNetwork.GetIpAddress().Replace(':', '_') + ".txt"; var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = logFile }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Trace, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Trace, LogLevel.Fatal, logfile); LogManager.Configuration = config; }
public GlobalData() { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "Log.txt" }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); deviceInfo = new DataComModal(); NLog.LogManager.Configuration = config; notificationManager = new NotificationManager(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, CityInfoContext cityInfoContext) { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "nlog-${shortdate}.log" }; config.AddRule(NLog.LogLevel.Debug, NLog.LogLevel.Fatal, logfile); NLog.LogManager.Configuration = config; //loggerFactory.AddProvider(new NLog.Extensions.Logging.NLogLoggerProvider()); loggerFactory.AddNLog(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/error"); } cityInfoContext.EnsureSeedDataForcontext(); app.UseStatusCodePages(); app.UseMvc(); //app.Run(async (context) => //{ // await context.Response.WriteAsync("Hello World!"); //}); }
public static void init_logging(logConfig userConfig) { // Logging var config = new NLog.Config.LoggingConfiguration(); // Targets where to log to: File and Console //var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "file.txt" }; var logconsole = new NLog.Targets.ColoredConsoleTarget("logconsole"); LogLevel userLogLevel = LogLevel.Info; if (userConfig.logLevel.ToLower() == "debug") { userLogLevel = LogLevel.Debug; } if (userConfig.logLevel.ToLower() == "warning") { userLogLevel = LogLevel.Warn; } if (userConfig.logLevel.ToLower() == "error") { userLogLevel = LogLevel.Error; } if (userConfig.logLevel.ToLower() == "fatal") { userLogLevel = LogLevel.Fatal; } // Rules for mapping loggers to targets config.AddRule(userLogLevel, LogLevel.Fatal, logconsole); // Apply config NLog.LogManager.Configuration = config; }
protected override void RegisterTypes(IContainerRegistry containerRegistry) { #region Log var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "log/file.txt" }; config.AddRule(NLog.LogLevel.Debug, NLog.LogLevel.Fatal, logfile); NLog.LogManager.Configuration = config; var factory = new NLog.Extensions.Logging.NLogLoggerFactory(); Microsoft.Extensions.Logging.ILogger logger = factory.CreateLogger(""); containerRegistry.RegisterInstance <Microsoft.Extensions.Logging.ILogger>(logger); var log = Container.Resolve <Microsoft.Extensions.Logging.ILogger>(); log.LogInformation("Test in RegisterTypes"); #endregion //containerRegistry.RegisterInstance(typeof(ILocalizerService), // "LocalizerService", // new LocalizerService("zh-TW"), // new ContainerControlledLifetimeManager()); //containerRegistry.RegisterInstance<ILocalizerService, LocalizerService("zh-TW")>(new ContainerControlledLifetimeManager()); containerRegistry.RegisterSingleton <ILocalizerService, LocalizerService>(); containerRegistry.RegisterSingleton <IMessageService, MessageService>(); containerRegistry.RegisterSingleton <IApplicationCommands, ApplicationCommandsProxy>(); containerRegistry.RegisterInstance <IFlyoutService>(Container.Resolve <FlyoutService>()); }
private void SetLoggingPreferences() { var config = new NLog.Config.LoggingConfiguration(); var console = new NLog.Targets.ConsoleTarget("logconsole"); // Keep loglevel off by default. NLog.LogLevel minLogLevel; // If both Debug and Verbose are passed, Debug takes priority as NLog.Debug loglevel ranks lower than NLog.Info. // We will display all the log levels in between NLOG.Debug to NLog.Fatal(includes NLog.Info). if (MyInvocation.BoundParameters.ContainsKey("Debug")) { minLogLevel = NLog.LogLevel.Debug; } else if (MyInvocation.BoundParameters.ContainsKey("Verbose")) { minLogLevel = NLog.LogLevel.Info; } else { minLogLevel = NLog.LogLevel.Off; } config.AddRule(minLogLevel, NLog.LogLevel.Fatal, console); NLog.LogManager.Configuration = config; }
static void Main() { var config = new NLog.Config.LoggingConfiguration(); config.AddRule(LogLevel.Debug, LogLevel.Fatal, new ColoredConsoleTarget { Layout = new SimpleLayout("${message}") }); LogManager.Configuration = config; Console.WriteLine("Welcome to the aoe2ai snippeter!"); Console.WriteLine("Results will be automatically copied to the clipboard.\n"); var clipboard = new Clipboard(); var transpiler = new Transpiler(); while (true) { Console.Write(">"); var content = Console.ReadLine(); var result = transpiler.Transpile(content).Render(new IFormatter[] { new IndentedDefrule(), new IndentedCondition() }); if (!string.IsNullOrWhiteSpace(result)) { clipboard.SetText(result); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"\n{result}\n"); Console.ForegroundColor = ConsoleColor.Gray; } } }
public static void Main(string[] args) { var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "zbrozonoidWebService.log" }; config.AddRule(NLog.LogLevel.Info, NLog.LogLevel.Fatal, logfile); config.AddRule(NLog.LogLevel.Debug, NLog.LogLevel.Debug, logfile); LogManager.Configuration = config; Logger.Info("start"); CreateWebHostBuilder(args).Build().Run(); }