title: Dynamically get the current line number
body: <p>Is there a way in Java to dynamically get the current line number through reflection or some awesome API? Just like when exceptions occur, the line number gets printed out in the stack trace like this:</p>
  
  <pre><code>at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
  </code></pre>
  
  <p>Now is there a way to print or log like in the below code?</p>
  
  <pre><code>log.error("Error in: " + this.getClass.getName() + "at line #"+ this.getClass.getActualLine());
  </code></pre>
  
  <p>You may ask, why don't I simply print the line number? Well because the code may get deleted or added before the specific log.error() method call.</p>