I am working on creating a web service (using C #) and this web service is an MS SQL The server will use the database. Now, I'm trying to create an exception log system for this web service. Simply, I want to save every exception to web service for future use (bug tracing).
Where is the best place to save these exceptions? Is it good to save in database? What if the exception is in relation to the database?
You have 3 options:
-
log file - The best option I really like to use because I can easily deal with the entries and see through it I also log in with the following format for the following files: AppName \ YYYY \ MM \ DD \ yourfile.log Create a directory for files so that I can see how a particular day was viewed (in some cases enter There are years of rocking). Threading is not a problem. You can make it thread safe, this is a very safe way because you will not have access to almost always on disk unless your disk is full, which can handle one of the other options. .
-
Database - It's also good because you can ask it easily. There is a big chance of failure in it and in my opinion it should not be used for primary logging. If you are driving down the DB then you are facing issues which cause an exception, where will you store it ?
-
System event log - It is very good with 1 or 2 or can affect your DB performance. Both. The event log will almost always be available and this is what Windows uses (assuming a Windows server) so it is very safe You can also create app specific exceptions so that you can filter all the Windows specific stuff that you do not mind Want to do Although it only stores a specific amount, so your history may be reduced, depending on how much you are throwing so that you want a way to export this data at one time.
Most of my apps use a combination of 1 and 2. We started our logging and it worked well for us, but there are some great libraries to help with it. We have a home-made tool to monitor our server event logs for our specific items and to inform the right people based on specific criteria if possible. It is setup as a pull process from another server, so that there can be problems in the server, where it probably can not send a notification, the monitoring server should eventually be able to obtain data and get the right information.
Key, depending on the key logging for you and your application, there is redundancy if you go back to the DB route, then back up. Backups if you go on file paths In most cases logging may fail in specific cases, so it is important to be important in more than one way to store the required information. This failed due to logging methods for any reason when I save a ton of time to detect problems.
Comments
Post a Comment