org.apache.cocoon.util.log
Class CocoonTargetFactory

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.avalon.excalibur.logger.factory.AbstractTargetFactory
          extended by org.apache.avalon.excalibur.logger.factory.FileTargetFactory
              extended by org.apache.cocoon.util.log.CocoonTargetFactory
All Implemented Interfaces:
LogTargetFactory, Configurable, Contextualizable, LogEnabled

Deprecated. This class will be removed in 2.2

public class CocoonTargetFactory
extends FileTargetFactory

CocoonTargetFactory class. This factory is able to create different LogTargets specific to Cocoon according to the following configuration syntax:

 <file id="foo">
  <filename>${context-key}/real-name/...</filename>
  <format type="raw|pattern|extended|xml|cocoon">pattern to be used if needed</format>
  <append>true|false</append>
  <rotation type="revolving|unique" init="5" max="10">
   <or>
    <size>10000000</size>
    <time>24:00:00</time>
    <time>12:00:00</time>
   </or>
  </rotate>
 </file>
 

Some explanations about the Elements used in the configuration:

<filename>
This denotes the name of the file to log to. It can be constructed out of entries in the passed Context object as ${context-key}. This element is required.
<format>
The type attribute of the pattern element denotes the type of Formatter to be used and according to it the pattern to use for. This elements defaults to:

%7.7{priority} %{time} [%8.8{category}] (%{uri}) %{thread}/%{class:short}: %{message}\\n%{throwable}

<append>
If the log file should be deleted every time the logger is creates (normally at the start of the applcation) or not and thus the log entries will be appended. This elements defaults to false.
<rotation>
This is an optional element. The type attribute determines which FileStrategy to user (revolving=RevolvingFileStrategy, unique=UniqueFileStrategy). The required init and max attribute are used to determine the initial and maximum rotation to use on a type="revolving" attribute.
<or>
uses the OrRotateStrategy to combine the children
<size>
The number of bytes if no suffix used or kilo bytes (1024) if suffixed with 'k' or mega bytes (1024k) if suffixed with 'm' when a file rotation should occur. It doesn't make sense to specify more than one.
<time>
The time as HH:MM:SS when a rotation should occur. If you like to rotate a logfile more than once a day put an <or> element immediately after the <rotation> element and specify the times (and one size, too) inside the <or> element.

Version:
CVS $Id: CocoonTargetFactory.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Giacomo Pati

Field Summary
 
Fields inherited from class org.apache.avalon.excalibur.logger.factory.AbstractTargetFactory
m_configuration, m_context
 
Constructor Summary
CocoonTargetFactory()
          Deprecated.  
 
Method Summary
protected  Formatter getFormatter(Configuration conf)
          Deprecated.  
 
Methods inherited from class org.apache.avalon.excalibur.logger.factory.FileTargetFactory
createTarget, createTarget, getFilename, getFileStrategy, getRotateStrategy
 
Methods inherited from class org.apache.avalon.excalibur.logger.factory.AbstractTargetFactory
configure, contextualize
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CocoonTargetFactory

public CocoonTargetFactory()
Deprecated. 
Method Detail

getFormatter

protected Formatter getFormatter(Configuration conf)
Deprecated. 
Overrides:
getFormatter in class FileTargetFactory


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.