Skip to content

Allow percent % in path and file names #561#601

Merged
moldover merged 6 commits into
developfrom
support_percent_561
Jun 9, 2022
Merged

Allow percent % in path and file names #561#601
moldover merged 6 commits into
developfrom
support_percent_561

Conversation

@moldover
Copy link
Copy Markdown
Contributor

@moldover moldover commented Jun 6, 2022

No description provided.

@moldover moldover requested review from HEdingfield and tarheel June 6, 2022 05:15
Copy link
Copy Markdown
Contributor

@HEdingfield HEdingfield left a comment

Choose a reason for hiding this comment

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

Were you able to test this with the files included in this issue?

Comment thread src/main/java/network/brightspots/rcv/Logger.java Outdated
tabulationHandler =
new FileHandler(outputPath, LOG_FILE_MAX_SIZE_BYTES, TABULATION_LOG_FILE_COUNT, true);
// replace any instances of % with %% because the FileHandler pattern generator requires this
tabulationHandler = new FileHandler(outputPath.replace("%", "%%"),
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.

Would this work as intended if a file name has a double percentage in the name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, I tried this with multiple percent characters and that part works, but as I'm checking again I realize I broke the %g functionality here so it's not quite correct yet. Will push a fix for that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just pushed a fix for this bit. Go ahead and get hog-wild with your path names.

@moldover
Copy link
Copy Markdown
Contributor Author

moldover commented Jun 7, 2022

@HEdingfield + @andyanderson yep - was able to tabulate:

2022-06-06 18:53:47 PDT INFO: Round: 4
2022-06-06 18:53:47 PDT INFO: Winning threshold set to 14.
2022-06-06 18:53:47 PDT INFO: Candidate "Strawberry" got 15 vote(s).
2022-06-06 18:53:47 PDT INFO: Candidate "Grapefruit" got 11 vote(s).
2022-06-06 18:53:47 PDT INFO: Candidate "Strawberry" was elected in round 4 with 15 votes.

Congratulations to Strawberry.

Copy link
Copy Markdown
Contributor

@HEdingfield HEdingfield left a comment

Choose a reason for hiding this comment

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

Big up the strawberry.

tabulationHandler.setLevel(Level.FINE);
logger.addHandler(tabulationHandler);
info("Tabulation logging to: %s", outputPath.replace("%g", "*"));
info("Tabulation logging to: %s", tabulationLogPattern.replace("%g", "0"));
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.

Why this change? It seems like it makes it look like it's always pointing to log index 0 when that may not actually be the case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe this is an improvement over the current message. At the time it's printed it's accurate and it is less confusing than the current asterisk message, which might mean something to folks acquainted with the notion of wildcards, but not to our users.

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.

I guess this begs the question of why we even include the log index at all if we know it's always going to be 0? I assume it serves some purpose and, if so, I think we should keep this as-is. We've already got an established precedent of using * in a log name for the execution log message, and I think it's a pretty well-understood concept.

In any case, this PR looks good, thanks for fixing this!

tabulationHandler.setLevel(Level.FINE);
logger.addHandler(tabulationHandler);
info("Tabulation logging to: %s", outputPath.replace("%g", "*"));
info("Tabulation logging to: %s", tabulationLogPattern.replace("%g", "0"));
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.

I guess this begs the question of why we even include the log index at all if we know it's always going to be 0? I assume it serves some purpose and, if so, I think we should keep this as-is. We've already got an established precedent of using * in a log name for the execution log message, and I think it's a pretty well-understood concept.

In any case, this PR looks good, thanks for fixing this!

@moldover moldover merged commit cb6f452 into develop Jun 9, 2022
@moldover moldover deleted the support_percent_561 branch June 9, 2022 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants