Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeFormat RFC1036 Sunday name is short (should be long) #4486

Closed
ericlogic opened this issue Mar 10, 2024 · 0 comments · Fixed by #4487
Closed

DateTimeFormat RFC1036 Sunday name is short (should be long) #4486

ericlogic opened this issue Mar 10, 2024 · 0 comments · Fixed by #4487
Assignees

Comments

@ericlogic
Copy link

Describe the bug
I'm using a FileChannel to record logs with property "rotation" sets to "daily". It crashed on Sunday with an error message: Invalid DateTimeString:Sunday, 10 Mar 24 07:34:50 GMT

To Reproduce

Path logPath = Path(commandPath()).parent().pushDirectory("logs");
File(logPath).createDirectories();
logPath.setFileName("purpose-service.log");
Channel::Ptr pFileChannel = new FileChannel();
pFileChannel->setProperty("path", logPath.toString());
pFileChannel->setProperty("rotation", "daily");
pFileChannel->setProperty("archive", "timestamp");
PatternFormatter::Ptr pFormatter = new PatternFormatter("%Y-%m-%dT%H:%M:%S %q [%s] %t");
FormattingChannel::Ptr pFormattingChannel = new FormattingChannel(pFormatter, pFileChannel);
Logger::root().setChannel(pFormattingChannel);

Logger::get("main").information("Application started!");

Logs

Exception thrown at 0x00007FF88D755B0C in purpose-service.exe: Microsoft C++ exception: Poco::SyntaxException at memory location 0x000000FC5912D730.
Syntax error: Invalid DateTimeString:Sunday, 10 Mar 24 07:34:50 GMT

Please add relevant environment information:

  • OS Type and Version: Window 11
  • POCO Version: 1.13.0

Additional context
I did some research and found a regular expression in "Foundation/src/DateTimeFormat.cpp".

const std::string DateTimeFormat::RFC1036_REGEX(
	"(((Monday)|(Tuesday)|(Wednesday)|(Thursday)|(Friday)|(Saturday)|(Sun)), *)?"
	"\\d\\d? +"
	"((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) +"
	"\\d\\d(\\d\\d)? +\\d\\d:\\d\\d(:\\d\\d)? "
	"(" TIMEZONES_REGEX_PART "|)?+"
	"(([+\\-]?\\d\\d\\d\\d)?|" TIMEZONES_REGEX_PART "|\\w)");

Should the "Sun" in this regular expression be changed to "Sunday"?

@ericlogic ericlogic added the bug label Mar 10, 2024
@obiltschnig obiltschnig added this to the Release 1.13.3 milestone Mar 10, 2024
@aleks-f aleks-f changed the title Can not rotate log file by date on Sunday DateTimeFormat RFC1036 Sunday name is short (should be long) Mar 10, 2024
@aleks-f aleks-f added this to 1.13 Mar 10, 2024
@aleks-f aleks-f moved this to In Progress in 1.13 Mar 10, 2024
@aleks-f aleks-f added the fixed label Mar 11, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in 1.13 Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants