Class PatternProcessor
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.PatternProcessor
Parses the rollover pattern.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPatternProcessor
(String pattern) Constructor.PatternProcessor
(String pattern, PatternProcessor copy) Copy constructor with another pattern as source. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
formatFileName
(StringBuilder buf, boolean useCurrentTime, Object obj) Format file name.protected final void
formatFileName
(StringBuilder buf, Object... objects) Formats file name.final void
formatFileName
(StrSubstitutor subst, StringBuilder buf, boolean useCurrentTime, Object obj) Formats file name.final void
formatFileName
(StrSubstitutor subst, StringBuilder buf, Object obj) Formats file name.long
long
long
getNextTime
(long currentMillis, int increment, boolean modulus) Returns the next potential rollover time.long
void
setCurrentFileTime
(long currentFileTime) void
setPrevFileTime
(long prevFileTime) void
setTimeBased
(boolean isTimeBased) toString()
void
-
Field Details
-
LOGGER
-
-
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
-
getPatternFields
-
getPatternConverters
-
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() -
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.
-
getFrequency
-
getNextFileTime
public long getNextFileTime()
-