SLF4J Introduction(2): Output In this blog, we focus on how SLF4J and related logging system handle the output of logging. Layout Layout, which is maybe called pattern, is responsible to transform an log event into string with some format. The format of the log event is somewhat like printf method. There are many conversion characters to represent things like class name, date, thread, file name, stack trace, message, caller data etc. Log4j In log4j, the default conversion pattern is %r [%t] %p %c %x - %m%n % : the prefix of conversion character. If we want to print a single % sign, we can use %% r : the number of milliseconds elapsed from the construction of the layout until the creation of the logging event. t : name of thread p : logging priority c : the category of the logging event x : NDC (nested diagnostic context) m : the application supplied message associated with the logging event n : the platform dependent line separator character or c...
Learn programming, still on the way