1 package org.enhydra.snapper.logging; 2 3 import java.util.Properties ; 4 5 import org.enhydra.snapper.api.RootException; 6 7 import org.apache.log4j.Logger; 8 import org.apache.log4j.PropertyConfigurator; 9 10 17 public class StandardLoggingManager implements org.enhydra.snapper.api.logging.LoggingManager { 18 19 private static final String defaultLogChannel="Snapper"; 20 21 22 28 public void configure (Properties prop) { 29 PropertyConfigurator.configure(prop); 30 } 31 32 36 42 public void error (String msg) { 43 error(defaultLogChannel,msg); 44 } 45 46 53 public void error (String msg,RootException ex) { 54 error(defaultLogChannel,msg,ex); 55 } 56 57 64 public void error (String channel,String msg) { 65 Logger logger=Logger.getLogger(channel); 66 if (logger!=null) 67 logger.error(msg); 68 69 70 } 71 72 80 public void error (String channel,String msg,RootException ex){ 81 Logger logger=Logger.getLogger(channel); 82 if (logger!=null) 83 logger.error(msg,ex); 84 85 } 86 87 93 public void warn (String msg) { 94 warn(defaultLogChannel,msg); 95 } 96 97 104 public void warn (String msg,RootException ex) { 105 warn(defaultLogChannel,msg,ex); 106 } 107 108 115 public void warn (String channel,String msg) { 116 Logger logger=Logger.getLogger(channel); 117 if (logger!=null) 118 logger.warn(msg); 119 120 } 121 122 130 public void warn (String channel,String msg,RootException ex) { 131 Logger logger=Logger.getLogger(channel); 132 if (logger!=null) 133 logger.warn(msg,ex); 134 135 } 136 137 143 public void info (String msg) { 144 info(defaultLogChannel,msg); 145 } 146 147 154 public void info (String msg,RootException ex) { 155 info(defaultLogChannel,msg,ex); 156 } 157 158 165 public void info (String channel,String msg) { 166 Logger logger=Logger.getLogger(channel); 167 if (logger!=null) 168 logger.info(msg); 169 170 } 171 172 180 public void info (String channel,String msg,RootException ex) { 181 Logger logger=Logger.getLogger(channel); 182 if (logger!=null) 183 logger.info(msg,ex); 184 185 } 186 187 193 public void debug (String msg) { 194 debug(defaultLogChannel,msg); 195 } 196 197 204 public void debug (String msg,RootException ex) { 205 debug(defaultLogChannel,msg,ex); 206 } 207 208 215 public void debug (String channel,String msg) { 216 Logger logger=Logger.getLogger(channel); 217 if (logger!=null) 218 logger.debug(msg); 219 220 } 221 222 230 public void debug (String channel,String msg,RootException ex) { 231 Logger logger=Logger.getLogger(channel); 232 if (logger!=null) 233 logger.debug(msg,ex); 234 235 } 236 237 } 238 | Popular Tags |