Save This Page
Home » xwork-2.1.5 » com.opensymphony » xwork2 » util » logging » commons » [javadoc | source]
    1   /*
    2    * Copyright (c) 2002-2006 by OpenSymphony
    3    * All rights reserved.
    4    */
    5   package com.opensymphony.xwork2.util.logging.commons;
    6   
    7   import com.opensymphony.xwork2.util.logging.Logger;
    8   import com.opensymphony.xwork2.util.logging.LoggerUtils;
    9   import org.apache.commons.logging.Log;
   10   
   11   /**
   12    * Simple logger that delegates to commons logging
   13    */
   14   public class CommonsLogger implements Logger {
   15       
   16       private Log log;
   17       
   18       public CommonsLogger(Log log) {
   19           this.log = log;
   20       }
   21   
   22       public void error(String msg, String... args) {
   23           log.error(LoggerUtils.format(msg, args));
   24       }
   25   
   26       public void error(String msg, Throwable ex, String... args) {
   27           log.error(LoggerUtils.format(msg, args), ex);
   28       }
   29   
   30       public void info(String msg, String... args) {
   31           log.info(LoggerUtils.format(msg, args));
   32       }
   33   
   34       public void info(String msg, Throwable ex, String... args) {
   35           log.info(LoggerUtils.format(msg, args), ex);
   36       }
   37   
   38       
   39   
   40       public boolean isInfoEnabled() {
   41           return log.isInfoEnabled();
   42       }
   43   
   44       public void warn(String msg, String... args) {
   45           log.warn(LoggerUtils.format(msg, args));
   46       }
   47   
   48       public void warn(String msg, Throwable ex, String... args) {
   49           log.warn(LoggerUtils.format(msg, args), ex);
   50       }
   51       
   52       public boolean isDebugEnabled() {
   53           return log.isDebugEnabled();
   54       }
   55       
   56       public void debug(String msg, String... args) {
   57           log.debug(LoggerUtils.format(msg, args));
   58       }
   59   
   60       public void debug(String msg, Throwable ex, String... args) {
   61           log.debug(LoggerUtils.format(msg, args), ex);
   62       }
   63       
   64       public boolean isTraceEnabled() {
   65           return log.isTraceEnabled();
   66       }
   67       
   68       public void trace(String msg, String... args) {
   69           log.trace(LoggerUtils.format(msg, args));
   70       }
   71   
   72       public void trace(String msg, Throwable ex, String... args) {
   73           log.trace(LoggerUtils.format(msg, args), ex);
   74       }
   75   
   76   
   77       public void fatal(String msg, String... args) {
   78           log.fatal(LoggerUtils.format(msg, args));
   79       }
   80   
   81       public void fatal(String msg, Throwable ex, String... args) {
   82           log.fatal(LoggerUtils.format(msg, args), ex);
   83       }
   84   
   85       public boolean isErrorEnabled() {
   86           return log.isErrorEnabled();
   87       }
   88   
   89       public boolean isFatalEnabled() {
   90           return log.isFatalEnabled();
   91       }
   92   
   93       public boolean isWarnEnabled() {
   94           return log.isWarnEnabled();
   95       }
   96   
   97   }

Save This Page
Home » xwork-2.1.5 » com.opensymphony » xwork2 » util » logging » commons » [javadoc | source]