Friday, October 16, 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 = "<html><body><table><table border="2" cellpadding="5" cellspacing="5"><tr width=""><td>%n%nClassname of caller:</td><td>%C %n</td><tr>"; pattern += " <tr><td>Date : </td><td>%d{ISO8601} %n</td><tr>"; pattern += " <tr><td>Location :</td><td> %l %n</td><tr>"; pattern += " <tr><td>Log Message:</td><td> %m %n %n</td> </tr></tr></tr></tr></tr></tr></tr></table></table></body> </html> "; */ /* String pattern = "<html><head><style>th{color:red;background:#ccc;}</style></head><body><table><table align="center" border="2" cellpadding="5" cellspacing="5" style="width: 960pxpx;"> <th>%n%nClassname of caller:</th>%C %n</table></table></body></html>"; pattern += "<br />Date : <br />%d{ISO8601} %n<br />"; pattern += "Location :<br />%l %n<br />"; pattern += "Log Message:<br />%m %n %n<br /><br /><br />"; */ /* String pattern = "<html><head><style>th{color:red;background:#ccc;}body{font:8px normal Arial, Helvetica, sans-serif;color:brown; }</style></head><body><table><table bordercolor="black"><tr><th>Msg</th><td> %m %n %n</td>"; pattern += "<th>%n%nClass</th><td>%C %n</td>"; pattern += "<th>Loc</th><td> %l %n</td>"; pattern += "<th>Date</th><td>%d{ISO8601} %n</td></tr></table></table></body></html>"; */ /* String pattern = "<html><head><title>Log4J Log Messages</title><style>body, table {font-family: arial,sans-serif; font-size: x-small;}th {background: #336699; color: #FFFFFF; text-align: left;}</style></head><body bgcolor="#FFFFFF" leftmargin="6" topmargin="6"><table border="1" bordercolor="#224466" cellpadding="4" cellspacing="0" style="width: 100%px;"><tr><th>Msg</th><td> %m %n %n</td>"; pattern += "<th>%n%nClass</th><td>%C %n</td>"; pattern += "<th>Loc</th><td> %l %n</td>"; pattern += "<th>Date</th><td>%d{ISO8601} %n</td></tr></table></body></html>"; */ /* String pattern = "<html><head><title>Log4J Log Messages</title><style>body, table {font-family: arial,sans-serif; font-size: x-small;}th {background: #336699; color: #FFFFFF; text-align: left;}</style></head><body bgcolor="#FFFFFF" leftmargin="6" topmargin="6"><table border="1" bordercolor="#224466" cellpadding="4" cellspacing="0" style="width: 960pxpx;"><tr><td>%d{ISO8601} %n</td>"; pattern += "<td>%C %n</td>"; pattern += "<td> %l %n</td>"; pattern += "<td> %m %n %n</td></tr></table></body></html>"; */ /*String pattern = "<html><head><title>Log4J Log Messages</title><style>body, table {font-family: arial,sans-serif; font-size: x-small;}th {background: #336699; color: #FFFFFF; text-align: left;}span{color:red;}</style></head><body bgcolor="#FFFFFF" leftmargin="6" topmargin="6"><table align="center" border="1" bordercolor="#224466" cellpadding="4" cellspacing="0" style="width: 960pxpx;"><tr><td><span> Date: </span>%d{ISO8601} %n<br />"; pattern += "<span>class: </span> %C %n<br />"; pattern += "<span>Loc : </span> %l %n<br />"; pattern += "<span>Msg : </span> %m %n %n</td></tr></table></body></html>"; */ //PatternLayout patternLayout = new PatternLayout(pattern); SimpleLayout simpleLayout = new SimpleLayout(); //HTMLLayout htmlLayout = new HTMLLayout(); //FileAppender fileAppender=null; //WriterAppender writerAppender = null; try { //fileAppender = new FileAppender(simpleLayout,"D:\\Voting Workspace\\Voting\\VotingLog.txt",true); // fileAppender = new FileAppender(simpleLayout,"D:\\Workspace-Eclipse\\Voting\\WebContent\\VotingLog.txt",true); // fileAppender = new FileAppender(patternLayout,"D:\\Workspace-Eclipse\\Voting\\WebContent\\VotingLog.txt",true); //fileAppender = new FileAppender(patternLayout,"D:\\Workspace-Eclipse\\Voting\\WebContent\\VotingLog1.html",true); //fileAppender = new FileAppender(patternLayout,"D:\\Workspace-Eclipse\\Voting\\WebContent\\VotingLog.txt",true); //FileOutputStream output = new FileOutputStream("D:\\Workspace-Eclipse\\Voting\\WebContent\\votingLog.html",true); // writerAppender = new WriterAppender(htmlLayout,output); } catch(Exception e) {} logger.addAppender(new ConsoleAppender(simpleLayout)); //logger.addAppender(new ConsoleAppender(patternLayout)); //logger.addAppender(fileAppender); //logger.addAppender(writerAppender); } }

உப்பு மாங்காய்

சுருக்குப்பை கிழவி. சுருக்கங்கள் சூழ் கிழவி. பார்க்கும் போதெல்லாம் கூடையுடனே குடியிருப்பாள். கூடை நிறைய குட்டி குட்டி மாங்காய்கள். வெட்டிக்க...