473,781 Members | 2,335 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 2818
"martin" <ma****@discuss ions.microsoft. com> wrote in message
news:3B******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> wrote in message
news:3B******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> wrote in message
news:E1******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> wrote in message
news:E1******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> wrote in message
news:74******** *************** ***********@mic rosoft.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
8448
by: Jeff Schwab | last post by:
Is it OK for multiple threads to use the same PrintWriter concurrently?
4
2002
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 how error logging can be incorporated using a Sql Server log with an additional text log in case Sql Server was down. My inclination after reading the article is to use Try-Catch-Finally as little as possible (tends to slow things if you have...
20
6641
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 logging onto the web server using LDAP for authentication, do most people 1) have the web server connecting to the database using its own user account (possibly through ident), and controlling access to different database entities strictly through...
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 new file file is created by the interval of 24 hours. /m
2
2726
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 without significant alterations. There is approx 30 users accessing and managing information using the application. Currently users log on to the system using group logins. A general connection string is used with all communication with the...
5
1736
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 procedure and connection string as a path. My method returns a dataset. In my SP i have an output parameter which tells me whether the SP select is successful or not. If i get a error code passed back then i throw an exception this then returns...
5
5731
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 Synchronized streamwriter handle that for me? Thanks!
1
2930
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 customers. A bugreport is filed under App1.dll about failing logs. Developer fixes the bug which was in Logging.dll. The Logging.dll gets a version bump.
5
2467
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 an error page. But looking at the event log, asp.net 2.0 logs those errors anyways, with more detail than i cen get from the exception object. So is there any point logging them to the event log, is it jsut better to let .net do this and get the...
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10139
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10075
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
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 we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.