Logging

A

A.M

Hi,

What would be the best approach to log different items (SQL, Exceptions,
Security, ...)
I have a simple Logging function that adds log string to the end of a text
file.
Is there any application block for that? Should i do the logging into SQL
server table ?

Any help would be apprecited,
Ali
 
A

A.M

Isn't it a heavy load on DB server?

Curt_C said:
I've always preferred using a DB, like MS SQL, to log to. It allows for
easier retrieval later and better reporting.
 
C

Curt_C [MVP]

I've always preferred using a DB, like MS SQL, to log to. It allows for
easier retrieval later and better reporting.
 
G

gabriel

Curt_C said:
I've always preferred using a DB, like MS SQL, to log to. It allows for
easier retrieval later and better reporting.

How do you log a failed login into the database?
 
C

Curt_C [MVP]

not really, I mean it's better then opening files as the file system level
that's for sure....

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
 
B

bruce barker

I use sqlserver, and a background thread to do the logging, this way logging
does not hold up processing. if the logging thread cannot write to
sqlserver, it logs to the event log.

-- bruce (sqlwork.com)
 
G

Guest

There are many places you can log your errors. My prefrence is to use the windows event logs
You can also have your own text file logging. It can be plain text or an XML file
As Curt mentioned SQL is also another alternative and it is also the easiest to report from if you have a need for that kind of stuff

Each of the above methods has their ups and downs

Logging to the event logs>> Web users have to given rights to write to this log and sys admins sometimes wont like this
Logging to your own text file>> Slower than logging to SQL or Event logs. You have manage the file on your own(i.e. how much can it grow, etc
Logging to SQL server>> Logging credentials might fail

It's up to you to figure out what best fits your application and design the best solution

BTW when you are logging errors to the database it would be better to use different credentials to write to the SQL tables other than the credentials used to access your transactional system. Even that's not fail proof so you have to handle a scenario where the credentials fail

A good place to start might be to look at Microsoft's exception management block
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/emab-rm.as

HTH
Suresh

----- gabriel wrote: ----

Curt_C [MVP] wrote
I've always preferred using a DB, like MS SQL, to log to. It allows fo
easier retrieval later and better reporting

How do you log a failed login into the database
 
S

Steven Cheng[MSFT]

Hi Ali,


Thanks for posting here. As for the datasource to store logging info, I
think Curt and bruce's suggestions are quite considerable. In addition, I'm
not sure whether you've used the "Log4Net" component, it is a tool to help
the programmer output log statements to a variety of output targets.
log4net is a port of the excellent log4j framework to the .NET runtime. Its
multi-Adaptors have provide the support to many targets such as database
server, xml log files and event log.. etc. You'may get its info via the
following web link:

#log4net - Features
http://log4net.sourceforge.net/release/latest/doc/features.html

Hope this also helps.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,170
Messages
2,570,925
Members
47,468
Latest member
Fannie44U3

Latest Threads

Top