Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Writing to a log file
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01405172
Message ID:
01405461
Views:
47
Thank you very much, Rick.

>Here's a quick and dirty log routine I use in apps on occasion:
>
>
>        /// <summary>
>        /// Simple Logging method that allows quickly writing a string to a file
>        /// </summary>
>        /// <param name="output"></param>
>        /// <param name="filename"></param>
>        public static void LogString(string output, string filename)
>        {
>            StreamWriter Writer = new StreamWriter(filename, true);
>            Writer.WriteLine(DateTime.Now.ToString() + " - " + output);
>            Writer.Close();
>        }
>
>
>This version appends to the end of the file.
>
>Note if you do this in ASP.NET you have to give the Web application rights to write in the output path - by default it won't have those rights.
>
>+++ Rick ---
>>Hi,
>>
>>I want to implement a quick-and-dirty error log of my ASP.NET application. Basically I want to find a function similar to VFP StrToFile() so that I can write an error/problem to a text file in a certain folder.
>>
>>Can someone suggest a class/method for doing that?
>>
>>Thank you in advance.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform