Filter
Stay organized with collections
Save and categorize content based on your preferences.
A Filter can be used to provide fine grain control over
what is logged, beyond the control provided by log levels.
Each Logger and each Handler can have a filter associated with it.
The Logger or Handler will call the isLoggable method to check
if a given LogRecord should be published. If isLoggable returns
false, the LogRecord will be discarded.
Public Methods
public
abstract
boolean
isLoggable
(LogRecord record)
Check if a given log record should be published.
Returns
- true if the log record should be published.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["The `Filter` interface provides granular control over logging, going beyond log levels."],["Loggers and Handlers can utilize `Filter` to determine if a `LogRecord` should be published using the `isLoggable` method."],["`isLoggable` method in `Filter` interface checks and returns true if the given LogRecord should be published."]]],["Filters, associated with Loggers or Handlers, control which log records are published. The core functionality is encapsulated in the `isLoggable` method. This method takes a `LogRecord` as input and determines if it should be published. If `isLoggable` returns `true`, the record is published; otherwise, it's discarded, allowing for precise control over logging beyond standard log levels.\n"]]