title: Java debug messages/logs which indicate which class or method was entered
body: <p>I currently have to work on an existing Java application in which I could filter out some.java files as complete dead code and hence deleted them.
  The problems were that there were no comments or other hints that these classes were not for production purposes, the call hierarchy was confusing and the guy who wrote this was - of course - already gone.</p>
  
  <p>I only found out by placing System.out.println debugging messages by hand in the code, that indicated if a constructor or method was enetered. If it was a class that was instantiated whil runtime, that was rather fine because then I just could place a </p>
  
  <pre><code>public class public TestObjectClass
  {
      public TestObjectClass(String whatever) // this is the constructor
      {
          System.out.println("Constructor of class " + getClass() + " entered");
          /* some other code folowed */
      } // end constructor
  } // end class
  </code></pre>
  
  <p>and if the log did not indicate this message I knew that the whole class was never used, placing debugging statements in all the methods then was not necessary (no static methods were in those classes).</p>
  
  <p>But there were classes of which no object was created with new statement and thus no explicit constructor was there. Hence I had to place the following in every method in order to find out, if it is used or not</p>
  
  <pre><code>public class ClassThatIsNotInstantiated
  {
      public void someMethodXYZ()
      {
          System.out.println("someMethodXYZ in " + getClass + " is entered.");
          /* some other code followed */
      } // end method
   } // end class
  </code></pre>
  
  <h2>Could that have been done easier and more convenient?</h2>
  
  <p>I was thinking of the Logger class of course, which indicates at least in which class the pointer currently is however...</p>
  
  <ol>
  <li>It does not indicate the class name if it is a runnable .jar that is
  e.g. executed by Jenkins</li>
  <li>I could not a find a way yet to indicate the method with Logger</li>
  <li>Also with Logger I had have to place a this.logger message in every
  method, at least I do not know other possibilities.</li>
  </ol>