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.
-
-
Constructor Summary
Constructors Constructor Description Logging()
Constructs a log factory, getting the base logging directory from the helma.logdir system property.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
ensureRunning()
Make sure logger thread is active.java.lang.Object
getAttribute(java.lang.String name)
java.lang.String[]
getAttributeNames()
static Logger
getConsoleLog()
Get a logger to System.out.Logger
getFileLog(java.lang.String logname)
Get a file logger, creating it if it doesn't exist yet.org.apache.commons.logging.Log
getInstance(java.lang.Class clazz)
org.apache.commons.logging.Log
getInstance(java.lang.String logname)
Get a logger for a file name.void
release()
Flush all logs and shut down.void
removeAttribute(java.lang.String parm1)
void
setAttribute(java.lang.String name, java.lang.Object value)
static void
shutdown()
Shut down logging, stopping the logger thread and closing all logs.
-
-
-
Method Detail
-
getInstance
public org.apache.commons.logging.Log getInstance(java.lang.String logname)
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
public static Logger getConsoleLog()
Get a logger to System.out.- Returns:
- a logger that writes to System.out
-
getFileLog
public Logger getFileLog(java.lang.String logname)
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
public org.apache.commons.logging.Log getInstance(java.lang.Class clazz)
- Specified by:
getInstance
in classorg.apache.commons.logging.LogFactory
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)
- Specified by:
setAttribute
in classorg.apache.commons.logging.LogFactory
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
- Specified by:
getAttribute
in classorg.apache.commons.logging.LogFactory
-
getAttributeNames
public java.lang.String[] getAttributeNames()
- Specified by:
getAttributeNames
in classorg.apache.commons.logging.LogFactory
-
removeAttribute
public void removeAttribute(java.lang.String parm1)
- 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.
-
-