top of page

Simplified version of Log4j in Java

Introduction

  • In Eclipse or any IDE (Integrated development environment), the console has a limited memory to store all the logs or print the messages like errors, exceptions etc.. Therefore log4j was invented.

  • Log4j is a logging tool.

  • We can get and store the logs/messages in following formats:

1.File (name.log)

2.Database

3.Email (send mail)

4.Console

  • Logs are usually used by support team or Dev team to read the errors and fix the issues.

Steps on how to check the console memory in Eclipse


Window->Preferences->Run/Debug->Console-see the memory i.e. 80000


Log4j framework components


  • Logger

  • Layout

  • Appender


Picture courtesy: innovationm.co



Logger


  • Logger must be created inside the class for which Log4j is required.

  • Eg. There are 3 class, choose which class needs the Log4j where there are chances of highest errors.


Appender


  • It is used to specify where to store the log message.

  • Types of Appenders:

  1. Console Appender: To print the log on console.

  2. File Appender: Store the log in .log file.

  3. JDBC Appender: To store the message in database table.

  4. FTP/ Telnet Appender : Send the data from one server to another.

  5. SMTP : Send the log using mail.


Layout


  • We can indicate which format should be printed on Appender.

  1. Simple Layout

  2. HTML layout : Print the messages in HTML format.

  3. XML Layout: Print the messages as XML output.

Recent Posts

See All

Comments


MiIT Logo

Company

Contact Us

+1905-487-4880 

5160 Explorer Dr #34, Mississauga,ON L4W 4T7

+1929-743-3199

4466 Buttonwood Ln Lilburn, GA 30047

262 Chapman Rd, STE 240 Newark DE 19702

+44 20 4525 1214

71-75 Shelton Street, Covent Garden, London, United Kingdom WC2H 9JQ

Stay up to date on the latest from MiIT

  • Instagram
  • Facebook
  • http://linkedin.com/company/miittechnologies/about/
  • Whatsapp

© All Content MiIT Technologies Inc.2019 - 2025. All rights reserved.

bottom of page