public static IApplicationBuilder UseLogging(this IApplicationBuilder app) { var logRepository = LogManagerLog4Net.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); Log.Info("Logging configured."); return(app); }
private void OpenLogs(object sender, RoutedEventArgs e) { var rootAppender = ((Hierarchy)LogManager.GetRepository(Assembly.GetEntryAssembly())) .Root.Appenders.OfType <FileAppender>() .FirstOrDefault(); var filename = rootAppender != null ? rootAppender.File : string.Empty; var filein = new FileInfo(filename); Process.Start(new ProcessStartInfo("explorer.exe", $"{filein.DirectoryName}") { CreateNoWindow = true }); }
private void OpenLogs(object sender, RoutedEventArgs e) { try { var rootAppender = ((Hierarchy)LogManager.GetRepository(Assembly.GetEntryAssembly())) .Root.Appenders.OfType <FileAppender>().FirstOrDefault(); var filename = rootAppender != null ? rootAppender.File : string.Empty; var filein = new FileInfo(filename); Process.Start(new ProcessStartInfo("explorer.exe", $"{filein.DirectoryName}") { CreateNoWindow = true }); } catch (Exception ex) { #if RELEASE // System.IO //Path.GetFullPath(String path) //System.IO.FileInfo //System.IO.FileInfo..ctor(String originalPath, String fullPath, String fileName, Boolean isNormalized) //System.IO.FileInfo //System.IO.FileInfo..ctor(String fileName) //Kebler.Views //TopBarView.OpenLogs(Object sender, RoutedEventArgs e) //System.Windows //RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) //System.Windows //EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) //System.Windows //UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) //System.Windows //UIElement.RaiseEvent(RoutedEventArgs e) //System.Windows.Controls //MenuItem.InvokeClickAfterRender(Object arg) //System.Windows.Threading //ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) //System.Windows.Threading //ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) Crashes.TrackError(ex); #endif } }
private App() { Instance = this; ConfigService.LoadConfig(); SetEnv(); var args = Environment.GetCommandLineArgs(); FileAssociations.EnsureAssociationsSet(); foreach (var arg in args) { var fileInfo = new FileInfo(arg); if (fileInfo.Extension.Equals(".torrent")) { torrentsToAdd.Add(fileInfo.FullName); } } var logRepo = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepo, new FileInfo("log4net.config")); RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; //log4net.Config.XmlConfigurator.Configure(null); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Current.DispatcherUnhandledException += Dispatcher_UnhandledException; if (Current.Dispatcher != null) { Current.Dispatcher.UnhandledException += Dispatcher_UnhandledException; } InitializeComponent(); }