1 29 30 package com.caucho.log; 31 32 import java.util.logging.Handler ; 33 import java.util.logging.Level ; 34 import java.util.logging.LogRecord ; 35 36 39 public class LevelHandler extends Handler { 40 private final int _level; 41 private final Handler []_handlers; 42 43 public LevelHandler(Level level, Handler []handlers) 44 { 45 _level = level.intValue(); 46 _handlers = handlers; 47 } 48 49 52 public void publish(LogRecord record) 53 { 54 int recordLevel = record.getLevel().intValue(); 55 56 if (recordLevel < _level) 57 return; 58 59 for (int i = 0; i < _handlers.length; i++) { 60 Handler handler = _handlers[i]; 61 62 if (_level <= handler.getLevel().intValue()) 63 handler.publish(record); 64 } 65 } 66 67 70 public void flush() 71 { 72 for (int i = 0; i < _handlers.length; i++) { 73 Handler handler = _handlers[i]; 74 75 if (_level <= handler.getLevel().intValue()) 76 handler.flush(); 77 } 78 } 79 80 public void close() 81 { 82 } 83 } 84 | Popular Tags |