SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

LOGGING / NOTES</>↗
Logging01 Mar 2009

How do I get the current Level of a Logger?

Here we demonstrate how to obtain the current level of the Logger instance. The log level will be inherited from the parent logger when the level is not set explicitly . package org.kodejava.util.logging; import java.util.logging.Logger; import java.util.logging.Level; public class LoggerGetLevel { private static Logger logger = Logger.getLogger(LoggerGetLevel.class.getName()); public static void main(String[] args) { LoggerGetLevel demo […]

Wayan · 1 min read
LOGGING / NOTES</>↗
Logging28 Feb 2009

How do I set the Logger log level?

In this example you see how we can change or set the Logger log level. The log level will tell the Logger which particular log message will be logged. Logger will only record the log message if the level is equal or higher than the Logger level. For instance when the level set to Level.SEVERE, […]

Wayan · 2 min read
LOGGING / NOTES</>↗
Logging28 Feb 2009

How do I set a filter on a logger handler?

This example give you an example on how to set the Filter of a logger handler. In the code below we implement the Filter on the FileHandler to log only a Level.SEVERE message. Other log level will not be recorded to the file. package org.kodejava.util.logging; import java.util.logging.*; import java.io.IOException; public class LoggerFilter { public static […]

Wayan · 1 min read
LOGGING / NOTES</>↗
Logging24 Feb 2009

How do I use Logger’s MemoryHandler class?

In this example we demonstrate the use of Logger‘s MemoryHandler to log only when some conditions happen in our application, for example when a Level.SEVERE message is logged. We create an instance of MemoryHandler that will delegate the log to FileHandler class, and it logs the last 100 record until a Level.SEVERE message is logged. […]

Wayan · 2 min read
LOGGING / NOTES</>↗
Logging23 Feb 2009

How do I use logger ConsoleHandler?

In this example you’ll see how to add ConsoleHandler to the Logger instance. It is simple, just create an instance of ConsoleHandler and add it to the Logger using the Logger.addHandler() method. package org.kodejava.util.logging; import java.util.logging.Logger; import java.util.logging.ConsoleHandler; import java.util.logging.Level; public class LogConsoleHandler { public static void main(String[] args) { // Obtains Logger instance Logger […]

Wayan · 1 min read
LOGGING / NOTES</>↗
Logging19 Feb 2009

How do I write log to a file?

An application log need to be persisted so that we can analyze the log when an error occurred in our application. For this reason we need to write to log into a file. The Logging API provide handlers which helps us to do this. To write log to a file we can use the FileHandler. […]

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.