Skip to content

Commit

Permalink
Configures logging with daily rolling file, closes #347
Browse files Browse the repository at this point in the history
  • Loading branch information
tdziurko committed Apr 1, 2017
1 parent e36fbd2 commit f775c47
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -222,4 +222,8 @@ dist/
nbdist/
nbactions.xml
.nb-gradle/
.nb-gradle-properties
.nb-gradle-properties

### Manual entries ###

logs
1 change: 1 addition & 0 deletions docker-compose.yml
Expand Up @@ -20,6 +20,7 @@ services:
volumes:
- /etc/localtime:/etc/localtime:ro
- /usr/share/zoneinfo/Europe/Warsaw:/etc/timezone:ro
- /home/jvm-bloggers/jvm-bloggers/logs:app/logs
- /tmp
links:
- jvm-bloggers-db
Expand Down
35 changes: 35 additions & 0 deletions src/main/resources/logback-spring.xml
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<include resource="org/springframework/boot/logging/logback/base.xml"/>

<property name="LOG_DIR" value="logs"/>
<property name="LOG_FILE" value="jvm-bloggers.log"/>

<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">

<file>${LOG_DIR}/${LOG_FILE}</file>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_DIR}/${LOG_FILE}-%d{yyyy-MM-dd}.log.gz</fileNamePattern>
</rollingPolicy>

<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
</encoder>

</appender>

<root level="INFO">
<appender-ref ref="ROLLING"/>
</root>

<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springframework.transaction" level="INFO"/>

<springProfile name="test,dev">
<logger name="com.jvm_bloggers" level="DEBUG"/>
<logger name="org.hibernate.SQL" level="DEBUG"/>
</springProfile>

</configuration>

0 comments on commit f775c47

Please sign in to comment.