Development Environment

  • spring-boot-starter-logging (Logback via Slf4j)

application.yml:

logging:
  level:
    org.hibernate.SQL: DEBUG
    # For parameters binding like:
    #2023-08-18 17:37:43.968 TRACE 68737 --- [nio-8080-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [INTEGER] - [1]
    org.hibernate.type.descriptor.sql.BasicBinder: TRACE
    org.hibernate.type.descriptor.sql.BasicExtractor: DEBUG
    # For parameters binding like:
    # 2024-08-13T11:23:53.752-04:00 TRACE 16456 --- [nio-8080-exec-9] org.hibernate.orm.jdbc.bind              : binding parameter (1:VARCHAR) <- []
    org.hibernate.orm.jdbc.bind: TRACE
    org.hibernate.stat: DEBUG
    org.hibernate: INFO

spring:
  jpa:
    properties:
      hibernate:
        format_sql: true


2023-08-18 17:37:43.967 DEBUG 68737 --- [nio-8080-exec-1] org.hibernate.SQL                        : 
    select
        inventory0_.inventory_id as inventor1_12_0_,
        film1_.film_id as film_id1_8_1_,
        rentals2_.rental_id as rental_i1_16_2_,
        inventory0_.film_id as film_id4_12_0_,
        inventory0_.last_update as last_upd2_12_0_,
        inventory0_.store_id as store_id3_12_0_,
        film1_.description as descript2_8_1_,
        film1_.fulltext as fulltext3_8_1_,
        film1_.language_id as languag13_8_1_,
        film1_.last_update as last_upd4_8_1_,
        film1_.length as length5_8_1_,
        film1_.rating as rating6_8_1_,
        film1_.release_year as release_7_8_1_,
        film1_.rental_duration as rental_d8_8_1_,
        film1_.rental_rate as rental_r9_8_1_,
        film1_.replacement_cost as replace10_8_1_,
        film1_.special_features as special11_8_1_,
        film1_.title as title12_8_1_,
        rentals2_.customer_id as customer5_16_2_,
        rentals2_.inventory_id as inventor6_16_2_,
        rentals2_.last_update as last_upd2_16_2_,
        rentals2_.rental_date as rental_d3_16_2_,
        rentals2_.return_date as return_d4_16_2_,
        rentals2_.staff_id as staff_id7_16_2_,
        rentals2_.inventory_id as inventor6_16_0__,
        rentals2_.rental_id as rental_i1_16_0__ 
    from
        public.inventory inventory0_ 
    left outer join
        public.film film1_ 
            on inventory0_.film_id=film1_.film_id 
    left outer join
        public.rental rentals2_ 
            on inventory0_.inventory_id=rentals2_.inventory_id 
    where
        film1_.film_id=?
2023-08-18 17:37:43.968 TRACE 68737 --- [nio-8080-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [INTEGER] - [1]
2023-08-18 17:37:43.994 DEBUG 68737 --- [nio-8080-exec-1] o.h.stat.internal.StatisticsImpl         : HHH000117: HQL: select generatedAlias0 from Inventory as generatedAlias0 left join generatedAlias0.film as generatedAlias1 where generatedAlias1.filmId=:param0, time: 27ms, rows: 24
...
2023-08-18 17:37:44.000  INFO 68737 --- [nio-8080-exec-1] i.StatisticalLoggingSessionEventListener : Session Metrics {
    2440025 nanoseconds spent acquiring 1 JDBC connections;
    0 nanoseconds spent releasing 0 JDBC connections;
    3348960 nanoseconds spent preparing 2 JDBC statements;
    15165190 nanoseconds spent executing 2 JDBC statements;
    0 nanoseconds spent executing 0 JDBC batches;
    0 nanoseconds spent performing 0 L2C puts;
    0 nanoseconds spent performing 0 L2C hits;
    0 nanoseconds spent performing 0 L2C misses;
    0 nanoseconds spent executing 0 flushes (flushing a total of 0 entities and 0 collections);
    18534 nanoseconds spent executing 1 partial-flushes (flushing a total of 0 entities and 0 collections)
}


Production Environment

  • spring-boot-starter-logging (Logback via Slf4j)
logging:
  level:
    org.hibernate: ERROR