log4j.xml Examples
Here’s an XML version of log4j properties file, just for sharing. Redirect the logging to console. Redirect the logging to a file. Full example to output the logging to both…
Favourite tutorials for developers
Here’s an XML version of log4j properties file, just for sharing. Redirect the logging to console. Redirect the logging to a file. Full example to output the logging to both…
I can’t find many log4j.properties examples, here are a few log4j.properties examples that are used in my project, just for sharing. All logging will be redirected to your console. All…
In Logback, it is easy to set a log file name programmatically : 1 - In logback.xml, declares a variable like ${log.name}, 2 - In Java, set the variable via…
In this tutorial, we will show you how to use Logback Mapped Diagnostic Context (MDC) and SiftingAppender to create a separate log file for each thread.
Here are a few logback.xml examples that are used in my projects, just for sharing. All logging will be redirected to console. All logging will be redirected to a file…
A simple SLF4J with Logback example. Tested with: SLF4J API 1.7.25, Logback 1.2.3, Maven 3, Java 8. Note: Logback natively implements the SLF4J API.
In this tutorial, we will show you how to use Gson to convert Java object to / from JSON. The toJson() – Convert Java objects to JSON and fromJson() –…
Gson provide simple toJson() and fromJson() methods to convert Java objects to / from JSON. The toJson() – Java object to JSON and fromJson() – JSON to Java object
This MinguoDate calendar system is primarily used in Taiwan (Republic of China…). To convert the current date to the Minguo date, just subtracts the current year with number 1911
In Java, you can use the following ways to measure elapsed time in Java: System.nanoTime() - This is the recommended solution to measure elapsed time in Java. We also can…