Skip to content
On this page

LogFileName

The "LogFileName=" property of our .properties file should contain the name and path of our Logback configuration file. The TSF uses LogBack as its SLF4J implementation.

In our example properties file we had the value: LogFileName=/home/tsfuser/app/conf/global/logback.xml

So, our file would be named: logback.xml

(You can copy this file and adjust as you wish using the 'copy' icon in the upper right corner.)

xml
<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
  <layout class="ch.qos.logback.classic.PatternLayout">
    <Pattern>
    [%15.15t] %d{HH:mm:ss.SSS} %-5level [%20.20c:%-4L] %msg%n
    </Pattern>
  </layout>
  </appender>

  <appender name="FILE-ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
    
    <file>/home/tsfuser/app/log/tsf-sample-app.log</file>
    
    <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
      <fileNamePattern>${LOG_FILEPATH}.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
      <!-- each archived file, size max 10MB -->
      <maxFileSize>10MB</maxFileSize>
      <!-- total size of all archive files, if total size > 20GB, it will delete old archived file -->
      <totalSizeCap>20GB</totalSizeCap>
      <!-- 60 days to keep -->
      <maxHistory>60</maxHistory>
    </rollingPolicy>

    <encoder>
      <pattern>[%15.15t] %d{HH:mm:ss.SSS} %-5level [%20.20c:%-4L] %msg%n</pattern>
    </encoder>
  </appender>

  <logger name="com.tessellation" level="DEBUG" additivity="false">
    <appender-ref ref="FILE-ROLLING"/>
    <appender-ref ref="CONSOLE"/>
  </logger>

  <root level="ERROR">
    <appender-ref ref="FILE-ROLLING"/>
    <appender-ref ref="CONSOLE"/>
  </root>

</configuration>

<-Go back

Created by Team Tessell