1 29 30 package com.caucho.log; 31 32 import com.caucho.util.L10N; 33 34 import java.util.logging.Handler ; 35 import java.util.logging.LogRecord ; 36 37 41 public class SubHandler extends Handler { 42 private static final L10N L = new L10N(SubHandler.class); 43 44 private Handler _handler; 45 46 SubHandler(Handler handler) 47 { 48 _handler = handler; 49 } 50 51 54 public void publish(LogRecord record) 55 { 56 if (record.getLevel().intValue() < getLevel().intValue()) 57 return; 58 59 if (_handler != null) 60 _handler.publish(record); 61 } 62 63 66 public void flush() 67 { 68 if (_handler != null) 69 _handler.flush(); 70 } 71 72 75 public void close() 76 { 77 if (_handler != null) 78 _handler.close(); 79 80 _handler = null; 81 } 82 83 86 public int hashCode() 87 { 88 if (_handler == null) 89 return super.hashCode(); 90 else 91 return _handler.hashCode(); 92 } 93 94 97 public boolean equals(Object o) 98 { 99 if (this == o) 100 return true; 101 else if (o == null) 102 return false; 103 104 if (_handler == null) 105 return false; 106 else if (o.equals(_handler)) 107 return true; 108 109 if (! (o instanceof SubHandler)) 110 return false; 111 112 SubHandler subHandler = (SubHandler) o; 113 114 return _handler.equals(subHandler._handler); 115 } 116 117 public String toString() 118 { 119 return "SubHandler[" + _handler + "]"; 120 } 121 } 122 | Popular Tags |