public final class CmsLog extends java.lang.Object
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/log4j2.xml
. 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
.
Modifier and Type | Field and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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 log file (in the "real" file system).
|
static java.lang.String[] |
render(java.lang.Throwable throwable)
Render throwable using Throwable.printStackTrace.
|
public static final java.lang.String FILE_LOG
public static final java.lang.String FOLDER_LOGS
public static org.apache.commons.logging.Log INIT
public static org.apache.commons.logging.Log getLog(java.lang.Object obj)
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.
obj
- the object channel to usepublic static java.lang.String[] render(java.lang.Throwable throwable)
This code copy from "org.apache.log4j.DefaultThrowableRenderer.render(Throwable throwable)"
throwable
- throwable, may not be null.protected static java.lang.String getLogFileRfsPath()
If the method returns null
, this means that the log
file is not managed by OpenCms.