TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ram
NA
1
0
Open the log gile to read while it is in use
Aug 19 2009 4:10 PM
Hi All,
I have implemented log functionality in my application which keeps track of all the user activities from the moment the application starts and till user exits the application. In My Application I create an instance of StreamWriter when the application begins and closing Stream Writer when the application exits.
My questions is when my application is running , I want to be able to go to the log file (
\\program
files\\MyApplication\\log.txt") and check the log contents. When I try to pen the log file it throws an error "An error occured. The document could not be opened". How can I view the log file and see the contents when the application is running and writing to the log file?
===============================================================
StreamWriter SW; //global variable
private void StartLogger()
{
string fPath = "
\\Program
Files\\My App\\log.txt;
SW = File.CreateText(fPath );
//Write in to log file
LogEntry("logfile created");
}
private void LogEntry(string entry)
{
SW.WriteLine(entry + "\n");
SW.Flush();
}
Thanks,
Ram
Reply
Answers (
1
)
1.1 .net VS 2003
Dot net framework performance comparison.