Reputation: 1834
VS08-WIN7-What account does VS08's ASP.NET development web server run as? I am trying to write to a log file.
protected void Page_Load(object sender, EventArgs e)
{
System.Diagnostics.Trace.WriteLineIf(lifecycleSwitch.TraceInfo,
string.Format("{0:yyyy-MM-dd HH:mm:ss.ffff}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}", DateTime.Now, "Page",
this.GetType().Name, "Page_Load", "Start", User.Identity.Name, Thread.CurrentThread.ManagedThreadId, Request.Url.PathAndQuery, Session.SessionID));
Response.Write(Environment.UserName);
System.Diagnostics.Trace.WriteLineIf(lifecycleSwitch.TraceInfo,
string.Format("{0:yyyy-MM-dd HH:mm:ss.ffff}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}", DateTime.Now, "Page",
this.GetType().Name, "Page_Load", "Start", User.Identity.Name, Thread.CurrentThread.ManagedThreadId, Request.Url.PathAndQuery, Session.SessionID));
}
But, the log file keeps displaying empty. Is it a permissions issue on the folder where the logfile lives? Here is the corresponding web.config section.
<system.diagnostics>
<switches>
<add name="Lifecycle" value="4"/>
</switches>
<trace autoflush="false" indentsize="0">
<listeners>
<add name="LifecycleLog" type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\Logs\lifecycle.log"/>
</listeners>
</trace>
Upvotes: 0
Views: 265