How To Install slf4j on CentOS 7

In this tutorial we learn how to install slf4j on CentOS 7. slf4j is Simple Logging Facade for Java

Introduction

In this tutorial we learn how to install slf4j on CentOS 7.

What is slf4j

The Simple Logging Facade for Java or (SLF4J) is intended to serve as a simple facade for various logging APIs allowing to the end-user to plug in the desired implementation at deployment time. SLF4J also allows for a gradual migration path away from Jakarta Commons Logging (JCL). Logging API implementations can either choose to implement the SLF4J interfaces directly, e.g. NLOG4J or SimpleLogger. Alternatively, it is possible (and rather easy) to write SLF4J adapters for the given API implementation, e.g. Log4jLoggerAdapter or JDK14LoggerAdapter..

We can use yum or dnf to install slf4j on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install slf4j.

Install slf4j on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install slf4j using yum by running the following command:

sudo yum -y install slf4j

Install slf4j on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install slf4j using dnf by running the following command:

sudo dnf -y install slf4j

How To Uninstall slf4j on CentOS 7

To uninstall only the slf4j package we can use the following command:

sudo dnf remove slf4j

References

Summary

In this tutorial we learn how to install slf4j on CentOS 7 using yum and dnf.