Creating a custom log message format

This post explains how to create a custom log message format. Out of the box java provides two log formats SimpleFormatter and XMLFormatter. Both extends the abstract super class Formatter. We can create our own custom format. Below is the code of the custom format CustomFormatter 1 package Logging; 2 3 import java.util.logging.Formatter; 4 import… Continue reading Creating a custom log message format

Java logging simple example

This post explains java logging with simple example. Main code 1 package Logging; 2 3 import java.io.IOException; 4 import java.util.logging.Logger; 5 6 public class LoggingDemo1 { 7 public static void main(String[] args) throws IOException { 8 Logger logger = Logger.getLogger(“logger1”); 9 logger.info(“Hello my name is Mathew”); 10 logger.warning(“Hello my name is Mathew”); 11 logger.config(“Hello my… Continue reading Java logging simple example