1 16 17 package org.apache.ajp.tomcat4; 18 19 import org.apache.catalina.Logger; 20 21 class Ajp13Logger { 22 23 private String name = null; 24 private Ajp13Connector connector = null; 25 private boolean logStackTrace = false; 26 27 Ajp13Logger() { 28 name = toString(); 29 } 30 31 void setConnector(Ajp13Connector connector) { 32 this.connector = connector; 33 } 34 35 void setName(String name) { 36 this.name = name; 37 } 38 39 44 void log(String message) { 45 46 if (logStackTrace) { 47 log(message, new Throwable ()); 48 } else { 49 Logger logger = getLogger(); 50 51 if (logger != null) 52 logger.log(name + " " + message); 53 else 54 System.out.println(name + " " + message); 55 } 56 } 57 58 64 void log(String message, Throwable throwable) { 65 66 Logger logger = getLogger(); 67 68 if (logger != null) 69 logger.log(name + " " + message, throwable); 70 else { 71 System.out.println(name + " " + message); 72 throwable.printStackTrace(System.out); 73 } 74 75 } 76 77 private Logger getLogger() { 78 79 if (connector != null) { 80 return connector.getContainer().getLogger(); 81 } else { 82 return null; 83 } 84 85 } 86 87 } 88 | Popular Tags |