1 8 9 package com.sleepycat.je.log; 10 11 import java.util.logging.Handler ; 12 import java.util.logging.LogRecord ; 13 14 import com.sleepycat.je.DatabaseException; 15 import com.sleepycat.je.dbi.EnvironmentImpl; 16 import com.sleepycat.je.utilint.Tracer; 17 18 22 public class TraceLogHandler extends Handler { 23 24 private EnvironmentImpl env; 25 26 public TraceLogHandler(EnvironmentImpl env) { 27 this.env = env; 28 } 29 30 public void close() { 31 } 32 33 public void flush() { 34 } 35 36 public void publish(LogRecord l) { 37 if (!env.isReadOnly() && 38 !env.mayNotWrite()) { 39 try { 40 Tracer newRec = new Tracer(l.getMessage()); 41 env.getLogManager().log(newRec); 42 } catch (DatabaseException e) { 43 44 System.err.println("Problem seen while tracing into " + 45 "the database log:"); 46 e.printStackTrace(); 47 } 48 } 49 } 50 } 51 | Popular Tags |