@ manojkumarmahajan-8101, thanks for the feedback, based on my test, I reproduced your problem.
We also need to check if Error folder exists in your bin/debug folder.
Please make the following change:
static Logger()
{
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
}
logDirectory = outputPath + System.Configuration.ConfigurationSettings.AppSettings["ERRORLOG"].ToString();;
if (File.Exists(logDirectory) && File.ReadAllBytes(logDirectory).Length >= 102400)
{
File.Delete(logDirectory);
}
if (!File.Exists(logDirectory))
{
FileStream fs = File.Create(logDirectory);
fs.Close();
}
sw = File.AppendText(logDirectory);
}
Hope this could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.