469,648 Members | 1,156 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

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 2596
"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Jeff Schwab | last post: by
4 posts views Thread by Sandy | last post: by
5 posts views Thread by martin | last post: by
5 posts views Thread by csgraham74 | last post: by
1 post views Thread by Clausen | last post: by
5 posts views Thread by =?Utf-8?B?QmlsbHk=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.