static void Main(string[] arguments) { var runPath = AppDomain.CurrentDomain.BaseDirectory; using (SerilogSupport.InitLogger(new Uri(string.Concat(runPath, "serilog.config")))) { AppDomain.CurrentDomain.UnhandledException += (sender, args) => { var ex = args.ExceptionObject as Exception; Logging.Log().Error(ex, "Unhandled exception: {ExceptionObject} (isTerminating: {IsTerminating})", args.ExceptionObject, args.IsTerminating); }; Logging.Log().Information("Version: {ApplicationVersion}", typeof(Program).Assembly.GetName().Version); var assemblyLocation = typeof(Program).Assembly.Location; if (assemblyLocation != null) { var productVersion = FileVersionInfo.GetVersionInfo(assemblyLocation).ProductVersion; Logging.Log().Information("Product Version: {ApplicationVersion}", typeof(Program).Assembly.GetName().Version); } var environment = EnvironmentResolver.GetEnvironmentName(); IAppCache cache = new CachingService { DefaultCacheDuration = 60 * 5 }; IConfigReader configReader = ConfigReaderFactory.Create(cache, environment, "API"); IWebApiConfiguration webApiConfig = new WebApiConfig(configReader); Host.Run(() => new ServiceApp(webApiConfig)); Logging.Log().Information("Application terminated."); } }
static void Main(string[] argss) { ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; var environment = EnvironmentResolver.GetEnvironmentName(); IAppCache cache = new CachingService { DefaultCacheDuration = 60 * 5 }; IConfigReader configReader = ConfigReaderFactory.Create(cache, environment, "WORKER"); IWorkerConfiguration workerConfig = new WorkerConfig(configReader); Host.Run(() => new ServiceApp(workerConfig)); }
private static void Main(string[] args) { // Initial the Gtk GUI framework. Application.Init("Author Intrusion", ref args); // We use the Inversion of Control (IoC) container to resolve all the // elements of the window. This lets everything wire up together without // having a lot of maintenance or singletons. var resolver = new EnvironmentResolver(); // Set up the environment. resolver.LoadPluginManager(); // Create the main window, show its contents, and start the Gtk loop. try { var projectManager = new ProjectManager(); var mainWindow = new MainWindow(projectManager); mainWindow.ShowAll(); // If we have some arguments, try to load the file as project. if (args.Length > 0) { var projectFile = new FileInfo(args[0]); mainWindow.OpenProject(projectFile); } // Start running the application. Application.Run(); } catch (Exception exception) { Console.WriteLine("There was an exception"); Exception e = exception; while (e != null) { Console.WriteLine("=== EXCEPTION"); Console.WriteLine(e); e = e.InnerException; } throw; } }
private static void Main(string[] args) { // Initial the Gtk GUI framework. Application.Init("Author Intrusion", ref args); // We use the Inversion of Control (IoC) container to resolve all the // elements of the window. This lets everything wire up together without // having a lot of maintenance or singletons. var resolver = new EnvironmentResolver(); // Set up the environment. resolver.LoadPluginManager(); // Create the main window, show its contents, and start the Gtk loop. try { var projectManager = new ProjectManager(); var mainWindow = new MainWindow(projectManager); mainWindow.ShowAll(); // If we have some arguments, try to load the file as project. if (args.Length > 0) { var projectFile = new FileInfo(args[0]); mainWindow.OpenProject(projectFile); } // Start running the application. Application.Run(); } catch (Exception exception) { Console.WriteLine("There was an exception"); Exception e = exception; while (e != null) { Console.WriteLine("=== EXCEPTION"); Console.WriteLine(e); e = e.InnerException; } throw; } }
/// <inheritdoc /> public virtual void Initialize(LoggingEvent fromEvent, KafkaLayoutParameters parameters) { if (fromEvent == null) { throw new ArgumentNullException(nameof(fromEvent)); } Application = parameters?.Application; CustomTags = EnvironmentResolver.Resolve(parameters?.CustomTags); Exception = fromEvent.ExceptionObject != null ? new KafkaMessageExceptionDto(fromEvent.ExceptionObject) : null; Level = fromEvent.Level.Name; LoggerName = fromEvent.Repository.Name; Message = fromEvent.RenderedMessage; Timestamp = fromEvent.TimeStampUtc.ToString("o"); foreach (string key in fromEvent.Properties.GetKeys().Distinct()) { AdditionalParameters[key] = fromEvent.Properties[key]; } foreach (string propName in parameters?.IncludeProperties ?? new List <string>()) { object value = GlobalContext.Properties[propName] ?? LogicalThreadContext.Properties[propName]; if (value is LogicalThreadContextStack ltc) { value = ltc.Count > 0 ? ltc.ToString() : null; } if (value != null || (parameters?.SendNullValues ?? true)) { AdditionalParameters[propName] = value; } } }
/// <summary> /// Main entry point into the application. /// </summary> /// <param name="args">The arguments.</param> private static void Main(string[] args) { // Create the IoC/DI resolver. var resolver = new EnvironmentResolver(); }
/// <summary> /// Main entry point into the application. /// </summary> /// <param name="args">The arguments.</param> private static void Main(string[] args) { // Create the IoC/DI resolver. var resolver = new EnvironmentResolver(); }