java.util.logging

FileHandler

The FileHandler in java.util.logging is used to write log messages to disk files. It supports features like log rotation and appending to existing files. Key Features Writes logs to files. Can rotate log files based on size and limit. Can append to existing files. Works with formatters like SimpleFormatter or custom ones. Commonly Used Methods …

FileHandler Read More »

ConsoleHandler

The ConsoleHandler is a built-in logging handler in the java.util.logging package that writes log messages to the console (System.err by default).It is commonly used during development and debugging to quickly view log output. Key Features Writes logs to console in real time. Can be customized with formatters and log levels. Often used alongside or instead …

ConsoleHandler Read More »

LoggingMXBean

The LoggingMXBean is an interface in the java.lang.management package that allows monitoring and managing loggers in a Java application at runtime via JMX (Java Management Extensions). It provides a way to dynamically inspect and change logging configurations (like log levels) without restarting the application. Commonly Used Methods Simple Program Real-Time Log Level Management in a …

LoggingMXBean Read More »

LogManager

The LogManager class in the java.util.logging package is responsible for: Managing the global logging configuration. Creating and maintaining the Logger namespace. Loading configuration files (e.g., logging.properties). Controlling how loggers are initialized and accessed across the application. It acts as the central manager for all logging resources in a Java program. Commonly Used Methods Simple Program: …

LogManager Read More »

Handler

The Handler class is part of the java.util.logging package and is used to define how log messages are handled. A handler receives log messages from a Logger and then writes them to a destination such as: Console File Network socket Custom output Common Subclasses of Handler Commonly Used Methods Simple Program Using ConsoleHandler Handlers are …

Handler Read More »

Logger

The Logger class is part of the java.util.logging package in Java. It is used for logging messages for a specific system or application component. Loggers are typically named using hierarchical dot-separated names (e.g., com.bank.account). Commonly Used Methods Simple Logger Program Problem Statement: LotusJavaPrince has designed a banking system that performs fund transfers. If something goes …

Logger Read More »

Scroll to Top