org.apache.log4j
クラス RollingFileAppender

java.lang.Object
  |
  +--org.apache.log4j.AppenderSkeleton
        |
        +--org.apache.log4j.WriterAppender
              |
              +--org.apache.log4j.FileAppender
                    |
                    +--org.apache.log4j.RollingFileAppender
すべての実装インタフェース:
Appender, OptionHandler
直系の既知のサブクラス:
ExternallyRolledFileAppender

public class RollingFileAppender
extends FileAppender

RollingFileAppender extends FileAppender to backup the log files when they reach a certain size.

RollingFileAppenderは、ファイルがあるサイズに到達した時、ログファイルのバックアップを取るようにFileAppenderを拡張しています。

作成者:
Heinz Richter, Ceki Gülcü

フィールドの概要
static String MAX_BACKUP_INDEX_OPTION
          推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使い処理されています。 この定数は、今後必要なくなり、近いうちに削除される予定です。

static String MAX_FILE_SIZE_OPTION
          推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使い処理されています。 この定数は、今後必要なくなり、近いうちに削除される予定です。

protected  int maxBackupIndex
          There is one backup file by default.
protected  long maxFileSize
          The default maximum file size is 10MB.
 
クラス org.apache.log4j.FileAppender から継承したフィールド
APPEND_OPTION, FILE_OPTION, fileAppend, fileName, qwIsOurs
 
クラス org.apache.log4j.WriterAppender から継承したフィールド
IMMEDIATE_FLUSH_OPTION, immediateFlush, qw
 
クラス org.apache.log4j.AppenderSkeleton から継承したフィールド
closed, errorHandler, headFilter, layout, name, tailFilter, threshold, THRESHOLD_OPTION
 
コンストラクタの概要
RollingFileAppender()
          The default constructor simply calls its parents constructor.
RollingFileAppender(Layout layout, String filename)
          Instantiate a FileAppender and open the file designated by filename.
RollingFileAppender(Layout layout, String filename, boolean append)
          Instantiate a RollingFileAppender and open the file designated by filename.
 
メソッドの概要
 int getMaxBackupIndex()
          Returns the value of the MaxBackupIndex option.
 long getMaximumFileSize()
          Get the maximum size that the output file is allowed to reach before being rolled over to backup files.
 String[] getOptionStrings()
          推奨されていません。 We now use JavaBeans introspection to configure components. Options strings are no longer needed.

今日、私たちは、コンポーネントの設定でJavaBeansのイントロスペクションを 使っています。 オプション文字列は、今後必要なくなります。

 void rollOver()
          Implements the usual roll over behaviour.
 void setFile(String fileName, boolean append)
          Sets and opens the file where the log output will go.
 void setMaxBackupIndex(int maxBackups)
          Set the maximum number of backup files to keep around.
 void setMaxFileSize(long maxFileSize)
          推奨されていません。 Use setMaximumFileSize(long) instead.

代わりに、setMaximumFileSize(long)を使用してください。

 void setMaxFileSize(String value)
          Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
 void setMaximumFileSize(long maxFileSize)
          Set the maximum size that the output file is allowed to reach before being rolled over to backup files.
 void setOption(String key, String value)
          Set option to value.
protected  void setQWForFiles(Writer writer)
          Sets the quiet writer being used.
protected  void subAppend(LoggingEvent event)
          This method differentiates RollingFileAppender from its super class.
 
クラス org.apache.log4j.FileAppender から継承したメソッド
activateOptions, closeFile, getAppend, getFile, reset, setAppend, setFile
 
クラス org.apache.log4j.WriterAppender から継承したメソッド
append, checkEntryConditions, close, closeWriter, getImmediateFlush, requiresLayout, setErrorHandler, setImmediateFlush, setWriter, writeFooter, writeHeader
 
クラス org.apache.log4j.AppenderSkeleton から継承したメソッド
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setLayout, setName, setThreshold
 
クラス java.lang.Object から継承したメソッド
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

MAX_FILE_SIZE_OPTION

public static final String MAX_FILE_SIZE_OPTION
推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使い処理されています。 この定数は、今後必要なくなり、近いうちに削除される予定です。

A string constant used in naming the option for setting the maximum size of the log file. Current value of this string constant is MaxFileSize.

ログファイルの最大サイズを設定するというオプションを指定する時に使う文字列定数です。 この文字列定数の現状の値は、MaxFileSizeです。


