Hibernate ORM: `drop-and-create` logs too verbose
See original GitHub issueIn DEV mode, I just got those logs:
2021-04-02 09:40:02,743 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) SQL Warning Code: 0, SQLState: 00000
2021-04-02 09:40:02,744 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) relation "orders" does not exist, skipping
2021-04-02 09:40:02,744 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) SQL Warning Code: 0, SQLState: 00000
2021-04-02 09:40:02,745 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) table "customers" does not exist, skipping
2021-04-02 09:40:02,745 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) SQL Warning Code: 0, SQLState: 00000
2021-04-02 09:40:02,745 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) table "orders" does not exist, skipping
2021-04-02 09:40:02,746 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) SQL Warning Code: 0, SQLState: 00000
2021-04-02 09:40:02,746 WARN [org.hib.eng.jdb.spi.SqlExceptionHelper] (Quarkus Main Thread) sequence "hibernate_sequence" does not exist, skipping
Due to this config:
quarkus.hibernate-orm.database.generation=drop-and-create
Given that they’re not real issues, and we know about them, is there any way we can filter them out?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Simplified Hibernate ORM with Panache - Quarkus
Hibernate queries are super powerful, but overly verbose for common operations, requiring you to write queries even when you don't need all the...
Read more >Logging Guide for Hibernate 4, 5 & 6 - Use the right config for ...
Choosing the right logging configuration can make the difference between finding a performance issue during development or suffering from it on production.
Read more >Hibernate Search 6.1.7.Final: Reference Documentation
Hibernate Search, full text search for your entities - Reference Documentation.
Read more >Various Logging Levels in Hibernate - Baeldung
So, all we've to do is set the logging level of this category to DEBUG. In Log4J, we'll have to add a logger...
Read more >Turning off hibernate logging console output - Stack Overflow
Important notice: the property (part of hibernate configuration, NOT part of logging framework config!) hibernate.show_sql. controls the logging directly to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So, my app startup is now:
As you can see, it’s mostly bullshit. I wish I could filter it out but it doesn’t seem obvious how. I’ve set a breakpoint in where it’s printed and there:
I guess if we could set a threadlocal indicating we’re in
SchemaDropperImpl.doDrop
with a setting ofdrop-and-create
and perhaps in DEV mode, then I could filter these out, but it would need more thanLogFilterBuildItem
which can only match on prefixes, not on logic. I could also filter it out fromorg.hibernate.engine.jdbc.spi.SqlExceptionHelper.STANDARD_WARNING_HANDLER
if I could override the damn handler, but I don’t see how.We really have to fix this stuff, it’s a very poor startup experience.
Note it’s even worse with some databases, e.g. Oracle: it seems we display a full stack trace… See #26228
Maybe we should have a look at how to fix this in Hibernate ORM 6.x, with a list of error codes we can safely ignore in exceptions/JDBC warnings, but that should be only in the context of schema dropping, and that will probably require some disruptive internal changes…