Exceptions logging improved

main
Inga 🏳‍🌈 14 years ago
parent 94a7562382
commit 276f691d86
  1. 10
      IISMainHandler/WebContext.cs

@ -153,6 +153,12 @@ namespace FLocal.IISHandler {
public void LogError(Exception e) {
using(StreamWriter writer = new StreamWriter(Common.Config.instance.dataDir + "Logs\\" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + "." + Guid.NewGuid() + ".txt")) {
writer.WriteLine("Requested url: " + this.httprequest.RawUrl);
writer.WriteLine("Remote ip: " + this.httprequest.UserHostAddress);
if(this.httprequest.Cookies["session"] != null) {
writer.WriteLine("Session: " + this.httprequest.Cookies["session"].Value);
}
writer.WriteLine();
writer.WriteLine("Exception: " + e.GetType().FullName);
writer.WriteLine(e.Message);
if(e is FLocalException) {
@ -160,10 +166,6 @@ namespace FLocal.IISHandler {
} else {
writer.WriteLine(e.StackTrace);
}
writer.WriteLine();
writer.WriteLine("Requested url: " + this.httprequest.RawUrl);
writer.WriteLine();
writer.WriteLine("Remote ip: " + this.httprequest.UserHostAddress);
}
}

Loading…
Cancel
Save