Skip to content

Instantly share code, notes, and snippets.

@dalegaspi
Last active January 30, 2019 15:28
Show Gist options
  • Save dalegaspi/48e340e9d0d92264875bdd38672a64f4 to your computer and use it in GitHub Desktop.
Save dalegaspi/48e340e9d0d92264875bdd38672a64f4 to your computer and use it in GitHub Desktop.
A minimal logback.xml file for clojure applications...with colors! 😝
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOGS" value="./logs" />
<appender name="Console"
class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] [%blue(%contextName)] %yellow(%logger{36}): %msg%n%throwable</pattern>
</encoder>
</appender>
<!--
<appender name="RollingFile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOGS}/spring-boot-logger.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
</encoder>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOGS}/archived/app-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
-->
<appender name="Async-Console" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>500</queueSize>
<discardingThreshold>0</discardingThreshold>
<appender-ref ref="Console" />
</appender>
<root level="debug">
<appender-ref ref="Console" />
<!-- async console logging -->
<!--
<appender-ref ref="Async-Console" />
-->
<!-- file logging with rolling based on size/time -->
<!--
<appender-ref ref="RollingFile" />
-->
</root>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment