Skip to content

Fix divider in rotated access log for DefaultAccessLogReceiver#48398

Closed
Pankraz76 wants to merge 1 commit into
quarkusio:mainfrom
Pankraz76:48342
Closed

Fix divider in rotated access log for DefaultAccessLogReceiver#48398
Pankraz76 wants to merge 1 commit into
quarkusio:mainfrom
Pankraz76:48342

Conversation

@Pankraz76

@Pankraz76 Pankraz76 commented Jun 15, 2025

Copy link
Copy Markdown

Issue #48342 fix: No divider between base file name and timestamp in the name of rotated access log

tc:

before:
zero

after:

100% (1/1) 100% (11/11) 92% (63/68) 68% (26/38)
100% (1/1) 100% (12/12) 98% (71/72) 73% (31/42)
50% (1/2) 36% (12/33) 67% (93/138) 60% (48/80)

@quarkus-bot

quarkus-bot Bot commented Jun 15, 2025

Copy link
Copy Markdown

Thanks for your pull request!

Your pull request does not follow our editorial rules. Could you have a look?

  • title should preferably start with an uppercase character (if it makes sense!)

This message is automatically generated by a bot.

private String fixLogBaseName(String logBaseName) {
if(logBaseName.endsWith("."))
{
return logBaseName.substring(0,logBaseName.length()-1);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this workaround the issue?

@zhangjiangqige
@dmlloyd

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need a test that proves this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test should fail with old impl. will double check.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testRotatedFileNameFormatWithDot

testMultipleDotsInBaseName

fail with old impl.

removing breaking .dot suffix passes the test with old impl.

To me it seems to be covered.

image

never the less this feels just like a workaround.

having the prefix might be resulting from somewhere we should actually fix it there.

Imho the issue is still existing, but not prior anymore temporary solution in place.

@Pankraz76
Pankraz76 marked this pull request as ready for review June 15, 2025 19:12
@Pankraz76 Pankraz76 changed the title [48342] fix: No divider between base file name and timestamp in the name of rotated access log Issue quarkusio#48342 fix: No divider between base file name and timestamp in the name of rotated access log Jun 16, 2025
@Pankraz76 Pankraz76 changed the title Issue quarkusio#48342 fix: No divider between base file name and timestamp in the name of rotated access log Issue #48342 fix: No divider between base file name and timestamp in the name of rotated access log Jun 16, 2025
@Pankraz76
Pankraz76 requested a review from geoand June 17, 2025 09:06

@geoand geoand left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the fact that I don't think the PR fixes the original issue (see relevant comment in the test), I am too keen on seeing a bunch of (AI generated?) tests for each and every method

Comment on lines +82 to +83
assertTrue(Files.list(tempDir)
.anyMatch(p -> p.getFileName().toString().matches("test-rotate\\d{4}-\\d{2}-\\d{2}\\.log")));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indicates to me that the issue is not fixed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will check again. thanks.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes looks off.

image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected :"test-rotate2025-06-17.log"
Actual :"test-rotate.2025-06-17.log"

assuming actual is correct.

@Pankraz76

Copy link
Copy Markdown
Author

Apart from the fact that I don't think the PR fixes the original issue (see relevant comment in the test), I am too keen on seeing a bunch of (AI generated?) tests for each and every method

Yes, it's generated and corrected by me.

Having one test with even only one assert is the ideal, so the design would end up the same.

Here it's only about the numbers, as they don't lie—the branch coverage is incremented from zero to more than 50%. So it's covered, providing the security.

The only issue could be redundant tests, which is indeed something to look into afterward.

Except for this, every generated test covering something is better than having nothing, in my opinion.

It's no problem to increment from the AI skeleton.

new tests are good, but I don't think the pR description is accurate

@geoand

geoand commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

The only issue could be redundant tests

Unfortunately that's only not exactly true - every piece of code is a maintenance burden for those called upon to maintain it (which only becomes more difficult when the code is not written by those people)

receiver.rotate();

assertThat(Files.list(tempDir)
.filter(p -> p.getFileName().toString().matches("test-multi-rotate.\\d{4}-\\d{2}-\\d{2}\\.log"))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.filter(p -> p.getFileName().toString().matches("test-multi-rotate.\\d{4}-\\d{2}-\\d{2}\\.log"))
.filter(p -> p.getFileName().toString().matches("test-multi-rotate\\d{4}-\\d{2}-\\d{2}\\.log"))

this will fail.

@Pankraz76
Pankraz76 requested a review from geoand June 17, 2025 10:31
@Pankraz76

Copy link
Copy Markdown
Author

maintenance burden

yes nothing comes without cost of carry. I have adjusted completely.

@Pankraz76

Copy link
Copy Markdown
Author

maintenance burden

this is my motivation to reduce burden. im willing to help streamline development.

current setup comes short as chosen plugins insufficient. Considering starts on github its 5k vs 300. Just by following these numbers and seeing the failed effort align imports and prevent unused. Its might tells that the decision made is not justifiable anymore.

@Pankraz76 Pankraz76 changed the title Issue #48342 fix: No divider between base file name and timestamp in the name of rotated access log Issue #48342 fix DefaultAccessLogReceiver: No divider between base file name and timestamp in the name of rotated access log Jun 18, 2025
@Pankraz76 Pankraz76 changed the title Issue #48342 fix DefaultAccessLogReceiver: No divider between base file name and timestamp in the name of rotated access log Fix divider in rotated access log for DefaultAccessLogReceiver Jun 18, 2025

private long changeOverPoint;
private String currentDateString;
private boolean forceLogRotation;

@Pankraz76 Pankraz76 Jun 18, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could prevent this with

  • test coverage of 100% like done in checkstyle.
  • mutation testing, right?

@Pankraz76

Pankraz76 commented Jun 18, 2025

Copy link
Copy Markdown
Author

100% and found our bug so could merge and the fix bug.

wrong branch buts its very much the same:

#48449

@Pankraz76

Copy link
Copy Markdown
Author

1K LOC of tests nearly up to 100%.

im here to serve you.

@maxandersen

Copy link
Copy Markdown
Member

1K LOC of tests nearly up to 100%.

I'm not following what you mean ?

@Pankraz76

Pankraz76 commented Jun 20, 2025

Copy link
Copy Markdown
Author

1_000 lines of code for testing.

Nearly up to 100% test coverage, from zero before. Im wondering what JBoss understands under the term Professional.

I have different interpretation of this term.

image

@Pankraz76

Copy link
Copy Markdown
Author

first need enabler as 50% of class makes no sense or is simple dead.

@Pankraz76

Copy link
Copy Markdown
Author

closing as impossible for me to fix without removal of technical depth prior. Affected class has 50% dead code-

@Pankraz76

Copy link
Copy Markdown
Author

@iddeepak consider this a real benefit and learning experience in all manners.

Feel free to take over and improve quarkus, as the world relies on this high performing AC.

@Pankraz76 Pankraz76 mentioned this pull request Jun 21, 2025
@Pankraz76 Pankraz76 reopened this Jun 21, 2025
@quarkus-bot quarkus-bot Bot removed the triage/invalid This doesn't seem right label Jun 21, 2025
assertThat(Files.list(tempDir))
.extracting(Path::getFileName)
.extracting(Path::toString)
.containsExactlyInAnyOrder(

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this the real deal test:


java.lang.AssertionError: 
Expecting actual:
  ["test-empty.log",
    "test-empty.2025-06-21-2.log",
    "test-empty.2025-06-21-3.log",
    "test-empty.2025-06-21-1.log",
    "test-empty2025-06-21.log",
    "test-empty.2025-06-21.log"]
to contain exactly in any order:
  ["test-empty.log",
    "test-empty.2025-06-21.log",
    "test-empty.2025-06-21-1.log",
    "test-empty.2025-06-21-2.log",
    "test-empty.2025-06-21-3.log",
    "test-empty.2025-06-21-4.log"]
elements not found:
  ["test-empty.2025-06-21-4.log"]
and elements not expected:
  ["test-empty2025-06-21.log"]


	at io.quarkus.vertx.http.runtime.DefaultAccessLogReceiverTest.testRotationWithEmptyLogFile(DefaultAccessLogReceiverTest.java:780)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
image

@Pankraz76

Copy link
Copy Markdown
Author

each test is dedicated to one concern, therefore should be simple to digest.

Let me know if its too much quality assurance resulting in test coverage. Idk whats the DoD or what quality gate to pass.

@gsmet

gsmet commented Jul 7, 2025

Copy link
Copy Markdown
Member

I'm closing this one in favor of #48814 .

Thanks for the effort, I made you a co-author in the other PR.

@gsmet gsmet closed this Jul 7, 2025
@quarkus-bot quarkus-bot Bot added the triage/invalid This doesn't seem right label Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants