473,503 Members | 7,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best practice for threadsafe logging

Hi,

Is there any best practice guidelines or examples for threadsafe logging? I
have to write an auditlogging class for a website. The auditlog will be
stored in files on the local filesystem. A new file file is created by the
interval of 24 hours.

/m
Jul 21 '05 #1
5 2786
"martin" <ma****@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
Hi,

Is there any best practice guidelines or examples for threadsafe logging?
I
have to write an auditlogging class for a website. The auditlog will be
stored in files on the local filesystem. A new file file is created by the
interval of 24 hours.


You can't use the Windows event log?

John Saunders
Jul 21 '05 #2
No, I don't want to log events, I need a complete auditlog.

"John Saunders" wrote:
"martin" <ma****@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
Hi,

Is there any best practice guidelines or examples for threadsafe logging?
I
have to write an auditlogging class for a website. The auditlog will be
stored in files on the local filesystem. A new file file is created by the
interval of 24 hours.


You can't use the Windows event log?

John Saunders

Jul 21 '05 #3
"martin" <ma****@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
No, I don't want to log events, I need a complete auditlog.


Ok, though I presume you're aware that it's possible to create custom event
logs, so that your audit entries would be the only thing in your custom log.

Otherwise, perhaps you should consider a database.

I don't think you're going to find a single best practice on this,
especially since you haven't been very specific about your requirements.
John Saunders
Jul 21 '05 #4
As I wrote in my first question the auditlog must be stored in files on the
local filesystem. I need a thread safe way to write to a file from a website.
Quite simple question I think. I can read in the SDK how to write to a file
thread safe, but I'm lokking for best practice and/or design guidelines for
the best implementation.

/m

"John Saunders" wrote:
"martin" <ma****@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
No, I don't want to log events, I need a complete auditlog.


Ok, though I presume you're aware that it's possible to create custom event
logs, so that your audit entries would be the only thing in your custom log.

Otherwise, perhaps you should consider a database.

I don't think you're going to find a single best practice on this,
especially since you haven't been very specific about your requirements.
John Saunders

Jul 21 '05 #5
"martin" <ma****@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
As I wrote in my first question the auditlog must be stored in files on
the
local filesystem. I need a thread safe way to write to a file from a
website.
Quite simple question I think. I can read in the SDK how to write to a
file
thread safe, but I'm lokking for best practice and/or design guidelines
for
the best implementation.


See, this is what I'm getting at. There's nothing inherently different about
writing to a file with respect to thread-safety. The same techniques you'd
use for doing anything in a thread-safe manner apply to writing to a file.

John Saunders
Jul 21 '05 #6

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

Similar topics

11
8403
by: Jeff Schwab | last post by:
Is it OK for multiple threads to use the same PrintWriter concurrently?
4
1977
by: Sandy | last post by:
Hello - I read an interesting article on the web wherein the author states he doesn't handle too many errors at page level, but handles them at the application level. He further goes on to show...
20
6563
by: Keith G. Murphy | last post by:
I'm trying to get a feel for what most people are doing or consider best practice. Given a mod_perl application talking to a PostgreSQL database on the same host, where different users are...
5
319
by: martin | last post by:
Hi, Is there any best practice guidelines or examples for threadsafe logging? I have to write an auditlogging class for a website. The auditlog will be stored in files on the local filesystem. A...
2
2691
by: philip.mckee | last post by:
Hi Looking for some very general advice. I have a classic asp content management application which I am porting to ASP.NET. The database is SQL server, and it is hoped that we can leverage this...
5
1717
by: csgraham74 | last post by:
Hi guys, Basically i have been developing in dotnet for a couple of years but ive had a few issues in regards to error handling. For example - I have a class that i call passing in a stored...
5
5711
by: Spam Catcher | last post by:
Hi all, I'm accessing a synchronized Streamwriter from potentially several threads to do some logging. Is the Flush command threadsafe too? Should I single thread the Flush command or will the...
1
2918
by: Clausen | last post by:
Hi, Looking for best practice - or just some "what would you do" answers :) Scenario: App1.dll and App2.dll are both referenceing Logging.dll. And both are applications installed at...
5
2456
by: =?Utf-8?B?QmlsbHk=?= | last post by:
asp.net 2.0 vs2005 What is best practice for exception handling on a website in vs2005? I was going to catch errors in application on_error event, log them to the event log, then send users to...
0
7067
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
7264
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
7316
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
7449
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
5562
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,...
1
4992
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
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.