-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
Log Debug \Log::debug('Static cache loaded
is out of control.
#3209
Comments
Can confirm, this error message fills up all of my daily logs on my production server 😂 |
Can confirm as well. |
This is fixed for 3.1 because there's a little breaking change for people using custom drivers. |
I am getting this issue in my production logs, any support would be appreciated
nginx.conf
|
@DrTrills Based on what you shared, I believe that message is actually accurate for you. By default, Statamic will create a cache file with query strings. So in your first two urls:
Notice the |
Hi @ericlbarnes, appreciate the feedback. So in this case anything that I can do to prevent the error or just leave it as is? |
Yes, I believe in these situations it's safe to just ignore the log entry. The way the message is written its meant more for when you are just setting up static caching and are not sure if it's working. |
Hi there, Here is the log
|
The slash on the end of that URL might be the hint. If the cached version is being served, then the log is doing what it's supposed to. Your rewrite rules might not be handling the slash. Does visiting /contact without the slash cause the log? |
Hey @jasonvarga, # Remove trailing slash by doing a 301 redirect
rewrite ^/(.*)/$ /$1 permanent; |
I also get the message wihout the trailing slash
|
This is still happening and I don't want to open a new issue. Is there anyone that is runnning into this? I looked the source code and it doesn't make sense, if anyone can explain to me how it works, would be awesome. |
I was also a little dumbfounded by these messages, as I was getting them for every page and the web server seemed to be redirecting URLs correctly and without trailing slashes. However I was simply missing the static caching rewrite rules for apache as explained here. After adding the rewrite rules to So in the end the logging was informing me that Statamic was having to process a URL and fetch a file, even though the web server itself should've been able to parse the URL and serve it directly. Statamic should only be parsing the GET request itself if the request string is longer than what is allowed by |
@ashermiddleton I'm not sure what you mean about this max length issue. Can you elaborate? |
@jasonvarga sure, to be clear there is no bug, I was explaining Statamic's file caching behaviour (with full caching strategy) for anyone stumbling on this in future. I was referring to isBasenameTooLong()'s use in getFilePath() |
Bug Description
When you have full caching enabled the
\Log::debug('Static cache loaded ['.$url.'] If you are seeing this, your server rewrite rules have not been set up correctly.');
message is out of control.How to Reproduce
Setup full caching.
CACHE_STRATEGY=full
. Then change your nginx to what your docs outline:Now start browsing the site. Every time a new page is visited, even without a cache file the log debug message fires.
Extra Detail
Unless I'm reading the code wrong it's because of the way this statement is written:
https://github.com/statamic/cms/blob/3.0/src/StaticCaching/Middleware/Cache.php#L30-L32
If a page
canBeCached
, then it tries togetCachedPage
, so it doesn't matter whatgetCachedPage
returns, it's always going to log the message.The text was updated successfully, but these errors were encountered: