Frank-readresolve / itp3-dist-arch

Projet de groupe, architecture distribuée
3 stars 0 forks source link

Study- How to setup logging #35

Open msimplon opened 1 year ago

msimplon commented 1 year ago

Setup logging (apps 1 and 2 APIs)

Related issues: #1, #4

Dev environment

Prod environment

Basically, you just need to specify the following two lines in the application.properties file to enable daily rolling files logging:

First, you have to specify the file name

_Here, the first property specifies the original log file name, and the second one specifies the pattern for the files which will be rolled out the next days (daily rolling). In the pattern, I append date format %d{yyyy-MM-dd} and the ordinal number of the log file (%i) to the file name (MyApp-)_

You can also specify a threshold for log file size using the following property

You can control the total size of all log files under a specified number, by using the following property:

Optional :

logging.file.clean-history-on-start=true

So when our Spring Boot application starts, Logback will clean the old log files based on the values of total size and max history. This property is set to false by default.

Source : https://www.codejava.net/frameworks/spring-boot/logback-rolling-files-example