  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | Jav.util.logging URGENT | Jav.util.logging URGENT 2003-10-11 - By Joseph Krasnov
Back What version of Java are you using?
-- --Original Message-- -- From: Galbayar [mailto:galbayar@(protected)] Sent: Saturday, October 11, 2003 2:54 AM To: Tomcat Users List Subject: Jav.util.logging URGENT
Hi, I am learning to use logger. I have a code snippet below
package test import java.io.IOException ; import java.io.Serializable ;
import java.text.SimpleDateFormat ;
import java.util.Date ; import java.util.logging.FileHandler ; import java.util.logging.SimpleFormatter ;
public class Logger implements Serializable { static SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd");
public static void logInfo(String message) { try { java.util.logging.Logger logger = java.util.logging.Logger ( "test"); FileHandler fh = new FileHandler("C:/ubs_" + sdf.format(new Date()) + ".log", true); fh.setFormatter(new SimpleFormatter()); logger.addHandler(fh); logger.info(message); } catch (SecurityException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
after called Logger.logInfo("test") 2 times created 5 files?
ubs_2003_10_11.log ubs_2003_10_11.log.lck ubs_2003_10_11.log.1 ubs_2003_10_11.log.1.lck ubs_2003_10_11.log.2 ubs_2003_10_11.log.2.lck
what's happened? i need Logger create one file? Thanks in advance
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected) For additional commands, e-mail: tomcat-user-help@(protected)
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected) For additional commands, e-mail: tomcat-user-help@(protected)
|
|
 |