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."],[[["\u003cp\u003eThe \u003ccode\u003eFilter\u003c/code\u003e interface provides granular control over logging, going beyond log levels.\u003c/p\u003e\n"],["\u003cp\u003eLoggers and Handlers can utilize \u003ccode\u003eFilter\u003c/code\u003e to determine if a \u003ccode\u003eLogRecord\u003c/code\u003e should be published using the \u003ccode\u003eisLoggable\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eisLoggable\u003c/code\u003e method in \u003ccode\u003eFilter\u003c/code\u003e interface checks and returns true if the given LogRecord should be published.\u003c/p\u003e\n"]]],["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"],null,["# Filter\n\npublic interface **Filter** \nA Filter can be used to provide fine grain control over\nwhat is logged, beyond the control provided by log levels.\n\n\nEach Logger and each Handler can have a filter associated with it.\nThe Logger or Handler will call the isLoggable method to check\nif a given LogRecord should be published. If isLoggable returns\nfalse, the LogRecord will be discarded. \n\n### Public Method Summary\n\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [isLoggable](../../../../reference/java/util/logging/Filter.html#isLoggable(java.util.logging.LogRecord))([LogRecord](../../../../reference/java/util/logging/LogRecord.html) record) Check if a given log record should be published. |\n\nPublic Methods\n--------------\n\n#### public abstract boolean\n**isLoggable**\n([LogRecord](../../../../reference/java/util/logging/LogRecord.html) record)\n\nCheck if a given log record should be published. \n\n##### Parameters\n\n| record | a LogRecord |\n|--------|-------------|\n\n##### Returns\n\n- true if the log record should be published."]]