Jav.util.logging URGENT 2003-10-12 - By Galbayar
Back java version "1.4.1_03" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_03-b02) Java HotSpot(TM) Client VM (build 1.4.1_03-b02, mixed mode)
-- --Original Message-- -- From: Joseph Krasnov [mailto:j.krasnov@(protected)] Sent: Sunday, October 12, 2003 12:21 AM To: 'Tomcat Users List' Subject: RE: Jav.util.logging URGENT
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)
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected) For additional commands, e-mail: tomcat-user-help@(protected)
|
|