Skip to content

Commit

Permalink
Add output file for dedicated server logs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Sep 23, 2024
1 parent 646a9ee commit cd594ea
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
File renamed without changes.
51 changes: 51 additions & 0 deletions dedicated/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SoulFire
Copyright (C) 2024 AlexProgrammerDE
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<!-- Disable shutdown hook, because we have our own -->
<Configuration status="warn" shutdownHook="disable">
<Appenders>
<TerminalConsole name="TerminalConsole">
<PatternLayout>
<LoggerNamePatternSelector
disableAnsi="false"
defaultPattern="%highlight{[%d{HH:mm:ss} %level] [%logger{1.*}]: %minecraftFormatting{%msg}%n%xEx}{FATAL=red, ERROR=red, WARN=yellow, INFO=normal, DEBUG=cyan, TRACE=black}">
<!-- SoulFire doesn't need a prefix -->
<PatternMatch key="com.soulfiremc."
pattern="%highlight{[%d{HH:mm:ss} %level] [%logger{1}]: %minecraftFormatting{%msg}%n%xEx}{FATAL=red, ERROR=red, WARN=yellow, INFO=normal, DEBUG=cyan, TRACE=black}"/>
</LoggerNamePatternSelector>
</PatternLayout>
</TerminalConsole>
<RollingRandomAccessFile name="File" fileName="logs/latest.log"
filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz"
immediateFlush="false">
<PatternLayout
pattern="[%d{HH:mm:ss}] [%t/%level] [%logger]: %n%xEx"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<OnStartupTriggeringPolicy/>
</Policies>
</RollingRandomAccessFile>
</Appenders>

<Loggers>
<Root level="info">
<AppenderRef ref="TerminalConsole"/>
<AppenderRef ref="File"/>
</Root>
</Loggers>
</Configuration>

0 comments on commit cd594ea

Please sign in to comment.