Logger logger = Logger.getLogger("handlerDemo");
try{
FileHandler fileHandler = new FileHandler("C:/myLogger.log");
//FileHandler fileHandler = new FileHandler("%h/myLogger.log");
//C:\Documents and Settings\Administrator\myLogger.log
fileHandler.setFormatter(new SimpleFormatter());
logger.addHandler(fileHandler);
logger.info("测试信息1111111111");
}
catch (SecurityException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
GregorianCalendar data = new GregorianCalendar();
long lseconds = data.getTimeInMillis();