1 package com.protomatter.syslog.commons; 2 3 52 53 import org.apache.commons.logging.*; 54 import com.protomatter.syslog.*; 55 import com.protomatter.util.*; 56 57 60 public class SyslogChannelLog 61 implements Log 62 { 63 66 protected Debug debug = null; 67 68 71 protected String name = null; 72 73 76 public SyslogChannelLog(String name) 77 { 78 super(); 79 80 this.name = name; 81 this.debug = Debug.forName(name); 82 } 83 84 90 public boolean isDebugEnabled() 91 { 92 return debug.debug(); 93 } 94 95 98 public boolean isErrorEnabled() 99 { 100 return true; 101 } 102 103 106 public boolean isFatalEnabled() 107 { 108 return true; 109 } 110 111 115 public boolean isInfoEnabled() 116 { 117 return debug.info(); 118 } 119 120 126 public boolean isTraceEnabled() 127 { 128 return debug.trace(); 129 } 130 131 134 public boolean isWarnEnabled() 135 { 136 return true; 137 } 138 139 140 143 public void trace(Object message) 144 { 145 Syslog.log(Syslog.getLocalHostName(), 146 this, this.name, message, null, Syslog.DEBUG, 147 Thread.currentThread(), Thread.currentThread().getName(), 148 System.currentTimeMillis(), 1); 149 } 150 151 154 public void trace(Object message, Throwable t) 155 { 156 Syslog.log(Syslog.getLocalHostName(), 157 this, this.name, message, t, Syslog.DEBUG, 158 Thread.currentThread(), Thread.currentThread().getName(), 159 System.currentTimeMillis(), 1); 160 } 161 162 165 public void debug(Object message) 166 { 167 Syslog.log(Syslog.getLocalHostName(), 168 this, this.name, message, null, Syslog.DEBUG, 169 Thread.currentThread(), Thread.currentThread().getName(), 170 System.currentTimeMillis(), 1); 171 } 172 173 176 public void debug(Object message, Throwable t) 177 { 178 Syslog.log(Syslog.getLocalHostName(), 179 this, this.name, message, t, Syslog.DEBUG, 180 Thread.currentThread(), Thread.currentThread().getName(), 181 System.currentTimeMillis(), 1); 182 } 183 184 187 public void info(Object message) 188 { 189 Syslog.log(Syslog.getLocalHostName(), 190 this, this.name, message, null, Syslog.INFO, 191 Thread.currentThread(), Thread.currentThread().getName(), 192 System.currentTimeMillis(), 1); 193 } 194 195 198 public void info(Object message, Throwable t) 199 { 200 Syslog.log(Syslog.getLocalHostName(), 201 this, this.name, message, t, Syslog.INFO, 202 Thread.currentThread(), Thread.currentThread().getName(), 203 System.currentTimeMillis(), 1); 204 } 205 206 209 public void warn(Object message) 210 { 211 Syslog.log(Syslog.getLocalHostName(), 212 this, this.name, message, null, Syslog.WARNING, 213 Thread.currentThread(), Thread.currentThread().getName(), 214 System.currentTimeMillis(), 1); 215 } 216 217 220 public void warn(Object message, Throwable t) 221 { 222 Syslog.log(Syslog.getLocalHostName(), 223 this, this.name, message, t, Syslog.WARNING, 224 Thread.currentThread(), Thread.currentThread().getName(), 225 System.currentTimeMillis(), 1); 226 } 227 228 231 public void error(Object message) 232 { 233 Syslog.log(Syslog.getLocalHostName(), 234 this, this.name, message, null, Syslog.ERROR, 235 Thread.currentThread(), Thread.currentThread().getName(), 236 System.currentTimeMillis(), 1); 237 } 238 239 242 public void error(Object message, Throwable t) 243 { 244 Syslog.log(Syslog.getLocalHostName(), 245 this, this.name, message, t, Syslog.ERROR, 246 Thread.currentThread(), Thread.currentThread().getName(), 247 System.currentTimeMillis(), 1); 248 } 249 250 253 public void fatal(Object message) 254 { 255 Syslog.log(Syslog.getLocalHostName(), 256 this, this.name, message, null, Syslog.FATAL, 257 Thread.currentThread(), Thread.currentThread().getName(), 258 System.currentTimeMillis(), 1); 259 } 260 261 264 public void fatal(Object message, Throwable t) 265 { 266 Syslog.log(Syslog.getLocalHostName(), 267 this, this.name, message, t, Syslog.FATAL, 268 Thread.currentThread(), Thread.currentThread().getName(), 269 System.currentTimeMillis(), 1); 270 } 271 } 272 | Popular Tags |