001/* 002 * $HeadURL: file:///opt/dev/not-yet-commons-ssl-SVN-repo/tags/commons-ssl-0.3.17/src/java/org/apache/commons/ssl/LogHelper.java $ 003 * $Revision: 121 $ 004 * $Date: 2007-11-13 21:26:57 -0800 (Tue, 13 Nov 2007) $ 005 * 006 * ==================================================================== 007 * Licensed to the Apache Software Foundation (ASF) under one 008 * or more contributor license agreements. See the NOTICE file 009 * distributed with this work for additional information 010 * regarding copyright ownership. The ASF licenses this file 011 * to you under the Apache License, Version 2.0 (the 012 * "License"); you may not use this file except in compliance 013 * with the License. You may obtain a copy of the License at 014 * 015 * http://www.apache.org/licenses/LICENSE-2.0 016 * 017 * Unless required by applicable law or agreed to in writing, 018 * software distributed under the License is distributed on an 019 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 020 * KIND, either express or implied. See the License for the 021 * specific language governing permissions and limitations 022 * under the License. 023 * ==================================================================== 024 * 025 * This software consists of voluntary contributions made by many 026 * individuals on behalf of the Apache Software Foundation. For more 027 * information on the Apache Software Foundation, please see 028 * <http://www.apache.org/>. 029 * 030 */ 031 032package org.apache.commons.ssl; 033 034import org.apache.log4j.Logger; 035 036/** 037 * <p/> 038 * Wraps a Log4j Logger. This non-public class is the one actually interacting 039 * with the log4j.jar library. That way LogWrapper can safely attempt to use 040 * log4j.jar, but still degrade gracefully and provide logging via standard-out 041 * even if log4j is unavailable. 042 * <p/> 043 * The interactions with log4j.jar could be done directly inside LogWrapper 044 * as long as the Java code is compiled by Java 1.4 or greater (still works 045 * at runtime in Java 1.3). The interactions with log4j.jar only need to be 046 * pushed out into a separate class like this for people using a Java 1.3 047 * compiler, which creates bytecode that is more strict with depedency 048 * checking. 049 * 050 * @author Credit Union Central of British Columbia 051 * @author <a href="http://www.cucbc.com/">www.cucbc.com</a> 052 * @author <a href="mailto:juliusdavies@cucbc.com">juliusdavies@cucbc.com</a> 053 * @since 3-Aug-2006 054 */ 055final class LogHelper { 056 private final Logger l; 057 058 LogHelper(Class c) { l = Logger.getLogger(c); } 059 060 LogHelper(String s) { l = Logger.getLogger(s); } 061 062 void debug(Object o) { l.debug(o); } 063 064 void debug(Object o, Throwable t) { l.debug(o, t); } 065 066 void info(Object o) { l.info(o); } 067 068 void info(Object o, Throwable t) { l.info(o, t); } 069 070 void warn(Object o) { l.warn(o); } 071 072 void warn(Object o, Throwable t) { l.warn(o, t); } 073 074 void error(Object o) { l.error(o); } 075 076 void error(Object o, Throwable t) { l.error(o, t); } 077 078 void fatal(Object o) { l.fatal(o); } 079 080 void fatal(Object o, Throwable t) { l.fatal(o, t); } 081 082 boolean isDebugEnabled() { return l.isDebugEnabled(); } 083 084 boolean isInfoEnabled() { return l.isInfoEnabled(); } 085 086 Object getLog4jLogger() { return l; } 087}