p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   Creating a log file for multiple users (http://p2p.wrox.com/showthread.php?t=14520)

patwadd June 22nd, 2004 03:09 PM

Creating a log file for multiple users
I want to create a log file tracking the sequence in which pages are accessed, using a text file. Can multiple users append to a single text file, or do I need to do separate ones for each user? If the former, what happens if more than one user tries to append at the same time?


System 3 2000 Limited

om_prakash June 22nd, 2004 10:53 PM

I think you can lock the file when logging the data, In this case if more than one user tries to append, then it will wait for one process to complete.

An alternative solution is to create table and store the activities in the database.

Om Prakash

madhukp June 22nd, 2004 11:53 PM

I am also facing a similar problem. Thanks for the suggestion Om Prakash.

But,how can I lock a file ? Could you please explain it in some detail ?

om_prakash June 23rd, 2004 05:04 AM

You can use application object to lock:

For example:

  'do some application object operations

Please check the following URL, which might be useful..


Om Prakash

Imar June 23rd, 2004 05:18 AM

Hi there,

Application.Lock does not lock the entire application; all it does is block other ASP pages from writing to the variables stored in the Application object. This is to prevent two users from writing to those variables at the same time.
Even if it would work, it would be a bad idea. It's not very good for performance and availability to lock an entire application for *all* users, just because you need to write to a file.

Personally, I would never try to store information like this in a text file. Text files in Web applications are not an ideal scalable solution.
Why don't you use a database? Databases are designed for multi-user environments.....

Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Micro cuts by Muse (Track 7 from the album: Origin of symmetry) What's This?

madhukp June 23rd, 2004 05:35 AM

Hello Imar,

Suppose we keep the log details in a database, will it be automatically multi-user friendly ? Or should we use stored procedures with transactions ?

Imar June 23rd, 2004 05:40 AM

That depends on the database and the number of users. Most databases are multi user, so you shouldn't have a problem. But some database are limited by the number of users they can serve. Technically, an Access database cannot handle more than 255 users at the same time, but in practice, this limit is hit much sooner.

There is no real need to use stored procedures and transactions, just to enable a multi-user scenario. However, when data integrity is important, you'll have to use transactions anyway (even if you were the only user). You'll also find that Stored Procedures will make database / application development much easier in the end.


Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Sunburn by Muse (Track 1 from the album: Showbiz) What's This?

madhukp June 23rd, 2004 06:08 AM

Hello Imar,

Thanks for this reply.

silver_cuts June 24th, 2004 01:06 AM

Hi imar,madhu

i am also planning to use a log file in my application .. about locking what i wanted to say that instead of locking the application if we lock the database file while we append the lock activities, wont it be a better idea ..

bocz acc. to my knowledge of database locks ... if the database is locked and another request comes that the new request is put in a queue until the first lock is opened ... so i think it will work fine ...more over i will never face the problem about the 255 users of ACCESS which i am using bcoz my application will be used atmost by 50 people all togather ....

so i need ur views on this ...


madhukp June 24th, 2004 01:26 AM

Hi silver_cuts,

I agree with you totally. But I don't know how can I lock and unlock an access / sql server database. I have been searching for this for a long time.

I know how to lock a MySQL database. But I don't find similar features for MS Access and SQL server.

All times are GMT -4. The time now is 05:18 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.