title: How can we print line numbers to the log in java
body: <p>How to print line numbers to the log. Say when outputting some information to the log, I also want to print the line number where that output is in the source code. As we can see in the stack trace, it displays the line number where the exception has occurred. Stack trace is available on the exception object.</p>
  
  <p>Other alternative could be like manually including the line number when printing to the log. Is there any other way?</p>