org.opencms.main
Class CmsLog

java.lang.Object
  extended by org.opencms.main.CmsLog

public final class CmsLog
extends java.lang.Object

Provides the OpenCms logging mechanism.

The OpenCms logging mechanism is based on Apache Commons Logging. However, log4j is shipped with OpenCms and assumed to be used as default logging mechanism. Since apparently Commons Logging may cause issues in more complex classloader scenarios, we may switch the logging interface to log4j UGLI once the final release is available.

The log4j configuration file shipped with OpenCms is located in ${opencms.WEB-INF}/classes/log4j.properties. OpenCms will auto-configure itself to write it's log file to ${opencms.WEB-INF}/logs/opencms.log. This default behaviour can be supressed by either using a log4j configuration file from another location, or by setting the special property ${opencms.set.logfile} in the log4j configuration file to false.

Since:
6.0.0
Version:
$Revision: 1.30 $
Author:
Alexander Kandzior

Field Summary
static java.lang.String FILE_LOG
          The name of the opencms.log file.
static java.lang.String FOLDER_LOGS
          Path to the "logs" folder relative to the "WEB-INF" directory of the application.
static org.apache.commons.logging.Log INIT
          Log for initialization messages.
 
Method Summary
static org.apache.commons.logging.Log getLog(java.lang.Object obj)
          Returns the log for the selected object.
protected static java.lang.String getLogFileRfsPath()
          Returns the filename of the logfile (in the "real" file system).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_LOG

public static final java.lang.String FILE_LOG
The name of the opencms.log file.

See Also:
Constant Field Values

FOLDER_LOGS

public static final java.lang.String FOLDER_LOGS
Path to the "logs" folder relative to the "WEB-INF" directory of the application.


INIT

public static final org.apache.commons.logging.Log INIT
Log for initialization messages.

Method Detail

getLog

public static org.apache.commons.logging.Log getLog(java.lang.Object obj)
Returns the log for the selected object.

If the provided object is a String, this String will be used as channel name. Otherwise the objects class name will be used as channel name.

Parameters:
obj - the object channel to use
Returns:
the log for the selected object channel

getLogFileRfsPath

protected static java.lang.String getLogFileRfsPath()
Returns the filename of the logfile (in the "real" file system).

If the method returns null, this means that the log file is not managed by OpenCms.

Returns:
the filename of the logfile (in the "real" file system)