Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

LOGGING / CATATAN</>
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 menit baca
LOGGING / CATATAN</>
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 menit baca
LOGGING / CATATAN</>
Logging17 Feb 2009

How do I do a conditional logging?

When logging some messages in our application the purpose could be creating a log for debugging purposes. To minimize the impact of these debug message we can use a conditional logging. To do this we need to wrap each call to the logger method with a Logger.isLoggable(Level level) check. The check will ensure that only […]

Wayan · 2 menit baca
LOGGING / CATATAN</>
Logging16 Feb 2009

How do I log an exception?

In this example you can see how we can log an exception when it occurs. In the code below we are trying to parse an invalid date which will give us a ParseException. To log the exception we call the Logger.log() method, passes the logger Level, add some user-friendly message and the Throwable object. package […]

Wayan · 2 menit baca
LOGGING / CATATAN</>
Logging12 Feb 2009

How do I check if a message is loggable?

The Logger class provide a setLevel() method to set the logging level. By setting logging to a certain level we can control which message will be logged. To determine or check if a message will be logged we can use the Logger.isLoggable(Level level) method. Let see the example below. package org.kodejava.util.logging; import java.util.logging.Logger; import java.util.logging.Level; […]

Wayan · 2 menit baca
LOGGING / CATATAN</>
Logging09 Feb 2009

How do I obtain or create a Logger?

Since JDK 1.4 a logging API was introduced into the Java class libraries. This API enables our application to logs some messages to record our application activities. To create an instance of Logger we can call the Logger.getLogger() factory method which will return the available logger for the given namespace, or it will create a […]

Wayan · 2 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

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

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.