I'm trying to create a new log file every hour with the following code running on a server. The first log file of the day is being created and written to fine, but no further log files that day get created. Any ideas what might be going wrong? No exceptions are thrown either.
private void LogMessage(Message msg)
{
string name = _logDirectory + DateTime.Today.ToString("yyyyMMddHH") + ".txt";
using (StreamWriter sw = File.AppendText(name))
{
sw.WriteLine(msg.ToString());
}
}