325N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. Oracle designates this 325N/A * particular file as subject to the "Classpath" exception as provided 325N/A * by Oracle in the LICENSE file that accompanied this code. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 325N/A * or visit www.oracle.com if you need additional information or have any 325N/A * This is a helper class that provides some conveniece methods wrapped around the 325N/A * standard {@link java.util.logging.Logger} interface. 325N/A * The class also makes sure that logger names of each Metro subsystem are consistent 325N/A * @author Marek Potociar <marek.potociar at sun.com> 325N/A * @author Fabian Ritzmann 325N/A * Prevents creation of a new instance of this Logger unless used by a subclass. 325N/A * The factory method returns preconfigured Logger wrapper for the class. Method calls 325N/A * {@link #getSystemLoggerName(java.lang.Class)} to generate default logger name. 325N/A * Since there is no caching implemented, it is advised that the method is called only once 325N/A * per a class in order to initialize a final static logger variable, which is then used 325N/A * through the class to perform actual logging tasks. 325N/A * @param componentClass class of the component that will use the logger instance. Must not be {@code null}. 325N/A * @return logger instance preconfigured for use with the component 325N/A * @throws NullPointerException if the componentClass parameter is {@code null}. 325N/A * The factory method returns preconfigured Logger wrapper for the class. Since there is no caching implemented, 325N/A * it is advised that the method is called only once per a class in order to initialize a final static logger variable, 325N/A * which is then used through the class to perform actual logging tasks. 325N/A * This method should be only used in a special cases when overriding of a default logger name derived from the 325N/A * package of the component class is needed. For all common use cases please use {@link #getLogger(java.lang.Class)} 325N/A * @param customLoggerName custom name of the logger. 325N/A * @param componentClass class of the component that will use the logger instance. Must not be {@code null}. 325N/A * @return logger instance preconfigured for use with the component 325N/A * @throws NullPointerException if the componentClass parameter is {@code null}. 325N/A * @see #getLogger(java.lang.Class) 325N/A * Calculates the subsystem suffix based on the package of the component class 325N/A * @param componentClass class of the component that will use the logger instance. Must not be {@code null}. 325N/A * @return system logger name for the given {@code componentClass} instance 325N/A * Method logs {@code exception}'s message as a {@code SEVERE} logging level 325N/A * If {@code cause} parameter is not {@code null}, it is logged as well and 325N/A * {@code exception} original cause is initialized with instance referenced 325N/A * by {@code cause} parameter. 325N/A * @param exception exception whose message should be logged. Must not be 325N/A * @param cause initial cause of the exception that should be logged as well 325N/A * and set as {@code exception}'s original cause. May be {@code null}. 325N/A * @return the same exception instance that was passed in as the {@code exception} 325N/A * Method logs {@code exception}'s message as a {@code SEVERE} logging level 325N/A * If {@code logCause} parameter is {@code true}, {@code exception}'s original 325N/A * cause is logged as well (if exists). This may be used in cases when 325N/A * {@code exception}'s class provides constructor to initialize the original 325N/A * cause. In such case you do not need to use 325N/A * {@link #logSevereException(Throwable, Throwable)} 325N/A * method version but you might still want to log the original cause as well. 325N/A * @param exception exception whose message should be logged. Must not be 325N/A * @param logCause deterimnes whether initial cause of the exception should 325N/A * @return the same exception instance that was passed in as the {@code exception} 325N/A * Same as {@link #logSevereException(Throwable, boolean) logSevereException(exception, true)}. 325N/A * Method logs {@code exception}'s message at the logging level specified by the 325N/A * {@code level} argument. 325N/A * If {@code cause} parameter is not {@code null}, it is logged as well and 325N/A * {@code exception} original cause is initialized with instance referenced 325N/A * by {@code cause} parameter. 325N/A * @param exception exception whose message should be logged. Must not be 325N/A * @param cause initial cause of the exception that should be logged as well 325N/A * and set as {@code exception}'s original cause. May be {@code null}. 325N/A * @param level loging level which should be used for logging 325N/A * @return the same exception instance that was passed in as the {@code exception} 325N/A * Method logs {@code exception}'s message at the logging level specified by the 325N/A * {@code level} argument. 325N/A * If {@code logCause} parameter is {@code true}, {@code exception}'s original 325N/A * cause is logged as well (if exists). This may be used in cases when 325N/A * {@code exception}'s class provides constructor to initialize the original 325N/A * cause. In such case you do not need to use 325N/A * {@link #logException(Throwable, Throwable, Level) logException(exception, cause, level)} 325N/A * method version but you might still want to log the original cause as well. 325N/A * @param exception exception whose message should be logged. Must not be 325N/A * @param logCause deterimnes whether initial cause of the exception should 325N/A * @param level loging level which should be used for logging 325N/A * @return the same exception instance that was passed in as the {@code exception} 325N/A * Same as {@link #logException(Throwable, Throwable, Level) 325N/A * logException(exception, true, level)}. 325N/A * Function returns the name of the caller method for the method executing this 325N/A * @return caller method name from the call stack of the current {@link Thread}. 325N/A * Method returns the name of the method that is on the {@code methodIndexInStack} 325N/A * position in the call stack of the current {@link Thread}. 325N/A * @param methodIndexInStack index to the call stack to get the method name for. 325N/A * @return the name of the method that is on the {@code methodIndexInStack} 325N/A * position in the call stack of the current {@link Thread}.