question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hibernate ORM: `drop-and-create` logs too verbose

See original GitHub issue

In 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?

CC @Sanne @yrodiere ?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
FroMagecommented, Nov 5, 2021

So, my app startup is now:

__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2021-11-05 15:04:38,351 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,352 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "album" does not exist, skipping
2021-11-05 15:04:38,353 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,353 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "album" does not exist, skipping
2021-11-05 15:04:38,354 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,354 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "album" does not exist, skipping
2021-11-05 15:04:38,355 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,355 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "album" does not exist, skipping
2021-11-05 15:04:38,356 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,357 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "alert" does not exist, skipping
2021-11-05 15:04:38,357 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,358 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "badge" does not exist, skipping
2021-11-05 15:04:38,359 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,359 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "like_table" does not exist, skipping
2021-11-05 15:04:38,360 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,360 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "like_table" does not exist, skipping
2021-11-05 15:04:38,361 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,361 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "like_table" does not exist, skipping
2021-11-05 15:04:38,362 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,362 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "personorgroup" does not exist, skipping
2021-11-05 15:04:38,363 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,363 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "personorgroup" does not exist, skipping
2021-11-05 15:04:38,364 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,365 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "personorgroup" does not exist, skipping
2021-11-05 15:04:38,365 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,366 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "reputationgain" does not exist, skipping
2021-11-05 15:04:38,366 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,366 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "reputationgain" does not exist, skipping
2021-11-05 15:04:38,367 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,367 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "reputationgain" does not exist, skipping
2021-11-05 15:04:38,368 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,368 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "vote" does not exist, skipping
2021-11-05 15:04:38,369 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,369 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "vote" does not exist, skipping
2021-11-05 15:04:38,370 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,370 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) relation "vote" does not exist, skipping
2021-11-05 15:04:38,371 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,371 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "album" does not exist, skipping
2021-11-05 15:04:38,371 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,372 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "alert" does not exist, skipping
2021-11-05 15:04:38,372 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,372 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "badge" does not exist, skipping
2021-11-05 15:04:38,373 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,373 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "like_table" does not exist, skipping
2021-11-05 15:04:38,374 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,374 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "personorgroup" does not exist, skipping
2021-11-05 15:04:38,375 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,375 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "reputationgain" does not exist, skipping
2021-11-05 15:04:38,376 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,376 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "setting" does not exist, skipping
2021-11-05 15:04:38,376 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,377 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "user_table" does not exist, skipping
2021-11-05 15:04:38,377 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,377 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) table "vote" does not exist, skipping
2021-11-05 15:04:38,378 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Warning Code: 0, SQLState: 00000
2021-11-05 15:04:38,378 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: <default>) sequence "hibernate_sequence" does not exist, skipping
2021-11-05 15:04:39,851 INFO  [io.quarkus] (Quarkus Main Thread) aviouf 1.0.0-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 7.574s. Listening on: http://localhost:8080
2021-11-05 15:04:39,852 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-11-05 15:04:39,852 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, hibernate-orm, hibernate-orm-panache, hibernate-validator, jdbc-postgresql, mailer, narayana-jta, qute, reactive-routes, resteasy-reactive, resteasy-reactive-qute, security, smallrye-context-propagation, smallrye-jwt, vertx, vixen]

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:

Daemon Thread [JPA Startup Thread: <default>] (Suspended)	
	owns: JPAConfig$LazyPersistenceUnit  (id=16987)	
	SqlExceptionHelper$StandardWarningHandler.logWarning(String, String) line: 230	
	SqlExceptionHelper$StandardWarningHandler(SqlExceptionHelper$WarningHandlerLoggingSupport).handleWarning(SQLWarning) line: 186	
	SqlExceptionHelper.walkWarnings(SQLWarning, SqlExceptionHelper$WarningHandler) line: 256	
	SqlExceptionHelper.handleAndClearWarnings(Statement, SqlExceptionHelper$WarningHandler) line: 322	
	SqlExceptionHelper.logAndClearWarnings(Statement) line: 273	
	GenerationTargetToDatabase.accept(String) line: 59	
	SchemaDropperImpl.applySqlString(String, Formatter, ExecutionOptions, GenerationTarget...) line: 375	
	SchemaDropperImpl.applySqlStrings(String[], Formatter, ExecutionOptions, GenerationTarget...) line: 359	
	SchemaDropperImpl.applyConstraintDropping(Namespace, Metadata, Formatter, ExecutionOptions, GenerationTarget...) line: 331	
	SchemaDropperImpl.dropFromMetadata(Metadata, ExecutionOptions, Dialect, Formatter, GenerationTarget...) line: 230	
	SchemaDropperImpl.performDrop(Metadata, ExecutionOptions, Dialect, SourceDescriptor, GenerationTarget...) line: 154	
	SchemaDropperImpl.doDrop(Metadata, ExecutionOptions, Dialect, SourceDescriptor, GenerationTarget...) line: 126	
	SchemaDropperImpl.doDrop(Metadata, ExecutionOptions, SourceDescriptor, TargetDescriptor) line: 112	
	SchemaManagementToolCoordinator.performDatabaseAction(Action, Metadata, SchemaManagementTool, ServiceRegistry, ExecutionOptions) line: 153	
	SchemaManagementToolCoordinator.process(Metadata, ServiceRegistry, Map, DelayedDropRegistry) line: 81	
	SessionFactoryImpl.<init>(MetadataImplementor, SessionFactoryOptions, QueryPlanCache$QueryPlanCreator) line: 327	
	FastBootEntityManagerFactoryBuilder.build() line: 74	
	FastBootHibernatePersistenceProvider.createEntityManagerFactory(String, Map) line: 67	
	Persistence.createEntityManagerFactory(String, Map) line: 80	
	Persistence.createEntityManagerFactory(String) line: 55	
	JPAConfig$LazyPersistenceUnit.get() line: 149	
	JPAConfig$1.run() line: 58	
	Thread.run() line: 829	

I guess if we could set a threadlocal indicating we’re in SchemaDropperImpl.doDrop with a setting of drop-and-create and perhaps in DEV mode, then I could filter these out, but it would need more than LogFilterBuildItem which can only match on prefixes, not on logic. I could also filter it out from org.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.

0reactions
yrodierecommented, Jun 21, 2022

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found