MAX_BACKUP_INDEX_OPTION

public static final String MAX_BACKUP_INDEX_OPTION
推奨されていません。 Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

今日、オプションは、JavaBeansのパラダイムを使い処理されています。 この定数は、今後必要なくなり、近いうちに削除される予定です。

A string constant used in naming the option for setting the the number of backup files to retain. Current value of this string constant is MaxBackupIndex.

保持するバックアップフィルの数を設定するというオプションに指定する時使う文字列定数です。 この文字列定数の現状の値は、MaxBackupIndexです。


maxFileSize

protected long maxFileSize
The default maximum file size is 10MB.

デフォルトの最大ファイルサイズは、10メガバイトです。


maxBackupIndex

protected int maxBackupIndex
There is one backup file by default.

デフォルトで、一つのバックアップファイルがあります。

コンストラクタの詳細

RollingFileAppender

public RollingFileAppender()
The default constructor simply calls its parents constructor.

デフォルトのコンストラクタは、 親のコンストラクタを呼び出します。


RollingFileAppender

public RollingFileAppender(Layout layout,
                           String filename,
                           boolean append)
                    throws IOException
Instantiate a RollingFileAppender and open the file designated by filename. The opened filename will become the ouput destination for this appender.

RollingFileAppenderのインスタンスを生成し、filenameで 指定されたファイルをオープンします。 オープンされたファイル名は、このアペンダの出力先となります。

If the append parameter is true, the file will be appended to. Otherwise, the file desginated by filename will be truncated before being opened.

もし、appendパラメタが true の場合は、ファイルが指定されたファイルに 追加されます。そうでない場合は、filenameで指定されたファイルは、 オープンされているファイルの最初から追加されます。


RollingFileAppender

public RollingFileAppender(Layout layout,
                           String filename)
                    throws IOException
Instantiate a FileAppender and open the file designated by filename. The opened filename will become the output destination for this appender.

FileAppenderのインスタンスを生成し、filenameで指定されたファイルをオープンします。 そのオープンされたファイル名が、このアペンダの出力先となります。

The file will be appended to.

ファイルは、追加されます。

メソッドの詳細

getMaxBackupIndex

public int getMaxBackupIndex()
Returns the value of the MaxBackupIndex option.

MaxBackupIndexオプションの値を返します。


getMaximumFileSize

public long getMaximumFileSize()
Get the maximum size that the output file is allowed to reach before being rolled over to backup files.

出力先のファイルがバックアップファイルに切り替わる前に到達することができる 最大サイズを取得します。

導入されたバージョン:
1.1

getOptionStrings

public String[] getOptionStrings()
推奨されていません。 We now use JavaBeans introspection to configure components. Options strings are no longer needed.

今日、私たちは、コンポーネントの設定でJavaBeansのイントロスペクションを 使っています。 オプション文字列は、今後必要なくなります。

Retuns the option names for this component, namely MAX_FILE_SIZE_OPTION and MAX_BACKUP_INDEX_OPTION in addition to the options of FileAppender.getOptionStrings()

このコンポーネントのオプション名を返します。 名前としては、MAX_FILE_SIZE_OPTIONFileAppender.getOptionStrings()のオプションに追加する MAX_BACKUP_INDEX_OPTIONがあります。

オーバーライド:
クラス FileAppender 内の getOptionStrings

rollOver

public void rollOver()
Implements the usual roll over behaviour.

普段の切り替わりの振る舞いを実装します。

If MaxBackupIndex is positive, then files {File.1, ..., File.MaxBackupIndex -1} are renamed to {File.2, ..., File.MaxBackupIndex}. Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.

もし、maxBackupIndexが、有効である場合、ファイル {File.1, ..., File.MaxBackupIndex -1} は、{File.2, ..., File.MaxBackupIndex}に リネームされます。 その上、Fileは、File.1へリネームされ、 クローズされます。新しい Fileは、さらにログ出力を受け取る ために作成されます。

If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.

もし、MaxBackupIndexが0と同等の場合、File は、バックアップファイルは作成されず、そこで切られてしまいます。


setFile

public void setFile(String fileName,
                    boolean append)
             throws IOException
クラス FileAppender の記述:

Sets and opens the file where the log output will go. The specified file must be writable.

ログ出力を行うファイルを設定し、オープンします。 指定したファイルは、書き込み可能である必要があります。

If there was already an opened file, then the previous file is closed first.

