org.apache.log4j
クラス DailyRollingFileAppender
java.lang.Object
|
+--org.apache.log4j.AppenderSkeleton
|
+--org.apache.log4j.WriterAppender
|
+--org.apache.log4j.FileAppender
|
+--org.apache.log4j.DailyRollingFileAppender
- すべての実装インタフェース:
- Appender, OptionHandler
- public class DailyRollingFileAppender
- extends FileAppender
DailyRollingFileAppender extends FileAppender so that the
underlying file is rolled over at a user chosen frequency.
DailyRollingFileAppender は、FileAppenderを拡張し、その作成されたファイルは、ユーザが選択した通りに切り替わります。
The rolling schedule is specified by the DatePattern
option. This pattern should follow the SimpleDateFormat
conventions. In particular, you must escape literal text
within a pair of single quotes. A formatted version of the date
pattern is used as the suffix for the rolled file name.
切り替えスケジュールは、DatePatternオプションにより指定されます。
このパターンは、SimpleDateFormat の規定に従います。
特別な規定として、あなたは、シングルクォーテーションで囲まれた文字テキストでエスケープする必要があります。
フォーマットされた日付のバージョンは、切り替えるファイル名のサフィックスとして使われます。
For example, if the File option is set to
/foo/bar.log and the DatePattern set to
'.'yyyy-MM-dd, on 2001-02-16 at midnight, the logging
file /foo/bar.log will be copied to
/foo/bar.log.2001-02-16 and logging for 2001-02-17
will continue in /foo/bar.log until it rolls over
the next day.
例えば、もし、Fileオプションが /foo/bar に設定され、DatePattern が '.'yyyy-MM-dd に設定されている場合、2001-02-16の深夜に、ロギングファイル /foo/bar.log は、/foo/bar.log.2001-02-16にコピーされ、2001-02-17用のロギングファイルは、 その翌日になるまで、/foo/bar.logに引き継がれます。
Is is possible to specify monthly, weekly, half-daily, daily,
hourly, or minutely rollover schedules.
月単位、週単位、半日単位、1日単位、時間単位、分単位の切り替えスケジュールを指定することができます。
| DatePattern |
Rollover schedule |
Example |
'.'yyyy-MM
| Rollover at the beginning of each month |
Assuming the first day of the week is Sunday, at Sunday 00:00,
March 25th, 2001, /foo/bar.log will be copied to
/foo/bar.log.2001-03. Logging for the month of April
will be output to /foo/bar.log until it rolls over
at the beginning of May. |
|
'.'yyyy-ww
| Rollover at the first day of each week. The first day of the
week depends on the locale. |
At midnight, on March 31st, 2001, /foo/bar.log
will be copied to /foo/bar.log.2001-08. Logging for
the 9th week of 2001 will be output to /foo/bar.log
until it is rolled over the next week. |
'.'yyyy-MM-dd
| Rollover at midnight each day. |
At midnight, on March 9th, 2001, /foo/bar.log will
be copied to /foo/bar.log.2001-03-08. Logging for the
9th day of March will be output to /foo/bar.log until
it is rolled over the next day. |
'.'yyyy-MM-dd-a
| Rollover at midnight and midday of each day. |
At noon, on March 9th, 2001, /foo/bar.log will be
copied to /foo/bar.log.2001-03-09-AM. Logging for the
afternoon of the 9th will be output to /foo/bar.log
until it is rolled over the next morning, i.e at midnight 00:00. |
'.'yyyy-MM-dd-HH
| Rollover at the top of every hour. |
At approximately 11:00,000, on March 9th, 2001,
/foo/bar.log will be copied to
/foo/bar.log.2001-03-09-10. Logging for the 11th hour
of the 9th of March will be output to /foo/bar.log
until it is rolled over at the beginning of the next hour. |
'.'yyyy-MM-dd-HH-mm
| Rollover at the beginning of every minute. |
At approximately 11:23,000, on March 9th, 2001,
/foo/bar.log will be copied to
/foo/bar.log.2001-03-09-10-22. Logging for the minute
of 11:23 (9th of March) will be output to
/foo/bar.log until it is rolled over the next minute. |
| 日付パターン |
切り替えスケジュール |
例 |
'.'yyyy-MM
| 各月の始めで切り替わります。 |
週の最初は、日曜日として、2001年3月25日の日曜日の00:00では、/foo/bar.log は、/foo/bar.log.2001-03にコピーされます。
4月の月単位でのロギングは、5月の最初の日が来るまで、/foo/bar.logに出力されます。 |
'.'yyyy-ww
| 各週の最初の日で切り替わります。
週の最初の日は、ロケールにより異なります。 |
2001年3月31日の深夜に、/foo/bar.logは、/foo/bar.log.2001-08へコピーされます。
2001年の9週目のロギングは、次の週に変わるまで/foo/bar.logに出力されます。 |
'.'yyyy-MM-dd
| 各日の真夜中に切り替わります。 |
2001年3月9日の深夜では、/foo/bar.logは、/foo/bar.log.2001-03-08へコピーされます。
3月9日のログファイルは、翌日になるまで/foo/bar.logへ出力されます。 |
'.'yyyy-MM-dd-a
| 各日の真夜中と正午に切り替わります。 |
2001年3月9日の正午に、/foo/bar.logは、/foo/bar.log.2001-03-09-AMへコピーされます。
9日の午後のロギングは、翌日の朝つまり真夜中00:00 まで/foo/bar.logに出力されます。 |
'.'yyyy-MM-dd-HH
| 1時間毎の最初で切り替わります。 |
2001年3月9日の大体11:00,000頃、/foo/bar.logは、/foo/bar.log.2001-03-09-10へコピーされます。
3月9日の11時のロギングは、次の1時間の始めになるまで/foo/bar.logに出力されます。 |
'.'yyyy-MM-dd-HH-mm |
分毎の最初で切り替わります。 |
2001年3月9日の大体11:23,000頃、/foo/bar.logは、/foo/bar.log.2001-03-09-10-22へコピーされます。
11:23(3月9日)の分単位のロギングは、次の分がくるまで、/foo/bar.logに出力されます。 |
Do not use the colon ":" character in anywhere in the
DatePattern option. The text before the colon is interpeted
as the protocol specificaion of a URL which is probably not what
you want.
DatePatternオプションでコロン ":" 文字は、どこにも使わないで下さい。
コロンの前のテキストがあなたが多分期待していないURLのプロトコル規定と解釈されます。
- 作成者:
- Eirik Lygre, Ceki Gülcü
|
フィールドの概要 |
static String |
DATE_PATTERN_OPTION
推奨されていません。 Options are now handled using the JavaBeans paradigm.
This constant is not longer needed and will be removed in the
near term.
今日、オプションは、JavaBeansパラダイムを使って処理されています。
今後、このオプションは、必要なくなるので、ちかいうちに削除される予定です。
|
| クラス 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 |
DATE_PATTERN_OPTION
public static final String DATE_PATTERN_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
filename pattern. Current value of this string constant is
DatePattern.
ファイル名のパターンを設定するためのオプションを指定するときに使用される文字列定数です。
この文字列定数の現在の値は、DatePatternです。
DailyRollingFileAppender
public DailyRollingFileAppender()
- The default constructor does nothing.
デフォルトのコンストラクタは何もしません。
DailyRollingFileAppender
public DailyRollingFileAppender(Layout layout,
String filename,
String datePattern)
throws IOException
- Instantiate a
DailyRollingFileAppender and open the
file designated by filename. The opened filename will
become the ouput destination for this appender.
DailyRollingFileAppenderをインスタンス化し、ファイル名で名づけられたファイルをオープンします。
オープンされたファイルは、このアペンダのための出力先になります。
setDatePattern
public void setDatePattern(String pattern)
- The DatePattern takes a string in the same format as
expected by
SimpleDateFormat. This options determines the
rollover schedule.
DatePatternは、SimpleDateFormatで求められる同じフォーマット内の文字列を取ります。
このオプションは、切り替えスケジュールを決定づけます。
getDatePattern
public String getDatePattern()
- Returns the value of the DatePattern option.
getOptionStrings
public String[] getOptionStrings()
- 推奨されていません。 We now use JavaBeans introspection to configure
components. Options strings are no longer needed.
私たちは、今日、コンポーネントの設定には、JavaBeansのイントロスペクションを利用しています。今後オプション文字列は、必要ななくなります。
- Returns the option names for this component, namely
DATE_PATTERN_OPTION in
addition to the options of FileAppender.
このコンポーネントのオプション名を返します。
名前としては、FileAppender のオプションへ追加する DATE_PATTERN_OPTION があります。
- オーバーライド:
- クラス
FileAppender 内の getOptionStrings
setOption
public void setOption(String key,
String value)
- 推奨されていません。 Use the setter method for the option directly instead
of the generic
setOption method.
汎用的な、setOptionメソッドの代わりに直接オプションを扱う、セッタメソッドを使います。
- Set the options for the
DailyRollingFileAppender
instance.
DailyRollingFileAppenderのインスタンスに関するオプションを設定します。
The DatePattern takes a string in the same format as
expected by SimpleDateFormat. This options determines the
rollover schedule.
DatePatternは、SimpleDateFormatで求められる同じフォーマットの文字列を取ります。
このオプションは、切り替えスケジュールを決定づけます。
Be sure to refer to the options in the super classes FileAppender, WriterAppender and in particular the
Threshold option in AppenderSkeleton.
親クラス FileAppenderとWriterAppender 内のオプションを参照することに気を付けてください。特別なものしては、AppenderSkeleton内のオプションがあります。
- オーバーライド:
- クラス
FileAppender 内の setOption
activateOptions
public void activateOptions()
- クラス
FileAppender の記述:
- If the value of
FileAppender.FILE_OPTION is not null, then FileAppender.setFile(java.lang.String) is called with the values of FileAppender.FILE_OPTION and
FileAppender.APPEND_OPTION.
もし、FileAppender.FILE_OPTIONの値が、nullでない場合、その時、FileAppender.setFile(java.lang.String) は、FileAppender.FILE_OPTION と FileAppender.APPEND_OPTION を使って値が呼び出されます。
- オーバーライド:
- クラス
FileAppender 内の activateOptions
subAppend
protected void subAppend(LoggingEvent event)
- This method differentiates DailyRollingFileAppender from its
super class.
このメソッドは、その親クラスとDailyRollingFileAppender を区別します。
- オーバーライド:
- クラス
WriterAppender 内の subAppend
Please notify me about new log4j releases.