Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

[RESOLVED] Universal StreamWriter logging updating file in real time

$
0
0
I have created a Logging class which inside hosts 4 static methods of writing to a text file: BeginLog, Log, EndLog, and SendLog. Right now these all use the same class level defined StreamWriter variable. I initially did this so I wouldn't have to constantly create new ones and keep checking if ones are open/closed/etc... However, I noticed that changes won't be saved in the text file until the StreamWriter is closed/disposed.

I tried wrapping each one in a using block, but kept getting constant errors because so many places call writing to the log that it eventually tries writing to a closed stream...

Any ideas on how the best implementation for this would be, so that the log basically gets 'saved' after each write without worrying about how many writes are occuring.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>