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.cxf.common.logging;
A container for static utility methods related to logging.
By default, CXF logs to java.util.logging. An application can change this. To log to another system, the
application must provide an object that extends
AbstractDelegatingLogger, and advertise that class
via one of the following mechanisms:
- Create a file, in the classpath, named META-INF/cxf/org.apache.cxf.Logger.
This file should contain the fully-qualified name
of the class, with no comments, on a single line.
- Call
setLoggerClass(java.lang.Class) with a Class<?> reference to the logger class.
CXF provides
Log4jLogger to use log4j instead of java.util.logging.
public static final String KEY = "org.apache.cxf.Logger";
Specify a logger class that inherits from
AbstractDelegatingLogger.
Enable users to use their own logger implementation.
Get a Logger with the associated default resource bundle for the class.
- Parameters:
cls the Class to contain the Logger- Returns:
- an appropriate Logger
Get a Logger with an associated resource bundle.
- Parameters:
cls the Class to contain the Loggername the resource name- Returns:
- an appropriate Logger
Get a Logger with an associated resource bundle.
- Parameters:
cls the Class to contain the Logger (to find resources)name the resource nameloggerName the full name for the logger- Returns:
- an appropriate Logger
Get a Logger with the associated default resource bundle for the class.
- Parameters:
cls the Class to contain the Logger- Returns:
- an appropriate Logger
Get a Logger with an associated resource bundle.
- Parameters:
cls the Class to contain the Loggername the resource name- Returns:
- an appropriate Logger
Get a Logger with an associated resource bundle.
- Parameters:
cls the Class to contain the Logger (to find resources)name the resource nameloggerName the full name for the logger- Returns:
- an appropriate Logger
Allows both parameter substitution and a typed Throwable to be logged.
- Parameters:
logger the Logger the log tolevel the severity levelmessage the log messagethrowable the Throwable to logparameter the parameter to substitute into message
final String formattedMessage =
doLog(logger, level, formattedMessage, throwable);
Allows both parameter substitution and a typed Throwable to be logged.
- Parameters:
logger the Logger the log tolevel the severity levelmessage the log messagethrowable the Throwable to logparameters the parameters to substitute into message
final String formattedMessage =
doLog(logger, level, formattedMessage, throwable);
Checks log level and logs
- Parameters:
logger the Logger the log tolevel the severity levelmessage the log message
Checks log level and logs
- Parameters:
logger the Logger the log tolevel the severity levelmessage the log messagethrowable the Throwable to log
Checks log level and logs
- Parameters:
logger the Logger the log tolevel the severity levelmessage the log messageparameter the parameter to substitute into message
log(logger, level, message, new Object[] {parameter}); Checks log level and logs
- Parameters:
logger the Logger the log tolevel the severity levelmessage the log messageparameters the parameters to substitute into message
msg = MessageFormat.format(msg, parameters);
doLog(logger, level, msg, null);
for (int x = 0; x < stack.length; x++) { Retrieve localized message retrieved from a logger's resource
bundle.
- Parameters:
logger the Loggermessage the message to be localized
return bundle != null ? bundle.getString(message) : message;