Class PatternProcessor
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.PatternProcessor
Parses the rollover pattern.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate static final char[]private final FileExtensionprivate RolloverFrequencyprivate static final char[]private booleanprivate static final Stringprotected static final Loggerprivate static final charprivate static final charprivate static final charprivate longprivate final Stringprivate final ArrayPatternConverter[]private final FormattingInfo[]private longprivate static final charprivate static final char[]private static final char -
Constructor Summary
ConstructorsConstructorDescriptionPatternProcessor(String pattern) Constructor.PatternProcessor(String pattern, PatternProcessor copy) Copy constructor with another pattern as source. -
Method Summary
Modifier and TypeMethodDescriptionprivate RolloverFrequencycalculateFrequency(String pattern) private PatternParserprivate longdebugGetNextTime(long nextTime) private Stringformat(long time) final voidformatFileName(StringBuilder buf, boolean useCurrentTime, Object obj) Format file name.protected final voidformatFileName(StringBuilder buf, Object... objects) Formats file name.final voidformatFileName(StrSubstitutor subst, StringBuilder buf, boolean useCurrentTime, Object obj) Formats file name.final voidformatFileName(StrSubstitutor subst, StringBuilder buf, Object obj) Formats file name.longlonglonggetNextTime(long currentMillis, int increment, boolean modulus) Returns the next potential rollover time.longprivate voidprivate booleanpatternContains(String pattern, char character) private booleanpatternContains(String pattern, char... chars) voidsetCurrentFileTime(long currentFileTime) voidsetPrevFileTime(long prevFileTime) voidsetTimeBased(boolean isTimeBased) toString()void
-
Field Details
-
LOGGER
-
KEY
- See Also:
-
YEAR_CHAR
private static final char YEAR_CHAR- See Also:
-
MONTH_CHAR
private static final char MONTH_CHAR- See Also:
-
WEEK_CHARS
private static final char[] WEEK_CHARS -
DAY_CHARS
private static final char[] DAY_CHARS -
HOUR_CHARS
private static final char[] HOUR_CHARS -
MINUTE_CHAR
private static final char MINUTE_CHAR- See Also:
-
SECOND_CHAR
private static final char SECOND_CHAR- See Also:
-
MILLIS_CHAR
private static final char MILLIS_CHAR- See Also:
-
patternConverters
-
patternFields
-
fileExtension
-
prevFileTime
private long prevFileTime -
nextFileTime
private long nextFileTime -
currentFileTime
private long currentFileTime -
isTimeBased
private boolean isTimeBased -
frequency
-
pattern
-
-
Constructor Details
-
PatternProcessor
Constructor.- Parameters:
pattern- The file pattern.
-
PatternProcessor
Copy constructor with another pattern as source.- Parameters:
pattern- The file pattern.copy- Source pattern processor
-
-
Method Details
-
getPattern
-
toString
-
setTimeBased
public void setTimeBased(boolean isTimeBased) -
getCurrentFileTime
public long getCurrentFileTime() -
setCurrentFileTime
public void setCurrentFileTime(long currentFileTime) -
getPrevFileTime
public long getPrevFileTime() -
setPrevFileTime
public void setPrevFileTime(long prevFileTime) -
getFileExtension
-
getNextTime
public long getNextTime(long currentMillis, int increment, boolean modulus) Returns the next potential rollover time.- Parameters:
currentMillis- The current time.increment- The increment to the next time.modulus- If true the time will be rounded to occur on a boundary aligned with the increment.- Returns:
- the next potential rollover time and the timestamp for the target file.
-
updateTime
public void updateTime() -
debugGetNextTime
private long debugGetNextTime(long nextTime) -
format
-
increment
-
formatFileName
Format file name.- Parameters:
buf- string buffer to which formatted file name is appended, may not be null.obj- object to be evaluated in formatting, may not be null.
-
formatFileName
Formats file name.- Parameters:
subst- The StrSubstitutor.buf- string buffer to which formatted file name is appended, may not be null.obj- object to be evaluated in formatting, may not be null.
-
formatFileName
public final void formatFileName(StrSubstitutor subst, StringBuilder buf, boolean useCurrentTime, Object obj) Formats file name.- Parameters:
subst- The StrSubstitutor.buf- string buffer to which formatted file name is appended, may not be null.obj- object to be evaluated in formatting, may not be null.
-
formatFileName
Formats file name.- Parameters:
buf- string buffer to which formatted file name is appended, may not be null.objects- objects to be evaluated in formatting, may not be null.
-
calculateFrequency
-
createPatternParser
-
patternContains
-
patternContains
-
getFrequency
-
getNextFileTime
public long getNextFileTime()
-