Welcome to the next chapter in the series of tutorials on Log4j Loggers. I hope you have read at least Log4j Introduction and LogManager,

Lets get started. The next object in the Log4j component list is the Logger class. This is the most important class that you will need. This is the object which lets you log information to the required Log location, be it console or a file or even a database.

Logger objects follow hierarchy similar to class hierarchy in any OOP language. Naming convention of Logger hierarchy is in the name. Each objects name decide which hierarchy it follows. For example we have a logger named “Main.Utility“. So Utility is the child of Main and Main is the father of Utility. Also, all Loggers are derived from root Logger. The actual hierarchy will be root.Main.Utility with root being ancestor of Utility and Father of Main. This can be shown in a diagram as

These relationships are managed by the LogManager class. Lets illustrate it using an exampleHeirarchy