I have a simple console application that will be deployed as a scheduled job. Below is its pseudo codeMain(string[] args){    //get xml string from database    Reports reports = ReportsDB.GetReport(args[0].ToString());    //Generate xml file using xmwriter    //post the file to sftp site}I was wondering how to include logging functionality for this job. Also, will it be suffice to use a text writer to write to text file every time it is run or use libraries such as log4netEditI should be able to log the execution of the job like start time, debug info, etc. that will be for my self.
How to do logging in console application
c#;logging
First, in general the answer is the same way you'd do logging in any other application.I would strongly recommend using something like log4net or nlog rather than rolling your own using a TextWriter for a number of reasons:There are great, free options out there that will probably result in you writing and maintaining less code -- just making logging target a configuration option is worth the price of admission alone.The great, free options are very performant -- logging is kind of easy until you get into how do I log this without blocking the execution?The great, free options are very reliable -- logging is easy until you get into how do I make sure this fatal exception that killed the program gets flushed to the log?