title: What is the best way to print console logs using spring and apache tomcat? [2018]
body: <p>Currently I am facing issues while debugging errors and code using Apache tomcat console. Sometimes some logs appears, sometimes not.
  I had searched enough about printing logs on console. They are not much easy understand/implement.</p>
  
  <p><strong>Here I have <code>log4j.properties</code> of my code which does not print all logs and method in-out entries.</strong></p>
  
  <pre><code>log4j.rootCategory=debug,console
  log4j.logger.com.demo.package=debug,console
  log4j.additivity.com.demo.package=false
  
  log4j.appender.console=org.apache.log4j.ConsoleAppender
  log4j.appender.console.target=System.out
  log4j.appender.console.immediateFlush=true
  log4j.appender.console.encoding=UTF-8
  #log4j.appender.console.threshold=warn
  
  log4j.appender.console.layout=org.apache.log4j.PatternLayout
  log4j.appender.console.layout.conversionPattern=%d [%t] %-5p %c - %m%n
  </code></pre>
  
  <p>Which gives output logs as</p>
  
  <pre><code>2018-04-18 18:03:13,175 [main] INFO Demo - Log4j console appender configuration is successful !!
  </code></pre>
  
  <p><strong>Finally I want to know,</strong></p>
  
  <p><strong>1. What is the best way to print INFO, error, warning logs in console or log file like</strong></p>
  
  <p>2018-04-18 @ 18:03:13 INFO  -> methodName() -> Enter</p>
  
  <p>2018-04-18 @ 18:03:14 INFO  -> methodName() -> Exit</p>
  
  <p><strong>2. Is there any shortcut available in spring or java to print method names with Enter-Exit text as shown above ?</strong> Otherwise I need to put Enter Exit in all methods.</p>