Posts

Showing posts from October, 2015

log

Log.logger.info("Check election Id in add candidate Action : "+candidateBean.getElectionID()); import org.apache.log4j.*; public class Log {     public static Logger logger;     static {         logger = Logger.getLogger(Log.class);         SimpleLayout simpleLayout = new SimpleLayout();         FileAppender fileAppender = null;         try {             fileAppender = new FileAppender(simpleLayout,             "D:\\Workspace-Eclipse\\Voting\\WebContent\\VotingLog.txt", true);         } catch (Exception e) {}         logger.addAppender(fileAppender);     } }

log4j impl

package com.evs.util; import java.io.FileOutputStream; import org.apache.log4j.*; public class Log { public static Logger logger; static{ logger = Logger.getLogger(Log.class); //Generate pattern string for pattern layout /* String pattern = "%n%nClassname of caller: %C %n"; pattern += "Date : %d{ISO8601} %n"; pattern += "Location : %l %n"; pattern += "Log Message: %m %n %n"; */ /* String pattern = " %n%nClassname of caller: %C %n "; pattern += " Date : %d{ISO8601} %n "; pattern += " Location : %l %n "; pattern += " Log Message: %m %n %n "; */ /* String pattern = " %n%nClassname of caller: %C %n "; pattern += " Date : %d{ISO8601} %n "; pattern += "Location : %l %n "; pattern += "Log Message: %m %n %n "; */ /* String pattern = " Msg %m %n %n "; pattern ...