1 /***************************************************************** 2 * Licensed to the Apache Software Foundation (ASF) under one * 3 * or more contributor license agreements. See the NOTICE file * 4 * distributed with this work for additional information * 5 * regarding copyright ownership. The ASF licenses this file * 6 * to you under the Apache License, Version 2.0 (the * 7 * "License"); you may not use this file except in compliance * 8 * with the License. You may obtain a copy of the License at * 9 * * 10 * http://www.apache.org/licenses/LICENSE-2.0 * 11 * * 12 * Unless required by applicable law or agreed to in writing, * 13 * software distributed under the License is distributed on an * 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * 15 * KIND, either express or implied. See the License for the * 16 * specific language governing permissions and limitations * 17 * under the License. * 18 ****************************************************************/ 19 20 21 package org.apache.james.postage.smtpserver; 22 23 import org.apache.commons.logging.Log; 24 import org.apache.commons.logging.LogFactory; 25 26 /*** 27 * adapter to redirect log avalon messages to commons-logging 28 */ 29 public class AvalonToPostageLogger implements org.apache.avalon.framework.logger.Logger { 30 31 private static Log log = LogFactory.getLog(AvalonToPostageLogger.class); 32 33 private boolean m_debugEnabled = true; 34 35 public void debug(java.lang.String string) { 36 log.debug(string); 37 } 38 39 public void debug(java.lang.String string, java.lang.Throwable throwable) { 40 log.debug(string, throwable); 41 } 42 43 public boolean isDebugEnabled() { 44 return m_debugEnabled; 45 } 46 47 public void disableDebug() { 48 m_debugEnabled = false; 49 } 50 51 public void info(java.lang.String string) { 52 log.debug(string); 53 } 54 55 public void info(java.lang.String string, java.lang.Throwable throwable) { 56 log.debug(string, throwable); 57 } 58 59 public boolean isInfoEnabled() { 60 return true; 61 } 62 63 public void warn(java.lang.String string) { 64 log.info(string); 65 } 66 67 public void warn(java.lang.String string, java.lang.Throwable throwable) { 68 log.info(string, throwable); 69 } 70 71 public boolean isWarnEnabled() { 72 return true; 73 } 74 75 public void error(java.lang.String string) { 76 log.info(string); 77 } 78 79 public void error(java.lang.String string, java.lang.Throwable throwable) { 80 log.info(string, throwable); 81 } 82 83 public boolean isErrorEnabled() { 84 return true; 85 } 86 87 public void fatalError(java.lang.String string) { 88 log.error(string); 89 } 90 91 public void fatalError(java.lang.String string, java.lang.Throwable throwable) { 92 log.error(string, throwable); 93 } 94 95 public boolean isFatalErrorEnabled() { 96 return true; 97 } 98 99 public org.apache.avalon.framework.logger.Logger getChildLogger(java.lang.String string) { 100 return this; 101 } 102 103 }