{"record":{"id":"4e2f38387055bdb8","repo":"spring-projects/spring-ai","slug":"you-have-enabled-logging-out-the-chatclient-comple","errorCode":null,"errorMessage":"You have enabled logging out the ChatClient completion content with the risk of exposing sensitive or private information. Please, be careful!","messagePattern":"You have enabled logging out the ChatClient completion content with the risk of exposing sensitive or private information\\. Please, be careful!","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"auto-configurations/models/chat/client/spring-ai-autoconfigure-model-chat-client/src/main/java/org/springframework/ai/model/chat/client/autoconfigure/ChatClientAutoConfiguration.java","lineNumber":82,"sourceCode":" * @author Jonatan Ivanov\n * @since 1.0.0\n */\n@AutoConfiguration(after = ToolCallingAutoConfiguration.class)\n@ConditionalOnClass(ChatClient.class)\n@EnableConfigurationProperties(ChatClientBuilderProperties.class)\n@ConditionalOnProperty(prefix = ChatClientBuilderProperties.CONFIG_PREFIX, name = \"enabled\", havingValue = \"true\",\n\t\tmatchIfMissing = true)\npublic class ChatClientAutoConfiguration {\n\n\tprivate static final Log logger = LogFactory.getLog(ChatClientAutoConfiguration.class);\n\n\tprivate static void logPromptContentWarning() {\n\t\tlogger.warn(\n\t\t\t\t\"You have enabled logging out the ChatClient prompt content with the risk of exposing sensitive or private information. Please, be careful!\");\n\t}\n\n\tprivate static void logCompletionWarning() {\n\t\tlogger.warn(\n\t\t\t\t\"You have enabled logging out the ChatClient completion content with the risk of exposing sensitive or private information. Please, be careful!\");\n\t}\n\n\t@Bean\n\t@ConditionalOnMissingBean\n\t@SuppressWarnings(\"removal\")\n\tChatClientBuilderConfigurer chatClientBuilderConfigurer(ObjectProvider<ChatClientCustomizer> customizerProvider,\n\t\t\tObjectProvider<ChatClientBuilderCustomizer> builderCustomizerProvider) {\n\t\tChatClientBuilderConfigurer configurer = new ChatClientBuilderConfigurer();\n\t\tconfigurer.setChatClientCustomizers(customizerProvider.orderedStream().toList());\n\t\tconfigurer.setChatClientBuilderCustomizers(builderCustomizerProvider.orderedStream().toList());\n\t\treturn configurer;\n\t}\n\n\t@Bean\n\t@ConditionalOnMissingBean\n\t@ConditionalOnBean(ToolCallingManager.class)\n\tToolCallingAdvisor.Builder<?> toolCallingAdvisorBuilder(ChatClientBuilderProperties properties,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/auto-configurations/models/chat/client/spring-ai-autoconfigure-model-chat-client/src/main/java/org/springframework/ai/model/chat/client/autoconfigure/ChatClientAutoConfiguration.java#L64-L100","documentation":"ChatClientAutoConfiguration.logCompletionWarning emits this warning when completion (LLM response) content logging is enabled for the ChatClient. Because logged completions can contain user-derived sensitive data, the library warns at auto-configuration time whenever you opt in.","triggerScenarios":"Setting the ChatClient completion-content logging property (e.g. spring.ai.chat.client.observation.log-completion-content=true) so the conditional logCompletionWarning bean method executes.","commonSituations":"Debugging model outputs locally and forgetting to revert; shared config enabling both prompt and completion logging; production log aggregation then capturing end-user data, breaching privacy policies.","solutions":["Turn the property off in production (log-completion-content=false).","Enable it only under dev/test profiles.","Use sampling/truncation or a log redaction layer if completions must be retained."],"exampleFix":"// before (application.yml)\nspring.ai.chat.client.observation.log-completion-content: true\n// after\nspring.ai.chat.client.observation.log-completion-content: false","handlingStrategy":"validation","validationCode":"boolean loggingCompletions = env.getProperty(\n    \"spring.ai.chat.client.observation.log-completion-content\", Boolean.class, false);\nif (loggingCompletions && isProduction) {\n    throw new IllegalStateException(\"Completion content logging must be disabled in production\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable completion logging outside dev/test.","Redact or truncate completions if retention is required.","Review logging config in code review when observability changes."],"tags":["logging","security","privacy","chat-client","observation"],"backgroundTag":"sensitive-data-logging","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}