I would like to obtain the date(timestamp) of my logger in a program. I configured my logger like this:
var fileTarget = new FileTarget();
string folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string fullPath = Path.Combine(folder, "Log.txt");
if (!File.Exists(fullPath))
{
File.Create(fullPath);
}
fileTarget.FileName = fullPath;
config.AddTarget("file", fileTarget);
var fileRule = new LoggingRule("*", LogLevel.Warn, fileTarget);
config.LoggingRules.Add(fileRule);
LogManager.Configuration = config;
In my program, I have the following:
class Program
{
static Logger log = LogManager.GetCurrentClassLogger();
static void Main(string[] args)
{
log.Warn("Testing");
//How can I check the logging time here?
}
}
I can not figure out how to do it. Any help will be appreciated