Clever Geek Handbook
📜 ⬆️ ⬇️

Slf4j


SLF4J (Simple Logging Facade for Java) is a logging library that aims to provide the simplest yet powerful facade for various logging systems in Java.

Simple Logging Facade for Java
Type of
Developer
Written on
operating system
Hardware platform
Latest version
License
Site

SLF4J provides a simple, generic interface for logging systems that is implementation-independent.

An implementation can be selected and configured without changing the application code. Slf4J seamlessly integrates with the following implementations:

  • NOP - an implementation that does not perform any actions
  • Simple - using standard output for logs
  • Java Logging API - logging system included in the JDK
  • Log4J is one of the most famous logging systems for java
  • JCL is a framework that also provides an adapter for logging
  • LogBack is a logging system that is a development of log4j and is specifically designed for use with slf4j

In addition, SLF4J provides the ability to integrate components that are dependent on other logging systems (Log4J, JCL), substituting implementations that direct the logs of these systems to SLF4J.

Usage Example

  import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
 class MyClass {
	 private Logger log = LoggerFactory .  getLogger ( MyClass . class );  // 1. Declare a logger variable
 
	 ...
 
	 log .  debug ( "..." );  // 2. Output the string to debug
 
	 ...
 
	 log .  info ( "Some object: {}" , object );  // 3. We print in info a line with the argument substituted into it
 
	 ...
 
	 log .  error ( "Error during some job !!" , e );  // 4. We print an error in error, along with an exception
 }

Notes

  1. ↑ The slf4j Open Source Project on Open Hub: Languages ​​Page - 2006.
    <a href=" https://wikidata.org/wiki/Track:Q124688 "> </a> <a href=" https://wikidata.org/wiki/Track:P1972 "> </a>
  2. ↑ Release 1.7.7 - 2014.

Links

  • Official site of the project
Source - https://ru.wikipedia.org/w/index.php?title=Slf4J&oldid=91513939


More articles:

  • Novosibirsk Regional Puppet Theater
  • Tie
  • Khitrovo, Vladimir Nikolaevich
  • Berkovich, Evgeny Mikhailovich
  • Notes on Jewish History
  • Union of Free Democrats (Bulgaria)
  • KamAZ-4911
  • Ready for labor and defense (student games)
  • Bosna 2008 (chess tournament)
  • Rondel (poetry)

All articles

Clever Geek | 2019