1 5 6 package org.joseki.logging.java; 7 8 import java.util.logging.* ; 9 import javax.servlet.ServletContext ; 10 11 16 public class ServletLogHandler extends Handler 17 { 18 ServletContext context ; 19 20 ServletLogHandler(ServletContext cxt) 21 { 22 context = cxt ; 23 } 24 25 public void publish(LogRecord record) 26 { 27 if (!isLoggable(record)) { 28 return; 29 } 30 String msg; 31 try { 32 msg = getFormatter().format(record); 33 } catch (Exception ex) { 34 reportError(null, ex, ErrorManager.FORMAT_FAILURE); 37 return; 38 } 39 40 try { 41 context.log(msg) ; 43 } catch (Exception ex) { 44 reportError(null, ex, ErrorManager.WRITE_FAILURE); 47 } 48 } 49 50 public void flush() { return ; } 51 public void close() { return ; } 52 } 53 54 55 81 | Popular Tags |