Return to Snippet

Revision: 27636
at June 18, 2010 02:46 by mracoker


Initial Code
private void Log(string txt)
        {
            string logFile = Server.MapPath("/") + "log.txt";

            // create a writer and open the file
            TextWriter tw = new StreamWriter(logFile, true);

            // write a line of text to the file
            tw.WriteLine(DateTime.Now + " >> " + txt);

            // close the stream
            tw.Close();            
        }

Initial URL

                                

Initial Description

                                

Initial Title
Simple Log File

Initial Tags
file, c, log

Initial Language
C#