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

Failure to Parse YAML for log files causes error #8

Closed
lachieh opened this issue May 11, 2020 · 4 comments
Closed

Failure to Parse YAML for log files causes error #8

lachieh opened this issue May 11, 2020 · 4 comments
Assignees

Comments

@lachieh
Copy link

lachieh commented May 11, 2020

I have seen an issue where the log file got put into an unparseable state like this:

/blog/a-post-name: 2
/bl

This will throw an error when the addon attempts to add an entry to the log file.

Ideally, not being able to log a hit on a redirect should handle the exception silently and still redirect the user onto the correct location. I know there are some conditions around this, but it'd be better to at least move the broken file into a new location and create a new log than to fail loudly to the user.

@mdouglasmorrison
Copy link

Hi. We encountered this same issue yesterday. Is a resolution to this on the roadmap?

@mdouglasmorrison
Copy link

Hi. This is continuing to happen to us. Unless we hear otherwise we are going to assume that there will be no fix and our best course of action is to just to continue to delete the offending unparseable line when it appears.

@wanze
Copy link
Contributor

wanze commented Mar 2, 2021

Hi @lachieh and @mdouglasmorrison

Thanks for the report!

Ideally, not being able to log a hit on a redirect should handle the exception silently and still redirect the user onto the correct location

I agree with this: We should introduce a specific exception if we have a problem loading the logs, catch it and always perform the redirect. Not sure about starting a new log file, as this would be an "endless" problem.

It would be good to know why the YAML does not get written correctly in the first place. Looking at the code, the file should be written before the redirect exception is thrown, so the system should not be in the process of writing to the file while the redirect happens. Can you provide any information from your logs which indicates a problem there? Or think of anything else?

Cheers

@wanze wanze self-assigned this Jun 30, 2021
wanze added a commit that referenced this issue Jul 1, 2021
If redirect log files contain invalid yaml, the addon fails to execute redirects
because of a parse error. Now, the addon handles this situation and always
performs the redirect. Parse errors are logged to Statamic's log. See #8.
@wanze
Copy link
Contributor

wanze commented Jul 1, 2021

This has been fixed with v1.5.0. Redirects are always executed when logging fails and and parse exceptions are logged to Statamic.

@wanze wanze closed this as completed Jul 1, 2021
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

No branches or pull requests

3 participants