473,395 Members | 1,649 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,395 software developers and data experts.

Is writting to a shared log file an issue for ASP.Net app?

I have an ASP.Net app that is wrtting some log information into a log file.
All I have is one single log file used by the web application and shared
cross all the sessions. What I don't understand is what will happen if one
session is trying to write the file while another is currently writting to
it. Is that going causing a conflict? Sometimes I saw messages like "...
can't access the file. it may be accessed by other process...". Could this be
because of that confilict or something else that's totally unrelated?

If some one could shed some light on this one it would be highly appreciated.

Thanks in advance.

feng
Nov 19 '05 #1
1 1247
Feng wrote:
I have an ASP.Net app that is wrtting some log information into a log file.
All I have is one single log file used by the web application and shared
cross all the sessions. What I don't understand is what will happen if one
session is trying to write the file while another is currently writting to
it. Is that going causing a conflict? Sometimes I saw messages like "...
can't access the file. it may be accessed by other process...". Could this be
because of that confilict or something else that's totally unrelated?

If some one could shed some light on this one it would be highly appreciated.

Thanks in advance.

feng


Yes, basically your one file is being locked as one thread
(user/request) has it opened for writing. Then another user/request
comes along and is denied access until it's released.

You'd either have to make it thread-safe yourself (synchronize/lock the
access to the file, which depending on load, performance may be
hindered), or use some other logging mechanism. I believe a framework
like log4net has taken care of this (logging to a flat file), and is the
quickest fix IMHO; see their GlobalContext class:

http://logging.apache.org/log4net/

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #2

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

Similar topics

10
by: John Brock | last post by:
I have a base class with several derived classes (I'm writing in VB.NET). I want each derived class to have a unique class ID (a String), and I want the derived classes to inherit from the base...
12
by: Corey Burnett | last post by:
I have a client that has a split database (front-end/back-end). They are also using Access security - MDW file. The front end MDE file, the back end MDB file, and the MDW file are all located on...
7
by: clusardi2k | last post by:
Hello, I have a shared drive on SGI, Linux, and Windows. A second call to fopen doesn't create the file if it has been deleted. I would like to use fopen for its pointer return value to...
10
by: BLiTZWiNG | last post by:
When I try the following: System.IO.File.Copy("C:\\test_read\\test.txt", "\\\\192.168.0.5\\test_write\\test.txt", false) I get an UnauthorizedAccessException. I cannot however, seem to find...
11
by: Brett | last post by:
I have an assembly on a shared LAN drive. On my developer machine, I give that assembly full trust from the .NET wizard. It works fine. I go to a user machine on the LAN, map to the shared...
0
by: Shiraz | last post by:
Hi I have a question regarding the functionality of merge modules. Since this relates to my previous queries, I'll just give you a brief background on the topic. I had to make an installer for...
2
by: sotto | last post by:
I'm building a control with a property which values depend on the current different files in a resourcefile. Users that use my control can edit the property by selecting from a dropdownlist which...
2
by: Darrel | last post by:
I'm working on an app where the ASPX pages aren't precompiled with the class.vb files I'm. This is so people can add their own ASPX pages down the road to the app (the .aspx pages become...
4
by: brian | last post by:
Hello I get this error when trying to create a file: Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.