人気の面接質問と回答・オンラインテスト
面接対策、オンラインテスト、チュートリアル、ライブ練習のための学習プラットフォーム

集中型学習パス、模擬テスト、面接向けコンテンツでスキルを伸ばしましょう。

WithoutBook は、分野別の面接質問、オンライン練習テスト、チュートリアル、比較ガイドをひとつのレスポンシブな学習空間にまとめています。

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.

著作権 © 2026、WithoutBook。