com.atlassian.confluence.logging
Class ConfluenceHomeLogAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by org.apache.log4j.WriterAppender
          extended by com.atlassian.confluence.logging.ConfluenceHomeLogAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class ConfluenceHomeLogAppender
extends org.apache.log4j.WriterAppender

A Log4J appender which is aware of when the confluence.home property is set and will switch logging from the console to within the confluence.home directory.

All the console logging will be buffered so that once the switch to logging in the confluence.home is made, all existing logs can be written to this favoured location.

This appender accepts a subset of the RollingFileAppender's configuration, although while it is delegating to the ConsoleAppender it will only use the layout settings.


Field Summary
 
Fields inherited from class org.apache.log4j.WriterAppender
encoding, immediateFlush, qw
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
ConfluenceHomeLogAppender()
          Creates the delegate Appenders although they are not ready for use until activateOptions() is called.
 
Method Summary
 void activateOptions()
          Activate the default Appender (ConsoleAppender).
 void append(org.apache.log4j.spi.LoggingEvent event)
          Append to the current delegate Appender.
 void close()
           
 org.apache.log4j.Layout getLayout()
           
 java.lang.String getLogFileName()
           
 int getMaxBackupIndex()
           
 long getMaximumFileSize()
           
 void setLayout(org.apache.log4j.Layout layout)
           
 void setLogFileName(java.lang.String file)
           
 void setMaxBackupIndex(int maxBackups)
           
 void setMaxFileSize(java.lang.String value)
           
 
Methods inherited from class org.apache.log4j.WriterAppender
checkEntryConditions, closeWriter, createWriter, getEncoding, getImmediateFlush, requiresLayout, reset, setEncoding, setErrorHandler, setImmediateFlush, setWriter, subAppend, writeFooter, writeHeader
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getName, getThreshold, isAsSevereAsThreshold, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfluenceHomeLogAppender

public ConfluenceHomeLogAppender()
Creates the delegate Appenders although they are not ready for use until activateOptions() is called.

Method Detail

setMaxFileSize

public void setMaxFileSize(java.lang.String value)

getMaximumFileSize

public long getMaximumFileSize()

setMaxBackupIndex

public void setMaxBackupIndex(int maxBackups)

getMaxBackupIndex

public int getMaxBackupIndex()

activateOptions

public void activateOptions()
Activate the default Appender (ConsoleAppender). The other appender will be activated once it's configuration is known which is in response to the appropriate event.

Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler
Overrides:
activateOptions in class org.apache.log4j.WriterAppender
See Also:
switchAppender()

getLayout

public org.apache.log4j.Layout getLayout()
Specified by:
getLayout in interface org.apache.log4j.Appender
Overrides:
getLayout in class org.apache.log4j.AppenderSkeleton

setLayout

public void setLayout(org.apache.log4j.Layout layout)
Specified by:
setLayout in interface org.apache.log4j.Appender
Overrides:
setLayout in class org.apache.log4j.AppenderSkeleton

setLogFileName

public void setLogFileName(java.lang.String file)
Parameters:
file - just the log file name (not the full path)

getLogFileName

public java.lang.String getLogFileName()

append

public void append(org.apache.log4j.spi.LoggingEvent event)
Append to the current delegate Appender. If this is the ConsoleAppender then also buffer the event for writing when the RollingAppender is delegated to.

Overrides:
append in class org.apache.log4j.WriterAppender
Parameters:
event - the information to log.

close

public void close()
Specified by:
close in interface org.apache.log4j.Appender
Overrides:
close in class org.apache.log4j.WriterAppender


Copyright © 2003-2014 Atlassian. All Rights Reserved.