• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
Log Interface Reference
Inheritance diagram for Log:
Jdk14Logger SimpleLog

Description

A simple logging interface abstracting logging APIs. In order to be instantiated successfully by com.good.gd.apache.commons.logging.LogFactory, classes that implement this interface must have a constructor that takes a single String parameter representing the "name" of this Log.

The six logging levels used by Log are (in order):

  1. trace (the least serious)
  2. debug
  3. info
  4. warn
  5. error
  6. fatal (the most serious)

The mapping of these log levels to the concepts used by the underlying logging system is implementation dependent. The implemention should ensure, though, that this ordering behaves as expected.

Performance is often a logging concern. By examining the appropriate property, a component can avoid expensive operations (producing information to be logged).

For example,

   if (log.isDebugEnabled()) {
       ... do something expensive ...
       log.debug(theResult);
   }

Configuration of the underlying logging system will generally be done external to the Logging APIs, through whatever mechanism is supported by that system.

Author
Scott Sanders
Rod Waldhoff
Version
Id
Log.java 381838 2006-02-28 23:57:11Z skitching

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed 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.
 */

Public Member Functions

boolean isDebugEnabled ()
 
boolean isErrorEnabled ()
 
boolean isFatalEnabled ()
 
boolean isInfoEnabled ()
 
boolean isTraceEnabled ()
 
boolean isWarnEnabled ()
 
void trace (Object message)
 
void trace (Object message, Throwable t)
 
void debug (Object message)
 
void debug (Object message, Throwable t)
 
void info (Object message)
 
void info (Object message, Throwable t)
 
void warn (Object message)
 
void warn (Object message, Throwable t)
 
void error (Object message)
 
void error (Object message, Throwable t)
 
void fatal (Object message)
 
void fatal (Object message, Throwable t)
 

Member Function Documentation

◆ isDebugEnabled()

boolean isDebugEnabled ( )

Is debug logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than debug.

Returns
true if debug is enabled in the underlying logger.

Implemented in SimpleLog, and Jdk14Logger.

◆ isErrorEnabled()

boolean isErrorEnabled ( )

Is error logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than error.

Returns
true if error is enabled in the underlying logger.

Implemented in SimpleLog, and Jdk14Logger.

◆ isFatalEnabled()

boolean isFatalEnabled ( )

Is fatal logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than fatal.

Returns
true if fatal is enabled in the underlying logger.

Implemented in SimpleLog, and Jdk14Logger.

◆ isInfoEnabled()

boolean isInfoEnabled ( )

Is info logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than info.

Returns
true if info is enabled in the underlying logger.

Implemented in SimpleLog, and Jdk14Logger.

◆ isTraceEnabled()

boolean isTraceEnabled ( )

Is trace logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than trace.

Returns
true if trace is enabled in the underlying logger.

Implemented in SimpleLog, and Jdk14Logger.

◆ isWarnEnabled()

boolean isWarnEnabled ( )

Is warn logging currently enabled?

Call this method to prevent having to perform expensive operations (for example, String concatenation) when the log level is more than warn.

Returns
true if warn is enabled in the underlying logger.

Implemented in SimpleLog, and Jdk14Logger.

◆ trace() [1/2]

void trace ( Object  message)

Log a message with trace log level.

Parameters
messagelog this message

Implemented in SimpleLog, and Jdk14Logger.

◆ trace() [2/2]

void trace ( Object  message,
Throwable  t 
)

Log an error with trace log level.

Parameters
messagelog this message
tlog this cause

Implemented in SimpleLog, and Jdk14Logger.

◆ debug() [1/2]

void debug ( Object  message)

Log a message with debug log level.

Parameters
messagelog this message

Implemented in SimpleLog, and Jdk14Logger.

◆ debug() [2/2]

void debug ( Object  message,
Throwable  t 
)

Log an error with debug log level.

Parameters
messagelog this message
tlog this cause

Implemented in SimpleLog, and Jdk14Logger.

◆ info() [1/2]

void info ( Object  message)

Log a message with info log level.

Parameters
messagelog this message

Implemented in SimpleLog, and Jdk14Logger.

◆ info() [2/2]

void info ( Object  message,
Throwable  t 
)

Log an error with info log level.

Parameters
messagelog this message
tlog this cause

Implemented in SimpleLog, and Jdk14Logger.

◆ warn() [1/2]

void warn ( Object  message)

Log a message with warn log level.

Parameters
messagelog this message

Implemented in SimpleLog, and Jdk14Logger.

◆ warn() [2/2]

void warn ( Object  message,
Throwable  t 
)

Log an error with warn log level.

Parameters
messagelog this message
tlog this cause

Implemented in SimpleLog, and Jdk14Logger.

◆ error() [1/2]

void error ( Object  message)

Log a message with error log level.

Parameters
messagelog this message

Implemented in SimpleLog, and Jdk14Logger.

◆ error() [2/2]

void error ( Object  message,
Throwable  t 
)

Log an error with error log level.

Parameters
messagelog this message
tlog this cause

Implemented in SimpleLog, and Jdk14Logger.

◆ fatal() [1/2]

void fatal ( Object  message)

Log a message with fatal log level.

Parameters
messagelog this message

Implemented in SimpleLog, and Jdk14Logger.

◆ fatal() [2/2]

void fatal ( Object  message,
Throwable  t 
)

Log an error with fatal log level.

Parameters
messagelog this message
tlog this cause

Implemented in SimpleLog, and Jdk14Logger.