-
Notifications
You must be signed in to change notification settings - Fork 0
Log4j Configuration
For this project, logging were configured using Log4j. Configuration can be found in /main/resources.log4j.xml file.
In order to use log4j, first pom.xml
file should be updated. The following dependency should be added:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
`
This will discard the default logger and will use the configured one.
Our configuration can be found in /main/resources/log4j.xml
file. It contains 2 logging appenders: Console and File.
All logs will be printed to the console as well as in logs/application.log
file.
Logs level can be set for each needed logical component.
Next, we logged all incoming requests as well as responses of our application. Log levels on @RestController
classes are set to info
.
Also, we will log suspicious operations on servies, such as getting an entity by unknown id.