diff --git a/src/SiteMonitor/Program.cs b/src/SiteMonitor/Program.cs
index d0cbb2d..27f6431 100644
--- a/src/SiteMonitor/Program.cs
+++ b/src/SiteMonitor/Program.cs
@@ -1,16 +1,37 @@
using System;
+using System.IO;
using Avalonia;
using Avalonia.ReactiveUI;
+using log4net;
+using log4net.Config;
+
namespace SiteMonitor;
internal sealed class Program {
+ ///
+ /// The logger.
+ ///
+ private static readonly ILog LOG = LogManager.GetLogger(typeof(Program));
+
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) {
+#if DEBUG
+ XmlConfigurator.Configure(new FileInfo("log4net.debug.config"));
+#else
+ XmlConfigurator.Configure(new FileInfo("log4net.config"));
+#endif
+
+ LOG.Info("Started application");
+
+ AppDomain.CurrentDomain.UnhandledException += (_, exceptArgs) => {
+ LOG.Fatal("Unhandled exception", exceptArgs.ExceptionObject as Exception);
+ };
+
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
diff --git a/src/SiteMonitor/log4net.config b/src/SiteMonitor/log4net.config
new file mode 100644
index 0000000..bd2408f
--- /dev/null
+++ b/src/SiteMonitor/log4net.config
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/SiteMonitor/log4net.debug.config b/src/SiteMonitor/log4net.debug.config
new file mode 100644
index 0000000..59e6ecd
--- /dev/null
+++ b/src/SiteMonitor/log4net.debug.config
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file