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

Constructors
Constructor
Description
`Logging()`
Constructs a log factory, getting the base logging directory from the helma.logdir system property.

## Method Summary

Modifier and Type
Method
Description
`static void`
`ensureRunning()`
Make sure logger thread is active.
`Object`
`getAttribute(String name)`
`String[]`
`getAttributeNames()`
`static Logger`
`getConsoleLog()`
Get a logger to System.out.
`Logger`
`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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Logging

public Logging()
Constructs a log factory, getting the base logging directory from the helma.logdir system property.

## Method Details

### getInstance

public org.apache.commons.logging.Log getInstance(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 class `org.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(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(Class clazz)

Specified by:
  `getInstance` in class `org.apache.commons.logging.LogFactory`

### setAttribute

public void setAttribute(String name, Object value)

Specified by:
  `setAttribute` in class `org.apache.commons.logging.LogFactory`

### getAttribute

public Object getAttribute(String name)

Specified by:
  `getAttribute` in class `org.apache.commons.logging.LogFactory`

### getAttributeNames

public String[] getAttributeNames()

Specified by:
  `getAttributeNames` in class `org.apache.commons.logging.LogFactory`

### removeAttribute

public void removeAttribute(String parm1)

Specified by:
  `removeAttribute` in class `org.apache.commons.logging.LogFactory`

### release

public void release()
Flush all logs and shut down.

Specified by:
  `release` in class `org.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.