- SLF4J - Discussion
- SLF4J - Useful Resources
- SLF4J - Quick Guide
- SLF4J - Profiling
- SLF4J - Migrator
- SLF4J - Parameterized logging
- SLF4J - Error Messages
- SLF4J - Hello world
- SLF4J - Referenced API
- SLF4J - Environment Setup
- SLF4J Vs Log4j
- SLF4J - Logging Frameworks
- SLF4J - Overview
- SLF4J - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SLF4J - Logging Frameworks
Logging in programming, refers to recording activities/events. Usually, the apppcation developers should take care of logging.
To make the job of logging easier, Java provides various frameworks − log4J, java.util.logging (JUL), tiny log, logback, etc.
Logging Framework Overview
A logging framework usually contains three elements −
Logger
Captures the message along with the metadata.
Formatter
Formats the messages captured by the logger.
Handler
The Handler or appender finally dispatches the messages either by printing on the console or, by storing in the database or, by sending through an email.
Some frameworks combine the logger and appender elements to speed up the operations.
Logger Object
To log a message, the apppcation sends a logger object (sometimes along with the exceptions if any) with name and security level.
Severity Level
The messages logged will be of various levels. The following table psts down the general levels of logging.
Sr.No | Severity level & Description |
---|---|
1 |
Fatal Severe issue that causes the apppcation to terminate. |
2 |
ERROR Runtime errors. |
3 |
WARNING In most cases, the errors are due to the usage of deprecated APIs. |
4 |
INFO Events that occur at runtime. |
5 |
DEBUG Information about the flow of the system. |
6 |
TRACE More detailed information about the flow of the system. |