diff --git a/Projects/DLL/System.Configuration.ConfigurationManager.dll b/Projects/DLL/System.Configuration.ConfigurationManager.dll
new file mode 100644
index 0000000..7d0b114
Binary files /dev/null and b/Projects/DLL/System.Configuration.ConfigurationManager.dll differ
diff --git a/Projects/DLL/SystemX.Core.dll b/Projects/DLL/SystemX.Core.dll
new file mode 100644
index 0000000..85de55b
Binary files /dev/null and b/Projects/DLL/SystemX.Core.dll differ
diff --git a/Projects/DLL/log4net.dll b/Projects/DLL/log4net.dll
new file mode 100644
index 0000000..a11cb29
Binary files /dev/null and b/Projects/DLL/log4net.dll differ
diff --git a/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac b/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac
index d02f50c..380c56b 100644
Binary files a/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac and b/Projects/HubX/DBPatch/sqlScripts/dacpac/HubX.DB.dacpac differ
diff --git a/Projects/HubX/HubX.Server/HubX.Server.csproj b/Projects/HubX/HubX.Server/HubX.Server.csproj
index 9daa180..d3bb312 100644
--- a/Projects/HubX/HubX.Server/HubX.Server.csproj
+++ b/Projects/HubX/HubX.Server/HubX.Server.csproj
@@ -10,4 +10,10 @@
+
+
+ ..\..\DLL\SystemX.Core.dll
+
+
+
diff --git a/Projects/HubX/HubX.Server/Program.cs b/Projects/HubX/HubX.Server/Program.cs
index 48863a6..c56fe2d 100644
--- a/Projects/HubX/HubX.Server/Program.cs
+++ b/Projects/HubX/HubX.Server/Program.cs
@@ -1,3 +1,5 @@
+using SystemX.Core.Log4net;
+
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
@@ -16,6 +18,9 @@ if (app.Environment.IsDevelopment())
app.UseSwaggerUI();
}
+Log4net.WriteLine("Run");
+Log4net.WriteLine("Custom LogLevel",LogType.DB);
+
app.UseHttpsRedirection();
app.UseAuthorization();
diff --git a/Projects/HubX/HubX.Server/log4net.config b/Projects/HubX/HubX.Server/log4net.config
new file mode 100644
index 0000000..216c878
--- /dev/null
+++ b/Projects/HubX/HubX.Server/log4net.config
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Projects/SystemX.Core/SystemX.Core/Log4net/Log4net.cs b/Projects/SystemX.Core/SystemX.Core/Log4net/Log4net.cs
new file mode 100644
index 0000000..d7ea1a8
--- /dev/null
+++ b/Projects/SystemX.Core/SystemX.Core/Log4net/Log4net.cs
@@ -0,0 +1,249 @@
+using log4net;
+using log4net.Repository;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SystemX.Core.Log4net
+{
+ #region LogType
+ public enum LogType
+ {
+ //default level
+ Info = 0,
+ Warn = 1,
+ Error = 2,
+ Debug = 3,
+ Fatal = 4,
+
+ //custom level
+ DB = 10,
+
+ HTTP = 20,
+ SOCKET = 21,
+ }
+ #endregion
+
+ #region CustomLevel
+ public static class Log4netCustomLevel
+ {
+ public static readonly log4net.Core.Level DB = new log4net.Core.Level(10010, LogType.DB.ToString());
+ public static readonly log4net.Core.Level HTTP = new log4net.Core.Level(10020, LogType.HTTP.ToString());
+ public static readonly log4net.Core.Level SOCKET = new log4net.Core.Level(10021, LogType.SOCKET.ToString());
+
+ public static void SetCustomLevel(ILoggerRepository repo)
+ {
+ repo.LevelMap.Add(DB);
+ repo.LevelMap.Add(HTTP);
+ repo.LevelMap.Add(SOCKET);
+ }
+ }
+ #endregion
+
+ public static class Log4net
+ {
+ private static ILog? Manager;
+
+ private static ILoggerRepository repo = LogManager.GetRepository();
+
+ public static bool IsConfigLoad { get; set; } = false;
+
+
+
+ static Log4net()
+ {
+ Console.WriteLine("log4net constructor");
+ if (File.Exists("./log4net.config") == false)
+ {
+ File.WriteAllText("log4net.config", Config);
+ }
+
+ IsConfigLoad = OpenConfig(@"./log4net.config");
+ }
+
+ private static bool OpenConfig(string path)
+ {
+ bool result = true;
+
+ try
+ {
+ Log4netCustomLevel.SetCustomLevel(repo);
+
+ if (File.Exists(path) == false)
+ result = false;
+
+ log4net.Config.XmlConfigurator.Configure(new FileInfo(path));
+ Manager = LogManager.GetLogger("");
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Log4net Init Error");
+ Console.WriteLine(e.Message);
+ result = false;
+ }
+
+ return result;
+ }
+
+ public static void WriteLine(T log, LogType logType = LogType.Info)
+ {
+ if (IsConfigLoad == false)
+ {
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine($"[Log4net Initialize Error] {log}");
+ return;
+ }
+
+ switch (logType)
+ {
+ case LogType.Info:
+ {
+ Manager?.Info(log);
+ break;
+ }
+ case LogType.Warn:
+ {
+ Manager?.Warn(log);
+ break;
+ }
+ case LogType.Error:
+ {
+ Manager?.Error(log);
+ break;
+ }
+ case LogType.Debug:
+ {
+ Manager?.Debug(log);
+ break;
+ }
+ case LogType.Fatal:
+ {
+ Manager?.Fatal(log);
+ break;
+ }
+ case LogType.DB:
+ {
+ Type? t = MethodBase.GetCurrentMethod()?.DeclaringType;
+ if (t != null)
+ {
+ Manager?.Logger.Log(t, Log4netCustomLevel.DB, log, null);
+ }
+ break;
+ }
+ case LogType.HTTP:
+ {
+ Type? t = MethodBase.GetCurrentMethod()?.DeclaringType;
+ if (t != null)
+ {
+ Manager?.Logger.Log(t, Log4netCustomLevel.HTTP, log, null);
+ }
+ break;
+ }
+ case LogType.SOCKET:
+ {
+ Type? t = MethodBase.GetCurrentMethod()?.DeclaringType;
+ if (t != null)
+ {
+ Manager?.Logger.Log(t, Log4netCustomLevel.SOCKET, log, null);
+ }
+ break;
+ }
+ }
+ }
+
+ public static void WriteLine(Exception? ex)
+ {
+ WriteLine(ex?.Message, LogType.Error);
+ }
+
+
+ #region Config
+ static string Config = @$"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+";
+ #endregion
+ }
+}
+
+/*
+log4net 지정 가능 색상
+Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow, Gray,
+DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White
+ */
\ No newline at end of file
diff --git a/Projects/SystemX.Core/SystemX.Core/SystemX.Core.csproj b/Projects/SystemX.Core/SystemX.Core/SystemX.Core.csproj
index fa71b7a..1d7f086 100644
--- a/Projects/SystemX.Core/SystemX.Core/SystemX.Core.csproj
+++ b/Projects/SystemX.Core/SystemX.Core/SystemX.Core.csproj
@@ -4,6 +4,24 @@
net8.0
enable
enable
+ OnBuildSuccess
+
+ 9999
+
+
+
+ 9999
+
+
+
+
+
+
+
+
+
+
+