Changing the default log message format

In this post I will be explaining how to change the default log message format provided by java util loggging. In case of logging to console (done by ConsoleHandler), the default format used is an instance of java.util.logging.SimpleFormatter. In case of logging to file (done by FileHandler), the default format used is an instance of…… Continue reading Changing the default log message format

Redirecting logging to a file

In this post I will explain how to program the logger to log messages to a file instead of logging to console. Below is the code Main code 1 package Logging; 2 3 import java.io.IOException; 4 import java.util.logging.FileHandler; 5 import java.util.logging.Logger; 6 7 public class LoggingDemo2 { 8 public static void main(String[] args) throws IOException…… Continue reading Redirecting logging to a file

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

Operations that can be performed using JSON Pointer

This post explains the operations that can be performance on json data with the help of new JSONP 1.1 api. As we know from our previuos post JSON Pointer is a string syntax used to identify and locate a particular field or property in a json file. Once identified and located we can perform the…… Continue reading Operations that can be performed using JSON Pointer

JSON Pointer Example

This post explains JSON Pointer with an example. JSON Pointer is a standard that defines a string syntax, which can used to access a particular field or key value in the entire json document. For example in the below json document json document { “firstName”: “Duke”, “lastName”: “Java”, “age”: 18, “streetAddress”: “100 Internet Dr”, “city”:…… Continue reading JSON Pointer Example

Binding single http request type to multiple web resource methods in JAX-RS Application

This post explains how to bind one type of http request to multiple methods of a web resource. Sometimes we need to design a web resource in such a way that we can bind two different yet related web url to different methods. 1) Different url meaning different in their purpose 2) Related url meaning…… Continue reading Binding single http request type to multiple web resource methods in JAX-RS Application

Setter injection example with more than one argument (@Autowired)

In this post under Spring core, I explains how to instruct Spring framework to call a setter method (which take more than one argument) while creating a bean. In most of the cases, the setter methods of a class takes only one argument but if a case arises where a setter method has to take…… Continue reading Setter injection example with more than one argument (@Autowired)