Showing posts with label Log4j. Show all posts
Showing posts with label Log4j. Show all posts

Writing Logs to a Console and File using Log4j

While doing application development it's require you to write logs into File or print logs into Console with expected Date/Time, ProgramName with line number and many more information.

  1. Download Apache Log4j.jar and add it to your classpath
  2. Create Instance of Logger
  3. Use debug,info,warn,error,fatal methods to log required information