I have a spring boot application with a pretty standard logback configuration. I know I can turn on/off the verbose logging by changing the logging level property to only log errors (<root level = "ERROR">)
. And I have configured my app to only log errors in the application-insights azure resource that I have, so as to avoid verbose logging till it's necessary. All of this is working fine.
However, as soon as I get an error, I want to start verbose logging for a certain period of time let's say 2hrs, so as to help with the troubleshooting. And this is what I am unable to achieve. I am pretty new to Java as well as Azure resource configurations, so any idea will be really helpful.
Appreciate the answer and comment on the question, they will prove to be a good resource for whoever comes across this question in future. However, a more pointed answer to this situation is needed. I was able to achieve the conditional, time based, verbose logging for my application by the following approach: