According to https://quarkus.io/guides/all-config , the quarkus.hibernate-orm.log.sql
property must be set at build time.
I tried to pass the parameter at run time and got the error:
Build time property cannot be changed at runtime. quarkus.hibernate-orm.log.sql was false at build time and is now true
It would be great if I could set it up at run time.
Nowadays, if I have any problem in production and I want to turn this log to true, I'll have to make a new build.
Besides that, I only generate one docker image of my application an run it at all environments of my cloud. In development and stage environments, this log is usefull for me.
This property is the most important, but other properties could also help me, as quarkus.hibernate-orm.log.jdbc-warnings
and quarkus.hibernate-orm.log.bind-param
.
Thanks!
/cc @gsmet, @Sanne
Closely related to #9275.
hi @felipewind , thanks for raising this! Yes I agree we need to do this - no need to persuade me. But it's not an easy change currently to make any ORM settings reconfgurable - there's a general underlying issue that needs to be fixed first, as @+famod mentioned.
Hi @Sanne , thanks for the reply.
I didn't know it was so difficult.
For my user perspective, this feature would be good. But as I don't have any idea about the work necessary to do this, if you prefer I can close this issue.
no worries, let's keep the issue open as I agree it's important. I can't work on it now but I hope to find some time in the near future, or find another volunteer.
Thanks a lot @Sanne !
Can you just use the org.hibernate.SQL
log category instead?
At least as a workaround for now?
@gavinking thanks.
Sorry about my lack of knowledge, but how could I use the org.hibernate.SQL
log category in a Quarkus application?
I've tried to pass it as an argument, but didn't work:
java -jar -Dorg.hibernate.SQL=DEBUG my-quarkus-application-runner.jar
I built my application (mvn clean package
) using the quarkus.hibernate-orm.log.sql=false
and then tried to pass this property you told.
Well I've not tried but Google sent me here https://quarkus.io/guides/logging
@felipewind did my suggestion work for you?
Hello @gavinking ! Yes, it worked, thanks a lot for helping!
As you suggested, I went to https://quarkus.io/guides/logging and found there this log option:
-Dquarkus.log.category.\"org.hibernate\".level=DEBUG
I ran my application with this options and between tons of DEBUG messages from Hibernate, the SQL messages were there with the annotation DEBUG [or.hi.SQL]
OK great.
Most helpful comment
Hello @gavinking ! Yes, it worked, thanks a lot for helping!
As you suggested, I went to https://quarkus.io/guides/logging and found there this log option:
I ran my application with this options and between tons of DEBUG messages from Hibernate, the SQL messages were there with the annotation
DEBUG [or.hi.SQL]