head 1.5; access; symbols; locks linus:1.5; strict; comment @# @; 1.5 date 2001.05.07.18.55.20; author linus; state Exp; branches; next 1.4; 1.4 date 2001.05.07.02.50.11; author linus; state Exp; branches; next 1.3; 1.3 date 2001.05.06.20.50.52; author linus; state Exp; branches; next 1.2; 1.2 date 2001.05.02.21.02.19; author linus; state Exp; branches; next 1.1; 1.1 date 2001.04.30.18.01.07; author linus; state Exp; branches; next ; desc @works @ 1.5 log @no stdout ., @ text @import java.io.*; import java.text.*; import java.util.*; public class msglog { protected static String defaultLogFile = "/var/log/emonster.log"; public static void setDefaultLogFile( String s ) { defaultLogFile = s; } public static void write(String s) { write( defaultLogFile, s ); } public static void write( String f, String s ) { try { // TimeZone tz = TimeZone.getTimeZone("PST"); // or EST, MID, etc ... // Date now = new Date(); // DateFormat df = new SimpleDateFormat ("yyyy-MM-dd kk:mm:ss "); // df.setTimeZone(tz); // String currentTime = df.format(now); FileWriter aWriter = new FileWriter(f, true); // aWriter.write(currentTime + " " + s + System.getProperty("line.separator")); // System.out.println( s ); aWriter.write( s + System.getProperty("line.separator")); aWriter.flush(); aWriter.close(); } catch (IOException ioe) { // I/O error ioe.printStackTrace(); return; } } } @ 1.4 log @fix @ text @d31 1 a31 1 System.out.println( s ); @ 1.3 log @xml format @ text @d31 1 @ 1.2 log @change to 24 hour clock kk @ text @d23 5 a27 5 TimeZone tz = TimeZone.getTimeZone("PST"); // or EST, MID, etc ... Date now = new Date(); DateFormat df = new SimpleDateFormat ("yyyy-MM-dd kk:mm:ss "); df.setTimeZone(tz); String currentTime = df.format(now); d30 2 a31 1 aWriter.write(currentTime + " " + s + System.getProperty("line.separator")); @ 1.1 log @Initial revision @ text @d25 1 a25 1 DateFormat df = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss "); @