# InMemoryCache debug/error logging?

**URL:** <https://community.apollographql.com/t/inmemorycache-debug-error-logging/7248>\
**Category:** Client SDKs\
**Tags:** client, web\
**Created:** [February 28, 2024, 11:37pm UTC](https://community.apollographql.com/t/inmemorycache-debug-error-logging/7248 "2024-02-28T23:37:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kpruden](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/kpruden/32/4932_2.png) [@kpruden](https://community.apollographql.com/u/kpruden)\
**Post date:** [February 28, 2024, 11:37pm UTC](https://community.apollographql.com/t/inmemorycache-debug-error-logging/7248/1 "2024-02-28T23:37:20Z")

</div>

Is there a way to make `InMemoryCache` log errors or other debugging statements?

I’m trying to troubleshoot a problem which I believe is happening in the caching layer (InMemoryCache). I suspect there may be a problem with my field policies or some other issue with the shape of the data that is causing the internal state of the cache to fail to update correctly. This is a paginated query (using `fetchMore`).

After instrumenting my code a little, I’ve been able to determine that, upon calling `fetchMore` to retrieve the next page of results, the actual query to the server is succeeding and returning the expected data. I’ve also confirmed that relevant field policy methods (`read` `merge` etc) are being called as expected. However, my application code (where `useQuery` is being called) is not seeing the updated results – the hook never “fires”. No errors are showing up anywhere that I can see (console, query results, etc).

I suspect the cache is blowing up at some point attempting to update its internal state, and I’m hoping there’s a way to get some debugging statements, or some kind or error message that might give me a clue as to where my problem might be.

[UPDATE] I’m trying to troubleshoot a bad interaction between two separate queries that fetch overlapping data. My queries all work fine in isolation (with a clean cache), but specific sequences, where one query is updating a cache which contains the results of another query, seems to put the cache into a bad state where the query (or queries) seem to simply not update at all from that point on. These are both reasonably complicated queries, with complicated UI code on top of them. I’m hoping to zero in on the specific node(s) in the graph that’s giving the cache trouble before I start rewriting queries…

---

<div class="post-metadata">

**Author:** ![lenz](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lenz/32/4007_2.png) [@lenz](https://community.apollographql.com/u/lenz)\
**Post date:** [February 29, 2024, 10:39am UTC](https://community.apollographql.com/t/inmemorycache-debug-error-logging/7248/2 "2024-02-29T10:39:32Z")

</div>

You can do

```ts
import { setVerbosity } from "ts-invariant";
setVerbosity("debug");

```

to get more logs out of Apollo Client - maybe you find something that helps you?

---

<div class="post-metadata">

**Author:** ![kpruden](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/kpruden/32/4932_2.png) [@kpruden](https://community.apollographql.com/u/kpruden)\
**Post date:** [February 29, 2024, 3:47pm UTC](https://community.apollographql.com/t/inmemorycache-debug-error-logging/7248/3 "2024-02-29T15:47:01Z")

</div>

Hi @lenz,

Thanks for the tip. Unfortunately that didn’t seem to add any additional output. I did a quick search through the `apollo-client` source on GitHub and it doesn’t look like there is a lot of logging instrumentation, and none at all in the caching code, so it looks like I’m on my own here ☹