もし、すでにオープンされたファイルがあれば、先にオープンされたファイルが最初にクローズされます。

オーバーライド:
クラス FileAppender 内の setFile
クラス org.apache.log4j.FileAppender からコピーされたタグ:
パラメータ:
fileName - The path to the log file.

fileName ログファイルへのパス

append - If true will append to fileName. Otherwise will truncate fileName.

append trueの場合は、ファイルへ追加されます。 そうでない場合は、fileNameへは、追加されません。


setOption

public void setOption(String key,
                      String value)
推奨されていません。 Use the setter method for the option directly instead of the generic setOption method.

一般的な setOptionメソッドの代わりに、直接オプションのための セッタメソッドを使います。

インタフェース OptionHandler の記述:
Set option to value.

オプション に設定します。

The handling of each option depends on the OptionHandler instance. Some options may become active immediately whereas other may be activated only when OptionHandler.activateOptions() is called.

各オプションの処理は、OptionHandlerのインスタンスに依存します。 いくつかのオプションは、直ぐに有効になりますが、その他は OptionHandler.activateOptions()が呼ばれる時にだけ有効になります。

オーバーライド:
クラス FileAppender 内の setOption

setMaxBackupIndex

public void setMaxBackupIndex(int maxBackups)
Set the maximum number of backup files to keep around.

保持し続けられるバックアップファイルの最大数を設定します。

The MaxBackupIndex option determines how many backup files are kept before the oldest is erased. This option takes a positive integer value. If set to zero, then there will be no backup files and the log file will be truncated when it reaches MaxFileSize.

MaxBackupIndexオプションは、最も古いファイルが消去される前に 保持するバックアップファイルがいくつあるかを決定します。 このオプションは、整数値をとります。もし、0 に設定した場合は、 バックアップファイルはなく、ログファイルは、MaxFileSizeに 到達した時点で、切られてしまいます。


setMaxFileSize

public void setMaxFileSize(long maxFileSize)
推奨されていません。 Use setMaximumFileSize(long) instead.

代わりに、setMaximumFileSize(long)を使用してください。

Set the maximum size that the output file is allowed to reach before being rolled over to backup files.

出力ファイルがバックアップファイルに切り替わる前に到達可能な最大サイズを設定します。


setMaximumFileSize

public void setMaximumFileSize(long maxFileSize)
Set the maximum size that the output file is allowed to reach before being rolled over to backup files.

出力ファイルがバックアップファイルへ切り替わる前に到達可能な最大サイズを設定します。

This method is equivalent to setMaxFileSize(long) except that it is required for differentiating the setter taking a long argument from the setter taking a String argument by the JavaBeans Introspector.

このメソッドは、JavaBeansのIntrospectorにより String引数をとるセッタメソッドとlongをとる セッタメソッドを区別するよう要求されることを除いて setMaxFileSize(long)と同じです。

関連項目:
setMaxFileSize(String)

setMaxFileSize

public void setMaxFileSize(String value)
Set the maximum size that the output file is allowed to reach before being rolled over to backup files.

出力ファイルがバックアップファイルに切り替わる前に到達できる最大のサイズを設定します。

In configuration files, the MaxFileSize option takes an long integer in the range 0 - 2^63. You can specify the value with the suffixes "KB", "MB" or "GB" so that the integer is interpreted being expressed respectively in kilobytes, megabytes or gigabytes. For example, the value "10KB" will be interpreted as 10240.

設定ファイル内で、MaxFileSizeオプションは、0 から 2^63 の範囲の長整数をとります。 あなたは、サフィックス "KB"、"MB"または、"GB"を使って値を指定します。そこで 整数は、それぞれ キロバイト、メガバイト、ギガバイトの表現として解釈されます。 例えば、"10MB"は、10240として解釈されます。


setQWForFiles

protected void setQWForFiles(Writer writer)
クラス FileAppender の記述:
Sets the quiet writer being used.

利用されるquietライタを設定します。

This method is overriden by RollingFileAppender.

このメソッドは、RollingFileAppenderにオーバーライドされます。

オーバーライド:
クラス FileAppender 内の setQWForFiles

subAppend

protected void subAppend(LoggingEvent event)
This method differentiates RollingFileAppender from its super class.

このメソッドは、RollingFileAppenderと親クラスとを区別します。

オーバーライド:
クラス WriterAppender 内の subAppend
導入されたバージョン:
0.9.0


Please notify me about new log4j releases.