HTML Layout
It able to provide all logging messages in the form of Html file. To represent this Layout Log4j has provided a predefined class in the form of “org.apache.log4j.HTMLLayout”
log4j.properties
log4j.rootLogger = ALL, FILE log4j.appender.FILE = org.apache.log4j.FileAppender log4j.appender.FILE.file = /home/ashok/loggers/ashok.html log4j.appender.FILE.layout = org.apache.log4j.HTMLLayout
package com.ashok.log4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * * @author ashok.mariyala * */ public class TestLog4J { private static final Logger LOG = LoggerFactory.getLogger(TestLog4J.class); public static void main(String[] args) { LOG.trace("This is trace message"); LOG.debug("This is debug message"); LOG.info("This is info message"); LOG.warn("This is warn message"); LOG.error("This is error message"); } }
HTML Layout