How To Install node-log4js on Debian 9

In this tutorial we learn how to install node-log4js on Debian 9. node-log4js is Conversion of the log4js framework to work with Node.js

Introduction

In this tutorial we learn how to install node-log4js on Debian 9.

What is node-log4js

node-log4js is:

Logging support for Node.js based on the log4js Javascript (browser/client) framework.

Supported features:

- coloured console logging
- replacement of node's console.log functions (optional)
- file appender, with log rolling based on file size
- SMTP appender
- GELF appender
- hook.io appender
- multiprocess appender (useful when you've got worker processes)
- a logger for connect/express servers
- configurable log message layout/patterns
- different log levels for different log categories (make some parts
  of your app log as DEBUG, others only ERRORS, etc.)

There are three methods to install node-log4js on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install node-log4js Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install node-log4js using apt-get by running the following command:

sudo apt-get -y install node-log4js

Install node-log4js Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install node-log4js using apt by running the following command:

sudo apt -y install node-log4js

Install node-log4js Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install node-log4js using aptitude by running the following command:

sudo aptitude -y install node-log4js

How To Uninstall node-log4js on Debian 9

To uninstall only the node-log4js package we can use the following command:

sudo apt-get remove node-log4js

Uninstall node-log4js And Its Dependencies

To uninstall node-log4js and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove node-log4js

Remove node-log4js Configurations and Data

To remove node-log4js configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge node-log4js

Remove node-log4js configuration, data, and all of its dependencies

We can use the following command to remove node-log4js configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge node-log4js

Dependencies

node-log4js have the following dependencies:

References

Summary

In this tutorial we learn how to install node-log4js package on Debian 9 using different package management tools: apt, apt-get and aptitude.