All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.jsync.logging.Logger Maven / Gradle / Ivy

There is a newer version: 1.10.13
Show newest version
/*
 * Copyright 2009 Red Hat, Inc.
 * Red Hat 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.
 *
 * Modified from original form by Tim Fox
 */

package io.jsync.logging;

import io.jsync.logging.impl.LogDelegate;

/**
 * 

This class allows us to isolate all our logging dependencies in one place. It also allows us to have zero runtime * 3rd party logging jar dependencies, since we default to JUL by default.

*

*

By default logging will occur using JUL (Java-Util-Logging). The logging configuration file (logging.properties) * used by JUL will taken from the default logging.properties in the JDK installation if no {@code java.util.logging.config.file} system * property is set. The {@code async-java / async-ruby / etc} scripts set {@code java.util.logging.config.file} to point at the logging.properties * in the async distro install directory. This in turn configures async to log to a file in a directory called * async-logs in the users home directory.

*

*

If you would prefer to use Log4J or SLF4J instead of JUL then you can set a system property called * {@code org.async.logger-delegate-factory-class-name} to the class name of the delegate for your logging system. * For Log4J the value is {@code io.jsync.logging.Log4JLogDelegateFactory}, for SLF4J the value * is {@code io.jsync.logging.SLF4JLogDelegateFactory}. You will need to ensure whatever jar files * required by your favourite log framework are on your classpath.

* * @author Tim Fox */ public class Logger { final LogDelegate delegate; public Logger(final LogDelegate delegate) { this.delegate = delegate; } public boolean isInfoEnabled() { return delegate.isInfoEnabled(); } public boolean isDebugEnabled() { return delegate.isDebugEnabled(); } public boolean isTraceEnabled() { return delegate.isTraceEnabled(); } public void fatal(final Object message) { delegate.fatal(message); } public void fatal(final Object message, final Throwable t) { delegate.fatal(message, t); } public void error(final Object message) { delegate.error(message); } public void error(final Object message, final Throwable t) { delegate.error(message, t); } public void warn(final Object message) { delegate.warn(message); } public void warn(final Object message, final Throwable t) { delegate.warn(message, t); } public void info(final Object message) { delegate.info(message); } public void info(final Object message, final Throwable t) { delegate.info(message, t); } public void debug(final Object message) { delegate.debug(message); } public void debug(final Object message, final Throwable t) { delegate.debug(message, t); } public void trace(final Object message) { delegate.trace(message); } public void trace(final Object message, final Throwable t) { delegate.trace(message, t); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy