Skip to content

Commit

Permalink
backporting of LOGBACK-1175
Browse files Browse the repository at this point in the history
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
  • Loading branch information
ceki committed Jul 16, 2021
1 parent acdf468 commit 40c95cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -199,7 +199,7 @@ public String toRegexForFixedDate(Date date) {
if (p instanceof LiteralConverter) {
buf.append(p.convert(null));
} else if (p instanceof IntegerTokenConverter) {
buf.append("(\\d{1,3})");
buf.append("(\\d{1,5})");

This comment has been minimized.

Copy link
@kisssadam

kisssadam Sep 6, 2021

@ceki
@diegofurtados

Does this change mean that the problem still exists in version 1.2.x described in JIRA https://jira.qos.ch/browse/LOGBACK-1175 ?

Looking at this code I think this will only work with archive files between 0 and 99999.

On branch 1.3.x the solution is to use \\d+: #322
Why didn't you apply the same change on this branch when you backported it?

This comment has been minimized.

Copy link
@yinghuzhu

yinghuzhu Apr 13, 2022

the same question, any idea ?

} else if (p instanceof DateTokenConverter) {
buf.append(p.convert(date));
}
Expand Down
Expand Up @@ -151,12 +151,12 @@ public void asRegexByDate() {
{
FileNamePattern fnp = new FileNamePattern("foo-%d{yyyy.MM.dd}-%i.txt", context);
String regex = fnp.toRegexForFixedDate(cal.getTime());
assertEquals("foo-2003.05.20-(\\d{1,3}).txt", regex);
assertEquals("foo-2003.05.20-(\\d{1,5}).txt", regex);
}
{
FileNamePattern fnp = new FileNamePattern("\\toto\\foo-%d{yyyy\\MM\\dd}-%i.txt", context);
String regex = fnp.toRegexForFixedDate(cal.getTime());
assertEquals("/toto/foo-2003/05/20-(\\d{1,3}).txt", regex);
assertEquals("/toto/foo-2003/05/20-(\\d{1,5}).txt", regex);
}
}

Expand Down

0 comments on commit 40c95cb

Please sign in to comment.