Expected Behavior
I would like to see details about what is wrong with my prompt template in my logs (that go to LogStash or a similar system), not in standard error.
So if I have code:
PromptTemplate.builder().template("bad {template").build().create()
there should be something like
11:12:13 org.springframework.ai.template.st.StTemplateRenderer ERROR 1:13: premature EOF
Current Behavior
org.stringtemplate.v4.misc.ErrorManager#DEFAULT_ERROR_LISTENER is used, which prints using System.err.println
. So the message is unstructured message in stderr:
1:13: premature EOF
Context
I think StTemplateRenderer should pass a custom implementation of STErrorListener that uses SLF4J instead of System.err.
Comment From: sunyuhan1998
Good catch! The default STErrorListener
outputs exception information through System.err.println
, which can cause some critical rendering exception details to be lost.
I've submitted a PR: https://github.com/spring-projects/spring-ai/pull/3606 to try redirecting the exceptions to the log output. Thanks for reporting this issue!
Comment From: pkubowicz
Thank you for the quick reaction!