write_exception_log
This is an old revision of the document!
Write an exception to a log file
static class ErrorHandling static method WriteErrorLog( oException as Exception ) as void local cFileName as string local oSB as StringBuilder cFileName := Path.Combine( AppDomain.CurrentDomain:BaseDirectory, "XSharpError.log" ) oSB := StringBuilder{ String.Format( "Error occurred in {0} at {1}", Assembly.GetEntryAssembly():Location, DateTime.Now:ToString() ) } oSB:AppendLine( "------------------------------------------------------------" ) oSB:AppendLine( oException:Message ) oSB:AppendLine( "Callstack:" ) oSB:AppendLine( oException:StackTrace ) oSB:AppendLine( "" ) File.AppendAllText( cFileName, oSB:ToString() ) return end class
write_exception_log.1522000248.txt.gz · Last modified: 2018/03/25 17:50 by wolfgangriedmann