Skip to content

BootcampToProd/spring-boot-ai-logging-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🔍 Spring AI Log Model Requests and Responses - 3 Easy Ways

This repository demonstrates three beginner-friendly approaches to log requests and responses when using Spring AI.


📌 What are we trying to achieve?

We want to log both the requests and the responses when making use of Spring AI in a Spring Boot application.

We found three effective approaches to make this happen—thanks to:


📚 Want a deeper explanation?

We’ve written a detailed blog that explains each logging method with code snippets, setup instructions, and FAQs to help you get started:

🔗 Blog: Spring AI Log Model Requests and Responses - 3 Easy Ways


🛠️ 3 Approaches for Logging Requests & Responses

Approach Description Branch
Custom Interceptor Uses RestClientCustomizer and a custom interceptor to log request/response details. main
📒 Logbook Integration Leverages Zalando’s Logbook to log HTTP traffic cleanly. logbook-logging
🧩 SimpleLoggerAdvisor Uses Spring AI’s built-in SimpleLoggerAdvisor for logging. simple-logger-advisor-logging

✨ Choose the branch based on the implementation you'd like to explore.