You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/site/markdown/logging.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ To see MyBatis logging statements you may enable logging on a package, a mapper
53
53
54
54
Again, how you do this is dependent on the logging implementation in use. We'll show how to do it with SLF4J(Logback). Configuring the logging services is simply a matter of including one or more extra configuration files (e.g. `logback.xml`) and sometimes a new JAR file. The following example configuration will configure full logging services using SLF4J(Logback) as a provider. There are 2 steps.
55
55
56
-
#### Step 1: Add the SLF4J + Logback JAR files
56
+
#### Step 1: Add the SLF4J + Logback JAR files
57
57
58
58
Because we are using SLF4J(Logback), we will need to ensure its JAR file is available to our application. To use SLF4J(Logback), you need to add the JAR file to your application classpath.
59
59
@@ -69,7 +69,7 @@ If you use the maven, you can download jar files by adding following settings on
69
69
</dependency>
70
70
```
71
71
72
-
#### Step 2: Configure Logback
72
+
#### Step 2: Configure Logback
73
73
74
74
Configuring Logback is simple. Suppose you want to enable the log for this mapper:
75
75
@@ -166,7 +166,7 @@ Yes, as you may have noticed, there is no difference in configuring logging for
166
166
167
167
The remaining configuration in the `logback.xml` file is used to configure the appenders, which is beyond the scope of this document. However, you can find more information at the [Logback](https://logback.qos.ch/) website. Or, you could simply experiment with it to see what effects the different configuration options have.
168
168
169
-
#### Configuration example for Log4j 2
169
+
#### Configuration example for Log4j 2
170
170
171
171
```xml
172
172
<!-- pom.xml -->
@@ -198,7 +198,7 @@ The remaining configuration in the `logback.xml` file is used to configure the a
@@ -334,7 +334,7 @@ Despite all of these powerful options, most of the time you'll simply specify th
334
334
#{lastName}
335
335
```
336
336
337
-
#### String Substitution
337
+
#### String Substitution
338
338
339
339
By default, using the `#{}` syntax will cause MyBatis to generate `PreparedStatement` properties and set the values safely against the `PreparedStatement` parameters (e.g. ?). While this is safer, faster and almost always preferred, sometimes you just want to directly inject an unmodified string into the SQL Statement. For example, for ORDER BY, you might use something like this:
340
340
@@ -648,7 +648,7 @@ In order to inject the results into the constructor, MyBatis needs to identify t
648
648
</constructor>
649
649
```
650
650
651
-
When you are dealing with a constructor with many parameters, maintaining the order of arg elements is error-prone.
651
+
When you are dealing with a constructor with many parameters, maintaining the order of arg elements is error-prone.
652
652
Since 3.4.3, by specifying the name of each parameter, you can write arg elements in any order. To reference constructor parameters by their names, you can either add `@Param` annotation to them or compile the project with '-parameters' compiler option and enable `useActualParamName` (this option is enabled by default). The following example is valid for the same constructor even though the order of the second and the third parameters does not match with the declared order.
0 commit comments