title: How much to log within an application and how much is too much?
body: <p>Just wondering how much people log within their applications???</p>
  
  <p>I have seen this:</p>
  
  <blockquote>
    <p>"I typically like to use the ERROR log
    level to log any exceptions that are
    caught by the application. I will use
    the INFO log level as a "first level"
    debugging scheme to show whenever I
    enter or exit a method. From there I
    use the DEBUG log level to trace
    detailed information. The FATAL log
    level is used for any exceptions that
    I have failed to catch in my web based
    applications."</p>
  </blockquote>
  
  <p>Which had this code sample with it:</p>
  
  <pre><code>Public Class LogSample
  
     Private Shared ReadOnly Log As log4net.ILog = log4net.LogManager.GetLogger(GetType(LogSample))
  
     Public Function AddNumbers(ByVal Number1 As Integer, ByVal Number2 As Integer) As Integer
  
        Dim intResults As Integer
  
        Log.Info("Starting AddNumbers Method...")
        Log.Debug("Number1 Specified: " &amp; Number1)
        Log.Debug("Number2 Specified: " &amp; Number2)
  
        intResults = Number1 + Number2
  
        Try
  
           intResults = Number1 + Number2
  
        Catch ex As Exception
  
           Log.Error("Error Adding Nubmers.", ex)
  
        End Try
  
        Log.Info("AddNumbers Method Complete.")
  
        Return intResults
  
     End Function
  
  End Class 
  </code></pre>
  
  <p>But this just seems to add so much to the method. For instance a class that would normally be maybe 7 lines of code suddenly becomes 12 lines of code. The method also loses some of its clarity and simplicity.</p>
  
  <p>But in saying that the benefit of having the logging in place can be good. For instance performance monitoring in a production system, chasing down aberrant bugs in production (not that you would have all this logging turned on all the time.</p>
  
  <p>Hence I am wondering what people do?
  Cheers
  Anthony </p>