Hello,
I call this function Logger.Write("TEST"); from a WinForm application several times!
When I close the WinForm, it does not exit correctly.
It hangs. Thread I close all. (see the code)
Does anyone see the cause? Can anyone tell me the solution?
Thanks for your help in advance!
Something has to be open or is it static?
////////////////////////////////////////////////////////////////
private void btnInit_Click(object sender, EventArgs e)
{
string retInit= MyApp.Init("C:\\MyApp\\", "C:\\MyApp\\MyAppManual.XML", "C:\\MyApp\\Log\\");
txtResponse.Text += retInit + Environment.NewLine;
}
private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
{
MyApp.Close();
}
public static string Init(string rootPath, string configfile, string logFolder)
{
try
{
string currentPath = Directory.GetCurrentDirectory();
string logPath = currentPath + "\\Log\\";
var dirLog = Directory.CreateDirectory("C:\\MyApp\\LogMES\\");
Logger.LogDirPath = "C:\\MyApp\\Log"; // XX
Logger.Write("TEST");
public static void Close()
{
Logger.Close();
}
See logging code in the attachment.
119512-logging.txt