日志重写

This commit is contained in:
a88359121
2025-07-31 11:04:47 +08:00
parent a803360523
commit 941564d8a4
28 changed files with 325 additions and 399 deletions
+6 -4
View File
@@ -2,6 +2,8 @@
using JinYuan.Helper;
using JinYuan.Models;
using JinYuan.VirtualDataLibrary;
using NLog;
using NLog.Config;
using System;
using System.Collections.Generic;
using System.Configuration;
@@ -36,6 +38,7 @@ namespace LargeSquareOne
[STAThread]
static void Main()
{
LoggerHelp.WriteInfo("Application 启动");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string strname = Process.GetCurrentProcess().ProcessName;
@@ -66,7 +69,7 @@ namespace LargeSquareOne
{
Application.Run(new FrmMain());
}
}
catch (Exception ex)
{
@@ -83,7 +86,6 @@ namespace LargeSquareOne
public static void ReadConfig()
{
LogHelper.Instance.InitLog(Application.StartupPath + "\\Logs\\");
IniConfigHelper.CreateIniFile(Application.StartupPath + "\\Config\\", "Configure.ini");
string connString = ConfigurationManager.ConnectionStrings["connString"].ToString();
string connString2 = ConfigurationManager.ConnectionStrings["connString2"].ToString();
@@ -91,7 +93,7 @@ namespace LargeSquareOne
var connDbType = (SqlSugar.DbType)Enum.Parse(typeof(SqlSugar.DbType), strDBType);
CommonMethods.db.SetConnectionStr(connString, connDbType);
CommonMethods.dbServer.SetConnectionStr(connString2, connDbType);
CommonMethods.sysConfig.SwipeCardMode=Convert.ToBoolean(IniConfigHelper.ReadIniData("配置信息", "开启刷卡模式", "false"));
CommonMethods.sysConfig.SwipeCardMode = Convert.ToBoolean(IniConfigHelper.ReadIniData("配置信息", "开启刷卡模式", "false"));
}
@@ -107,7 +109,7 @@ namespace LargeSquareOne
{
Exception ex = (Exception)e.ExceptionObject;
LogHelper.Instance.WriteEX(ex);
LoggerHelp.WriteEX(ex);
MessageBox.Show($"程序出现大异常,请联系 【金源自动化软件设计部】。\r\n异常信息: {ex.Message}\r\n异常堆栈:{ex.StackTrace}",
"致命错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}