00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 package org.openmobileis.common.util.log;
00030
00031 import java.util.Properties;
00032 import java.io.PrintStream;
00033
00041 public class DefaultLogTracer implements LogTracer {
00042
00043 protected PrintStream outStream;
00044
00045 public DefaultLogTracer() {
00046
00047 }
00048
00049 public void setLogTracerProperties(Properties props) {
00050 }
00051
00056 public void setLogStream(java.io.PrintStream newStream) {
00057 outStream = newStream;
00058 }
00059
00063 public synchronized void trace(int service, int priority, String message) {
00064 outStream.print(new java.util.Date().toString()
00065 +" Service :"+LogServices.toString(service)
00066 +" Priority:"+LogPriorities.toString(priority)
00067 +" Message:"+message+"\n");
00068 outStream.flush();
00069
00070 }
00071
00072 public PrintStream getLogPrintStream() {
00073 return outStream;
00074 }
00075
00079 public void finalize() {
00080 try {
00081 if (outStream != null) {
00082 outStream.flush();
00083 outStream.close();
00084 }
00085 } catch (java.lang.Exception exc) {
00086 System.out.println("exception: " + exc.getMessage());
00087 exc.printStackTrace();
00088 }
00089 }
00090 }