I tried to get the directory of the console application using the below code,
Assembly.GetExecutingAssembly().Location
but this one gives m
Here is a simple logging method
using System.IO;
private static void logWrite(string filename, string text)
{
string filepath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\" + filename;
using (StreamWriter sw = File.AppendText(filepath))
{
sw.WriteLine(text);
Console.WriteLine(text);
}
}
Usage:
logWrite("Log.txt", "Test");