Log4j Configurations – Controlling Logging to Multiple Files

Introduction

The purpose of inserting log statements into the code is a low-tech method for debugging it. It may also be the only way because debuggers are not always available or applicable. This is often the case for distributed applications.
Features of Log4j

We can enable logging at runtime without modifying the application binary.

We can control the behavior of logging by editing only the configuration file, no need to touch the application binary.

Developer are always clear with detailed context for application failures.

Log4j has one of the distinctive features – the notion of inheritance. Using this logger hierarchy feature we are able to control the log statements output at arbitrarily fine granularity but also at great ease. This helps to reduce the volume of logged output and the cost of logging. Continue reading “Log4j Configurations – Controlling Logging to Multiple Files”