A quick way of logging output messages in the web client to a text file

Sometimes it can be helpful to output information during a server-side code execution to a text file for analysis.  You could always load the web site in Visual Studio and debug from there but adding a quick logger is pretty simple.  All you need to do is include a method like this:

private static void Log(string Message)
    using (System.IO.TextWriter writer = new System.IO.StreamWriter(@"C:\Test_debug_log.txt", true))
        writer.WriteLine(string.Format("{0} - {1}", DateTime.Now, Message));

Then from within your code you can add a line like so:

Log(“Something to be output to your log”);

This will then create or append to the text file specified in your Log procedure. This file is created on the web server machine.


Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!