Tutorial by Examples

This example shows how to use the default logging api. import java.util.logging.Level; import java.util.logging.Logger; public class MyClass { // retrieve the logger for the current class private static final Logger LOG = Logger.getLogger(MyClass.class.getName()); pub...
Java Logging Api has 7 levels. The levels in descending order are: SEVERE (highest value) WARNING INFO CONFIG FINE FINER FINEST (lowest value) The default level is INFO (but this depends on the system and used a virtual machine). Note: There are also levels OFF (can be used to turn log...
Let's look at a sample of logging which you can see in many programs: public class LoggingComplex { private static final Logger logger = Logger.getLogger(LoggingComplex.class.getName()); private int total = 50, orders = 20; private String username = "Bob";...

Page 1 of 1