Click here to Skip to main content
15,885,366 members
Home / Discussions / C#
   

C#

 
AnswerRe: application logging strategy - advice Pin
Richard MacCutchan25-Oct-12 6:23
mveRichard MacCutchan25-Oct-12 6:23 
GeneralRe: application logging strategy - advice Pin
R. Giskard Reventlov25-Oct-12 6:37
R. Giskard Reventlov25-Oct-12 6:37 
GeneralRe: application logging strategy - advice Pin
Simon_Whale25-Oct-12 11:50
Simon_Whale25-Oct-12 11:50 
AnswerRe: application logging strategy - advice Pin
Eddy Vluggen25-Oct-12 8:41
professionalEddy Vluggen25-Oct-12 8:41 
GeneralRe: application logging strategy - advice Pin
Simon_Whale25-Oct-12 12:01
Simon_Whale25-Oct-12 12:01 
AnswerRe: application logging strategy - advice Pin
jschell25-Oct-12 10:43
jschell25-Oct-12 10:43 
GeneralRe: application logging strategy - advice Pin
Simon_Whale25-Oct-12 12:02
Simon_Whale25-Oct-12 12:02 
AnswerRe: application logging strategy - advice Pin
V.25-Oct-12 21:10
professionalV.25-Oct-12 21:10 
I've done some fair logging and mostly the needs depend a little on the application.
There are several questions that need to answering:

1. What
Despite the actual text you might want to log off course, the datetimestamp (go millisecond or smaller!), but also who was the user at the time, what machine, which application, module, class, method and finally you'll need a log type (error, warning, information,...) and severity.

2. When
Concerning the actual log message I usually log every exception and the SQL statements.  Then mostly I add logging at key points eg when receiving information from a webservice call or when we send an email succesfully, ...

3. Where
Mostly one logs to a txt file or something like that.  I find that horrible personally.  If you have one application, no problem, but if you have a system, log to the database.  It will be easier to trace the sequence instead of going through five log files at the same time comparing datetime stamps.  It is always possible to catch a db down and write to txt file as backup.

4. How
Prevent in using a method inside each class, create an assembly that can be used by all applications.  Built in a debug level setting that will prevent logging too verbose when not required.


Hope this helps.

Questionapplicatin developing in c# Pin
krishnaveni_g24-Oct-12 23:29
krishnaveni_g24-Oct-12 23:29 
AnswerRe: applicatin developing in c# Pin
Eddy Vluggen24-Oct-12 23:35
professionalEddy Vluggen24-Oct-12 23:35 
AnswerRe: applicatin developing in c# Pin
Sivaraman Dhamodharan24-Oct-12 23:47
Sivaraman Dhamodharan24-Oct-12 23:47 
AnswerMy vote of 1 Pin
Keith Barrow25-Oct-12 2:49
professionalKeith Barrow25-Oct-12 2:49 
AnswerRe: applicatin developing in c# Pin
Vasudevan Deepak Kumar25-Oct-12 8:54
Vasudevan Deepak Kumar25-Oct-12 8:54 
GeneralRe: applicatin developing in c# Pin
V.26-Oct-12 2:39
professionalV.26-Oct-12 2:39 
AnswerRe: applicatin developing in c# Pin
gopal pradhan8-Nov-12 23:33
gopal pradhan8-Nov-12 23:33 
AnswerRe: applicatin developing in c# Pin
gopal pradhan8-Nov-12 23:34
gopal pradhan8-Nov-12 23:34 
QuestionCreate single setup to install x64 & x86 msi Pin
honeyashu24-Oct-12 21:40
honeyashu24-Oct-12 21:40 
AnswerRe: Create single setup to install x64 & x86 msi Pin
Mycroft Holmes24-Oct-12 22:25
professionalMycroft Holmes24-Oct-12 22:25 
GeneralRe: Create single setup to install x64 & x86 msi Pin
honeyashu24-Oct-12 23:25
honeyashu24-Oct-12 23:25 
GeneralRe: Create single setup to install x64 & x86 msi Pin
Dave Kreskowiak25-Oct-12 4:13
mveDave Kreskowiak25-Oct-12 4:13 
GeneralRe: Create single setup to install x64 & x86 msi Pin
honeyashu25-Oct-12 18:10
honeyashu25-Oct-12 18:10 
GeneralRe: Create single setup to install x64 & x86 msi Pin
Dave Kreskowiak25-Oct-12 18:26
mveDave Kreskowiak25-Oct-12 18:26 
AnswerRe: Create single setup to install x64 & x86 msi Pin
BobJanova24-Oct-12 22:34
BobJanova24-Oct-12 22:34 
Question[Solved] C# WPF - Creating controls based upon SQL results Pin
patrickalexson24-Oct-12 17:23
patrickalexson24-Oct-12 17:23 
AnswerRe: C# WPF - Creating controls based upon SQL results Pin
Mycroft Holmes24-Oct-12 17:50
professionalMycroft Holmes24-Oct-12 17:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.