I created a logger maintenance module in my C# winform application using following function
Void updatelog(String msg)
{
String folderPath;
String filePath=null;
if (!(System.IO.Directory.Exists("Logger")))
System.IO.Directory.CreateDirectory("Logger ");
}
folderPath=AppDomain.CurrentDomain.BaseDirectory.ToString()+"Logger ";
filePath = folderPath + "\\Logfile.txt";
if (System.IO.File.Exists(filePath))
FileStream fs = new FileStream(filePath, FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(msg);
sw.Flush();
fs.Close();
else
FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
Folder files created in the project location like,
F:\Project\projectABC\bin\Debug
I created the installer for this project and installed in some other machine in the location of
C:\Program Files (x86)\ projectABC \CMS1
But now the application is not creating the folder and log files. Why?
I want to maintain the logger in the application installed location. What to do for this?
Give me some suggestions ..