Package helma.util

Class 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

      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.
      • 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 Detail

      • Logging

        public Logging()
        Constructs a log factory, getting the base logging directory from the helma.logdir system property.
    • 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 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​(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 class org.apache.commons.logging.LogFactory
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.Object value)
        Specified by:
        setAttribute in class org.apache.commons.logging.LogFactory
      • getAttribute

        public java.lang.Object getAttribute​(java.lang.String name)
        Specified by:
        getAttribute in class org.apache.commons.logging.LogFactory
      • getAttributeNames

        public java.lang.String[] getAttributeNames()
        Specified by:
        getAttributeNames in class org.apache.commons.logging.LogFactory
      • removeAttribute

        public void removeAttribute​(java.lang.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.