Package helma.util
Class Logging
java.lang.Object
org.apache.commons.logging.LogFactory
helma.util.Logging
public class Logging
extends org.apache.commons.logging.LogFactory
Implementation of Jakarta Commons LogFactory that supports both
simple console logging and logging to files that are rotated and
gzipped each night.
-
Field Summary
Fields inherited from class org.apache.commons.logging.LogFactory
DIAGNOSTICS_DEST_PROPERTY, factories, FACTORY_DEFAULT, FACTORY_PROPERTIES, FACTORY_PROPERTY, HASHTABLE_IMPLEMENTATION_PROPERTY, nullClassLoaderFactory, PRIORITY_KEY, SERVICE_ID, TCCL_KEY
-
Constructor Summary
ConstructorsConstructorDescriptionLogging()
Constructs a log factory, getting the base logging directory from the helma.logdir system property. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Make sure logger thread is active.getAttribute
(String name) String[]
static Logger
Get a logger to System.out.getFileLog
(String logname) Get a file logger, creating it if it doesn't exist yet.org.apache.commons.logging.Log
getInstance
(Class clazz) org.apache.commons.logging.Log
getInstance
(String logname) Get a logger for a file name.void
release()
Flush all logs and shut down.void
removeAttribute
(String parm1) void
setAttribute
(String name, Object value) static void
shutdown()
Shut down logging, stopping the logger thread and closing all logs.Methods inherited from class org.apache.commons.logging.LogFactory
createFactory, directGetContextClassLoader, getClassLoader, getContextClassLoader, getFactory, getLog, getLog, handleThrowable, isDiagnosticsEnabled, logRawDiagnostic, newFactory, newFactory, objectId, release, releaseAll
-
Constructor Details
-
Logging
public Logging()Constructs a log factory, getting the base logging directory from the helma.logdir system property.
-
-
Method Details
-
getInstance
Get a logger for a file name. The log file is created in the directory specified by the "log.dir" System property. If the logname is "console" a log that writes to System.out is returned.- Specified by:
getInstance
in classorg.apache.commons.logging.LogFactory
-
getConsoleLog
Get a logger to System.out.- Returns:
- a logger that writes to System.out
-
getFileLog
Get a file logger, creating it if it doesn't exist yet.- Parameters:
logname
- the base name for the file logger- Returns:
- a file logger
-
getInstance
- Specified by:
getInstance
in classorg.apache.commons.logging.LogFactory
-
setAttribute
- Specified by:
setAttribute
in classorg.apache.commons.logging.LogFactory
-
getAttribute
- Specified by:
getAttribute
in classorg.apache.commons.logging.LogFactory
-
getAttributeNames
- Specified by:
getAttributeNames
in classorg.apache.commons.logging.LogFactory
-
removeAttribute
- Specified by:
removeAttribute
in classorg.apache.commons.logging.LogFactory
-
release
public void release()Flush all logs and shut down.- Specified by:
release
in classorg.apache.commons.logging.LogFactory
-
ensureRunning
public static void ensureRunning()Make sure logger thread is active. -
shutdown
public static void shutdown()Shut down logging, stopping the logger thread and closing all logs.
-