Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
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.
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.