Die meistgefragten Interviewfragen und Antworten sowie Online-Tests
Lernplattform fur Interviewvorbereitung, Online-Tests, Tutorials und Live-Ubungen

Baue deine Fahigkeiten mit fokussierten Lernpfaden, Probetests und interviewreifem Inhalt aus.

WithoutBook vereint themenbezogene Interviewfragen, Online-Ubungstests, Tutorials und Vergleichsleitfaden in einem responsiven Lernbereich.

Chapter 8

Filtering, Routing, Markers, and Fine-Grained Logging Control

Move beyond basic levels and learn how Log4j controls which events flow to which destinations.

Inside this chapter

  1. Why Levels Alone Are Not Always Enough
  2. Filters
  3. Markers
  4. Routing as an Operational Tool

Series navigation

Study the chapters in order for the clearest path from beginner logging concepts to advanced operational logging design. Use the navigation at the bottom of each page to move through the full series.

Tutorial Home

Chapter 8

Why Levels Alone Are Not Always Enough

In real applications, teams sometimes need more than simple INFO versus ERROR control. They may want certain audit events routed separately, some packages muted, or only specific categories forwarded to a destination.

Chapter 8

Filters

Filters allow Log4j to accept, deny, or neutralize events based on conditions such as level, marker, message content, or logger source. They help refine log flow without changing application code everywhere.

Chapter 8

Markers

import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.MarkerManager;

private static final Marker AUDIT = MarkerManager.getMarker("AUDIT");
logger.info(AUDIT, "User role updated");

Markers let teams tag special log events semantically, such as audit, security, billing, or business workflow logs.

Chapter 8

Routing as an Operational Tool

Advanced systems often send different log categories to different appenders or downstream platforms. That is one of the ways teams keep logs useful without drowning all outputs in the same noise.

Copyright © 2026, WithoutBook.