public class FileSizeRotatePolicy extends java.lang.Object implements RotatePolicy
プロパティファイルの記述ルールを下記に示す。
ローテーション後のログファイル名は、 <ログファイルパス>.yyyyMMddHHmmssSSS.old となる。 yyyyMMddHHmmssSSSはローテーション実施時刻。
| Constructor and Description |
|---|
FileSizeRotatePolicy() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
decideRotatedFilePath()
ローテーション先のファイル名を決定する。
|
java.lang.String |
getSettings()
ログファイル読み込み時に出力する、ローテーションの設定情報を返す。
|
void |
initialize(ObjectSettings settings)
初期処理を行う。
|
boolean |
needsRotate(java.lang.String message,
java.nio.charset.Charset charset)
ローテーションが必要かの判定を行う。
|
void |
onOpenFile(java.io.File file)
ログファイル読み込み時に発生するイベント。
ファイルサイズによるローテーションなどを独自で実装したい場合に使用する。 |
void |
onWrite(java.lang.String message,
java.nio.charset.Charset charset)
ログファイル書き込み時に発生するイベント。
ファイルサイズによるローテーションなどを独自で実装したい場合に使用する。 |
void |
rotate(java.lang.String rotatedFilePath)
ローテーションを行う。
|
public void initialize(ObjectSettings settings)
initialize in interface RotatePolicysettings - LogWriterの設定public void rotate(java.lang.String rotatedFilePath)
rotate in interface RotatePolicyrotatedFilePath - ローテーション先のファイルパスjava.lang.IllegalStateException - ログファイルのリネームができない場合public boolean needsRotate(java.lang.String message,
java.nio.charset.Charset charset)
needsRotate in interface RotatePolicymessage - ログファイルに書き込まれるメッセージcharset - 書き込み時に使用する文字エンコーディングpublic java.lang.String decideRotatedFilePath()
decideRotatedFilePath in interface RotatePolicypublic void onOpenFile(java.io.File file)
onOpenFile in interface RotatePolicyfile - 読み込まれたファイルpublic void onWrite(java.lang.String message,
java.nio.charset.Charset charset)
onWrite in interface RotatePolicymessage - ログファイルに書き込まれるメッセージcharset - 書き込み時に使用する文字エンコーディングpublic java.lang.String getSettings()
FILE AUTO CHANGE = [<ログファイルを自動で切り替えるか否か。>]
MAX FILE SIZE = [<書き込み先ファイルの最大サイズ>]
CURRENT FILE SIZE = [<書き込み先ファイルの現在のサイズ>]
getSettings in interface RotatePolicyFileLogWriter.getSettings()