Layout:

Layout Object is responsible for formatting logging messages.
Appender object uses the support of Layout object for formatting the messages.
Layout is an interface, implemented classes are..
         SimpleLayout
         PatternLayout
         HTMLLayout
         XMLLayout
         DataLayout   etc.........
The most frequently used Layout  is PatternLayout.Because, it has provided ConversionPattern through which we can make a logging statement as more informative.
The most ConversionPattern are.....
%t
Add thread name
%-5p
Add a priority level with left justification
%d
Adds Date and Time. We use
%d{dd/mm/yyyy hh:mm:ss}-to add a time & date.
%c
Add fully qualified class name
%m
Adds message
%n
Adds new line (next line).
%L
Adds line number of the message in a program
%M
Adds method name from which the logging message in generated
%r
Adds the milliseconds of time completed from the construction of layout of current msg.

0 comments:

Post a Comment