public static void Main(string[] args) { Console.Title = "MyJetWallet Service.BalanceHistory"; Settings = SettingsReader.GetSettings <SettingsModel>(SettingsFileName); using var loggerFactory = LogConfigurator.ConfigureElk_v2("MyJetWallet", Settings.SeqServiceUrl, Settings.ElkLogs); var logger = loggerFactory.CreateLogger <Program>(); LogFactory = loggerFactory; try { logger.LogInformation("Application is being started"); CreateHostBuilder(loggerFactory, args).Build().Run(); logger.LogInformation("Application has been stopped"); } catch (Exception ex) { logger.LogCritical(ex, "Application has been terminated unexpectedly"); } }
static async Task Main(string[] args) { // var httpClient = new HttpClient(); // httpClient.Timeout = TimeSpan.FromSeconds(5); // // try // { // var resp = httpClient.GetAsync("https://192.168.11.4:9200").GetAwaiter().GetResult(); // // Console.WriteLine(resp.StatusCode); // } // catch (Exception e) // { // Console.WriteLine(e); // } // // return; var elkSettings = new LogElkSettings() { IndexPrefix = "test-01", User = "******", Password = "******", Urls = new Dictionary <string, string>() { { "node1", "https://***:9243" }, { "node2", "https://***:9243" }, { "node3", "https://***:9243" } } }; var loggerFactory = LogConfigurator.ConfigureElk_v2(logElkSettings: elkSettings); var logger = loggerFactory.CreateLogger("test"); while (true) { Log.Logger.Information("Hey serilog"); logger.LogInformation("Hello world"); await Task.Delay(1000); } }