@@ -553,40 +553,57 @@ Slick uses a logging interface called [SLF4J][link-slf4j]. We can configure this
553
553
<logger name =" slick.jdbc.JdbcBackend.statement" level =" DEBUG" />
554
554
```
555
555
556
- This causes Slick to log every query, even modifications to the schema:
556
+ This causes Slick to log every query, including modifications to the schema:
557
557
558
558
```
559
559
DEBUG slick.jdbc.JdbcBackend.statement - Preparing statement:
560
560
delete from "message" where "message"."sender" = 'HAL'
561
561
```
562
562
563
- We can change the level of various loggers, as shown in the table below:
563
+ We can change the level of various loggers, as shown in the table below.
564
564
565
- ------------------------------------------------------------------------------------------------------------------------
566
- Logger Effect
567
- ------------------------------------------------------------ ----------------------------------------------------------
568
- ` slick.jdbc.JdbcBackend.statement ` Logs SQL sent to the database as described above .
565
+ -----------------------------------------------------------------------------------------------------------------------------
566
+ Logger Will log...
567
+ ----------------------------------------------------------------- ----------------------------------------------------------
568
+ ` slick.jdbc.JdbcBackend.statement ` SQL sent to the database.
569
569
570
- ` slick.jdbc.StatementInvoker.result ` Logs the first few results of each query.
570
+ ` slick.jdbc.JdbcBackend.parameter ` Parameters passed to a query.
571
571
572
- ` slick.session ` Logs session events such as opening/closing connections .
572
+ ` slick.jdbc.StatementInvoker.result ` The first few results of each query .
573
573
574
- ` slick ` Logs everything! Equivalent to changing all of the above.
575
- ------------------------------------------------------------ ----------------------------------------------------------
574
+ ` slick.session ` Session events such as opening/closing connections.
575
+
576
+ ` slick ` Everything!
577
+ ----------------------------------------------------------------- ----------------------------------------------------------
576
578
577
579
: Slick loggers and their effects.
578
580
579
- The ` StatementInvoker.result ` logger, in particular, is pretty cute:
581
+ The ` StatementInvoker.result ` logger, in particular, is pretty cute.
582
+ Here's an example from running a select query:
580
583
581
584
```
582
- SI. result - /--------+----------------------+----\
583
- SI. result - | sender | content | id |
584
- SI. result - +--------+----------------------+----+
585
- SI. result - | HAL | Affirmative, Dave... | 2 |
586
- SI. result - | HAL | I'm sorry, Dave. ... | 4 |
587
- SI. result - \--------+----------------------+----/
585
+ result - /--------+----------------------+----\
586
+ result - | sender | content | id |
587
+ result - +--------+----------------------+----+
588
+ result - | HAL | Affirmative, Dave... | 2 |
589
+ result - | HAL | I'm sorry, Dave. ... | 4 |
590
+ result - \--------+----------------------+----/
588
591
```
589
592
593
+ The combination of ` parameter ` and ` statement ` can show you the values bound to ` ? ` placeholders.
594
+ For example, when adding rows we can see the values being inserted:
595
+
596
+ ```
597
+ statement - Preparing statement: insert into "message"
598
+ ("sender","content") values (?,?)
599
+ parameter - /--------+---------------------------\
600
+ parameter - | 1 | 2 |
601
+ parameter - | String | String |
602
+ parameter - |--------+---------------------------|
603
+ parameter - | Dave | Hello, HAL. Do you rea... |
604
+ parameter - | HAL | I'm sorry, Dave. I'm a... |
605
+ parameter - \--------+---------------------------/
606
+ ```
590
607
591
608
592
609
0 commit comments