Created
September 25, 2020 01:35
-
-
Save automationhacks/183d95d202b0065e50ee8bf72ad382e9 to your computer and use it in GitHub Desktop.
Logback logging framework configuration file with console, file and report portal appenders as the possible destination spots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration> | |
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder> | |
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
</encoder> | |
</appender> | |
<root level="debug"> | |
<appender-ref ref="STDOUT" /> | |
</root> | |
<!-- Rolling file appender to write logs to file as well --> | |
<property name="LOG_FILE" value="LogFile" /> | |
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<file>${LOG_FILE}.log</file> | |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
<!-- daily rollover --> | |
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.gz</fileNamePattern> | |
<!-- keep 30 days' worth of history capped at 3GB total size --> | |
<maxHistory>30</maxHistory> | |
<totalSizeCap>3GB</totalSizeCap> | |
</rollingPolicy> | |
<encoder> | |
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> | |
</encoder> | |
</appender> | |
<root level="info"> | |
<appender-ref ref="FILE" /> | |
</root> | |
<!-- Adds report portal appender to logback and allows it to all the logs to the test method --> | |
<appender name="ReportPortalAppender" class="com.epam.reportportal.logback.appender.ReportPortalAppender"> | |
<encoder> | |
<pattern>%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n</pattern> | |
</encoder> | |
</appender> | |
<root> | |
<appender-ref ref="ReportPortalAppender" /> | |
</root> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment