473,412 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Webform Log file

I created a class to log application event in my webform.
This "Logs" class contains only one static method :

static void WriteLog(string mess)
{
StreamWriter log
log = File.AppendText("file.log");
log.WriteLine(mess);
log.Flush();
log.Close();
}

Logs.WriteLog() is called in the codebehing of my WebForm

Several WebForm can call simultaneously the WriteLog method.
What appends if several people call my Webform at the same time ?
deadlock or Exception ? Or others problems ?

Is it necessary to had a lock(this) around my WriteLog code ?

Thanks

Christian

Nov 18 '05 #1
1 1501
The .NET framework has this functionality built in "almost". You might want
to look at extending the TraceListener class to log this information to a
file. It is fully thread safe, I think.

Here is a link to Microsoft's site about using the TextWriterTraceListener
class.

HTH,

bill
http://msdn.microsoft.com/library/de...classtopic.asp
"Christian (France)" <Christian (France)@discussions.microsoft.com> wrote in
message news:67**********************************@microsof t.com...
I created a class to log application event in my webform.
This "Logs" class contains only one static method :

static void WriteLog(string mess)
{
StreamWriter log
log = File.AppendText("file.log");
log.WriteLine(mess);
log.Flush();
log.Close();
}

Logs.WriteLog() is called in the codebehing of my WebForm

Several WebForm can call simultaneously the WriteLog method.
What appends if several people call my Webform at the same time ?
deadlock or Exception ? Or others problems ?

Is it necessary to had a lock(this) around my WriteLog code ?

Thanks

Christian

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen | last post by:
Hey everyone. I was wondering if someone could help me with a small problem. I have designed a user control and I would have inserted it on a aspz page (WebForm1). The User control is being used to...
0
by: Bita-kookoo | last post by:
I am having a problem with inheritance for my web solution. Here are the steps I took for a project within C#: -I first created a new class, descended from System.Web.UI.Page. For this...
2
by: Tor Inge Rislaa | last post by:
Showing an HTML file in part of a Webform Hi I have a Webform with some buttons on the left side of the form. What I want when clicking one of the buttons is to show an HTML document in a part...
5
by: Jerry | last post by:
I am using .Net 2003. I have been working with this ASP.Net webform that I created a few weeks ago. It has been working fine. However, while modifying the webform today, this webform stopped...
2
by: Matt Theule | last post by:
I need to be able to allow users to drag files to a list box on a web page. To this end, I created a Windows Control and hosted it in a WebForm. When the file is dropped onto the listbox, the...
4
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). ...
6
by: Skeptical | last post by:
Hello, I am trying to embed html output into my webform but could not figure out how to so far. The form will execute a Perl script with some parameters, and script will output some html...
8
by: vinesh | last post by:
I have sample Asp.Net Web Application project. Let me know how to keep the files related to this project (like the webform.aspx, WebForm1.aspx.vb, WebForm1.aspx.resx) in a separate folder within a...
1
by: ffhansix | last post by:
Hi, I have migrated a web site from .NET 1.1.4322 to .NET 2.0. After the migration my Modal webform does not work as it did in 1.1. The webform pops up from a page when a user clicks a button:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.