Loading
Log4J Appenders

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  Log4J Appenders ?


Ans)

Step 1:

You need to create a Log4J property files , take a look at a sample below.

log = C://logs//log

log4j.rootLogger = INFO, FILE

# Define the file appender
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.File=${log}/ServiceResult.html

# Define the layout for file appender
log4j.appender.FILE.layout=org.apache.log4j.HTMLLayout
log4j.appender.FILE.layout.Title=HTML Layout Example
log4j.appender.FILE.layout.LocationInfo=true

 Step 2:

static {

PropertyConfigurator.configure("C://ServiceTestNew//conf//log4j.properties");

}

Step 3:

Get the Log as shown below.

private final static Logger log = Logger.getLogger(ValidateLogger.class);

You want to create own Appender ? For example you want to logs the statements into a

HTML file ? Please take a look at MISC tab.



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

Log4J Appenders


Log4J Appenders

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free