Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
commons-logging-1.2-src.zip - Apache Commons Logging
commons-logging-1.2-src.zip is the source ZIP file for Apache Commons Logging 1.2, which is an ultra-thin bridge between different logging implementations. A library that uses the commons-logging API can be used with any logging implementation at runtime.
ZIP File Size and Download Location:
JAR name: commons-logging-1.2-src.zip Target JDK version: 1.2 Dependency: None File size: 293,884 bytes) Date modified: 05-Jul-2014 Download: Apache Commons Logging
✍: FYIcenter.com
⏎ org/apache/commons/logging/impl/Log4JLogger.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.logging.impl; import java.io.Serializable; import org.apache.commons.logging.Log; import org.apache.log4j.Logger; import org.apache.log4j.Priority; import org.apache.log4j.Level; /** * Implementation of {@link Log} that maps directly to a * <strong>Logger</strong> for log4J version 1.2. * <p> * Initial configuration of the corresponding Logger instances should be done * in the usual manner, as outlined in the Log4J documentation. * <p> * The reason this logger is distinct from the 1.3 logger is that in version 1.2 * of Log4J: * <ul> * <li>class Logger takes Priority parameters not Level parameters. * <li>class Level extends Priority * </ul> * Log4J1.3 is expected to change Level so it no longer extends Priority, which is * a non-binary-compatible change. The class generated by compiling this code against * log4j 1.2 will therefore not run against log4j 1.3. * * @version $Id: Log4JLogger.java 1448119 2013-02-20 12:28:04Z tn $ */ public class Log4JLogger implements Log, Serializable { /** Serializable version identifier. */ private static final long serialVersionUID = 5160705895411730424L; // ------------------------------------------------------------- Attributes /** The fully qualified name of the Log4JLogger class. */ private static final String FQCN = Log4JLogger.class.getName(); /** Log to this logger */ private transient volatile Logger logger = null; /** Logger name */ private final String name; private static final Priority traceLevel; // ------------------------------------------------------------ // Static Initializer. // // Note that this must come after the static variable declarations // otherwise initialiser expressions associated with those variables // will override any settings done here. // // Verify that log4j is available, and that it is version 1.2. // If an ExceptionInInitializerError is generated, then LogFactoryImpl // will treat that as meaning that the appropriate underlying logging // library is just not present - if discovery is in progress then // discovery will continue. // ------------------------------------------------------------ static { if (!Priority.class.isAssignableFrom(Level.class)) { // nope, this is log4j 1.3, so force an ExceptionInInitializerError throw new InstantiationError("Log4J 1.2 not available"); } // Releases of log4j1.2 >= 1.2.12 have Priority.TRACE available, earlier // versions do not. If TRACE is not available, then we have to map // calls to Log.trace(...) onto the DEBUG level. Priority _traceLevel; try { _traceLevel = (Priority) Level.class.getDeclaredField("TRACE").get(null); } catch(Exception ex) { // ok, trace not available _traceLevel = Level.DEBUG; } traceLevel = _traceLevel; } // ------------------------------------------------------------ Constructor public Log4JLogger() { name = null; } /** * Base constructor. */ public Log4JLogger(String name) { this.name = name; this.logger = getLogger(); } /** * For use with a log4j factory. */ public Log4JLogger(Logger logger) { if (logger == null) { throw new IllegalArgumentException( "Warning - null logger in constructor; possible log4j misconfiguration."); } this.name = logger.getName(); this.logger = logger; } /** * Logs a message with <code>org.apache.log4j.Priority.TRACE</code>. * When using a log4j version that does not support the <code>TRACE</code> * level, the message will be logged at the <code>DEBUG</code> level. * * @param message to log * @see org.apache.commons.logging.Log#trace(Object) */ public void trace(Object message) { getLogger().log(FQCN, traceLevel, message, null); } /** * Logs a message with <code>org.apache.log4j.Priority.TRACE</code>. * When using a log4j version that does not support the <code>TRACE</code> * level, the message will be logged at the <code>DEBUG</code> level. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#trace(Object, Throwable) */ public void trace(Object message, Throwable t) { getLogger().log(FQCN, traceLevel, message, t); } /** * Logs a message with <code>org.apache.log4j.Priority.DEBUG</code>. * * @param message to log * @see org.apache.commons.logging.Log#debug(Object) */ public void debug(Object message) { getLogger().log(FQCN, Level.DEBUG, message, null); } /** * Logs a message with <code>org.apache.log4j.Priority.DEBUG</code>. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#debug(Object, Throwable) */ public void debug(Object message, Throwable t) { getLogger().log(FQCN, Level.DEBUG, message, t); } /** * Logs a message with <code>org.apache.log4j.Priority.INFO</code>. * * @param message to log * @see org.apache.commons.logging.Log#info(Object) */ public void info(Object message) { getLogger().log(FQCN, Level.INFO, message, null); } /** * Logs a message with <code>org.apache.log4j.Priority.INFO</code>. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#info(Object, Throwable) */ public void info(Object message, Throwable t) { getLogger().log(FQCN, Level.INFO, message, t); } /** * Logs a message with <code>org.apache.log4j.Priority.WARN</code>. * * @param message to log * @see org.apache.commons.logging.Log#warn(Object) */ public void warn(Object message) { getLogger().log(FQCN, Level.WARN, message, null); } /** * Logs a message with <code>org.apache.log4j.Priority.WARN</code>. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#warn(Object, Throwable) */ public void warn(Object message, Throwable t) { getLogger().log(FQCN, Level.WARN, message, t); } /** * Logs a message with <code>org.apache.log4j.Priority.ERROR</code>. * * @param message to log * @see org.apache.commons.logging.Log#error(Object) */ public void error(Object message) { getLogger().log(FQCN, Level.ERROR, message, null); } /** * Logs a message with <code>org.apache.log4j.Priority.ERROR</code>. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#error(Object, Throwable) */ public void error(Object message, Throwable t) { getLogger().log(FQCN, Level.ERROR, message, t); } /** * Logs a message with <code>org.apache.log4j.Priority.FATAL</code>. * * @param message to log * @see org.apache.commons.logging.Log#fatal(Object) */ public void fatal(Object message) { getLogger().log(FQCN, Level.FATAL, message, null); } /** * Logs a message with <code>org.apache.log4j.Priority.FATAL</code>. * * @param message to log * @param t log this cause * @see org.apache.commons.logging.Log#fatal(Object, Throwable) */ public void fatal(Object message, Throwable t) { getLogger().log(FQCN, Level.FATAL, message, t); } /** * Return the native Logger instance we are using. */ public Logger getLogger() { Logger result = logger; if (result == null) { synchronized(this) { result = logger; if (result == null) { logger = result = Logger.getLogger(name); } } } return result; } /** * Check whether the Log4j Logger used is enabled for <code>DEBUG</code> priority. */ public boolean isDebugEnabled() { return getLogger().isDebugEnabled(); } /** * Check whether the Log4j Logger used is enabled for <code>ERROR</code> priority. */ public boolean isErrorEnabled() { return getLogger().isEnabledFor(Level.ERROR); } /** * Check whether the Log4j Logger used is enabled for <code>FATAL</code> priority. */ public boolean isFatalEnabled() { return getLogger().isEnabledFor(Level.FATAL); } /** * Check whether the Log4j Logger used is enabled for <code>INFO</code> priority. */ public boolean isInfoEnabled() { return getLogger().isInfoEnabled(); } /** * Check whether the Log4j Logger used is enabled for <code>TRACE</code> priority. * When using a log4j version that does not support the TRACE level, this call * will report whether <code>DEBUG</code> is enabled or not. */ public boolean isTraceEnabled() { return getLogger().isEnabledFor(traceLevel); } /** * Check whether the Log4j Logger used is enabled for <code>WARN</code> priority. */ public boolean isWarnEnabled() { return getLogger().isEnabledFor(Level.WARN); } }
⏎ org/apache/commons/logging/impl/Log4JLogger.java
Or download all of them as a single archive file:
File name: commons-logging-1.2-sources.zip File size: 68497 bytes Release date: 2014-07-05 Download
⇒ What Is commons-logging-1.1.3.jar?
⇐ What Is commons-logging-1.2.jar?
2018-10-25, 9789👍, 0💬
Popular Posts:
ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify ex...
What is the jaxp\SourceValidator.jav aprovided in the Apache Xerces package? I have Apache Xerces 2....
What Is js.jar in Rhino JavaScript 1.7R5? js.jar in Rhino JavaScript 1.7R5 is the JAR file for Rhino...
Java Advanced Imaging (JAI) is a Java platform extension API that provides a set of object-oriented ...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....