You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b4b4828
Browse filesBrowse the repository at this point in the historyBrowse files
Escape regex metacharacters of literal text in FileNamePattern regexes
FileNamePattern.toRegex() and toRegexForFixedDate() copied the literal
parts of the file name pattern, and the formatted date, into the regex
unchanged. Characters such as '(', '[' or '+' in a directory or file
name were therefore interpreted as regex syntax:
- RollingFileAppender.start() threw a PatternSyntaxException when the
path contained an unbalanced '(', e.g. a Windows user directory such
as "C:/Users/Michael(Financ" (#914).
- With SizeAndTimeBasedRollingPolicy and a pattern such as
"app.%d.(%i).log", the regex did not match existing archives. After a
restart within the same period the counter started again at 0, so the
next size based rollover renamed the active file onto the existing
archive "(0)" and its content was lost. maxHistory and totalSizeCap
never removed such archives either (#933).
Literal characters with a special meaning in regular expressions are
now escaped one by one. Pattern.quote() is not used because callers keep
only the part of the regex after the last '/'.
The strings returned by toRegex() and toRegexForFixedDate() change
accordingly, e.g. "foo-2003.05.20-(\d+).txt" becomes
"foo-2003\.05\.20-(\d+)\.txt".
Fixes#914Fixes#933
Signed-off-by: Jialin Chen <[email protected]>
0 commit comments