Skip to content

Commit

Permalink
Triple the amount of logback configuration because logback irritatingly
Browse files Browse the repository at this point in the history
no longer supports conditionals inside <appender> elements.
  • Loading branch information
uckelman committed Dec 15, 2023
1 parent 429bf87 commit cf4bff2
Showing 1 changed file with 33 additions and 19 deletions.
52 changes: 33 additions & 19 deletions vassal-app/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,42 @@
<conversionRule conversionWord="pid"
converterClass="VASSAL.tools.logging.ProcessIDConverter" />

<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<if condition='property("os.name").toLowerCase().startsWith("windows")'>
<then>
<if condition='property("os.name").toLowerCase().startsWith("windows")'>
<then>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${APPDATA}/VASSAL/vassal-test.log</file>
</then>
<else>
<if condition='property("os.name").toLowerCase().startsWith("mac")'>
<then>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<charset>UTF-8</charset>
<pattern>%date [%pid-%thread] %-5level %logger - %msg%n</pattern>
</encoder>
<prudent>true</prudent>
</appender>
</then>
<else>
<if condition='property("os.name").toLowerCase().startsWith("mac")'>
<then>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${user.home}/Library/Application Support/VASSAL/vassal-test.log</file>
</then>
<else>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<charset>UTF-8</charset>
<pattern>%date [%pid-%thread] %-5level %logger - %msg%n</pattern>
</encoder>
<prudent>true</prudent>
</appender>
</then>
<else>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${user.home}/.VASSAL/vassal-test.log</file>
</else>
</if>
</else>
</if>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<charset>UTF-8</charset>
<pattern>%date [%pid-%thread] %-5level %logger - %msg%n</pattern>
</encoder>
<prudent>true</prudent>
</appender>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<charset>UTF-8</charset>
<pattern>%date [%pid-%thread] %-5level %logger - %msg%n</pattern>
</encoder>
<prudent>true</prudent>
</appender>
</else>
</if>
</else>
</if>

<root level="info">
<appender-ref ref="FILE" />
Expand Down

0 comments on commit cf4bff2

Please sign in to comment.