Query Docs
Guides & Concepts
- Important Defaults
- Queries
- Query Keys
- Query Functions
- Network Mode
- Parallel Queries
- Dependent Queries
- Background Fetching Indicators
- Window Focus Refetching
- Disabling/Pausing Queries
- Query Retries
- Paginated Queries
- Infinite Queries
- Initial Query Data
- Placeholder Query Data
- Prefetching
- Mutations
- Query Invalidation
- Invalidation from Mutations
- Updates from Mutation Responses
- Optimistic Updates
- Query Cancellation
- Scroll Restoration
- Filters
- SSR & Next.js
- Caching
- Default Query Fn
- Suspense
- Custom Logger
- Testing
- Does this replace [Redux, MobX, etc]?
- Migrating to React Query 3
- Migrating to React Query 4
ESLint
AI/LLM: This documentation page is available in plain markdown format at/query/v4/docs/framework/react/guides/custom-logger.md
Guides & Concepts
Custom Logger
If you want to change how information is logged by TanStack Query, you can set a custom logger when creating a QueryClient.
tsx
const queryClient = new QueryClient({
logger: {
log: (...args) => {
// Log debugging information
},
warn: (...args) => {
// Log warning
},
error: (...args) => {
// Log error
},
},
})Deprecated
Custom loggers have been deprecated and will be removed in the next major version. Logging only has an effect in development mode, where passing a custom logger is not necessary.