Override server logging level with environment variable (#653)

Use `LOG_LEVEL` environment variable to override logging level for `emu.grasscutter` (which also contains all loggers under it). This might help with debugging various issues reported by users. Previously, the only way to override these levels would be to use `-Dlogback.configurationFile`
This commit is contained in:
HotaruYS 2022-05-08 12:48:06 +02:00 committed by GitHub
parent 3a5503de72
commit 7c35c51a6a

View File

@ -1,4 +1,6 @@
<Configuration> <Configuration>
<variable name="LOG_LEVEL" value="${LOG_LEVEL:-INFO}" />
<appender name="STDOUT" class="emu.grasscutter.utils.JlineLogbackAppender"> <appender name="STDOUT" class="emu.grasscutter.utils.JlineLogbackAppender">
<encoder> <encoder>
<pattern>[%d{HH:mm:ss}] [%highlight(%level)] %msg%n</pattern> <pattern>[%d{HH:mm:ss}] [%highlight(%level)] %msg%n</pattern>
@ -14,11 +16,12 @@
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss'Z'} - %m%n</pattern> <pattern>%d{yyyy-MM-dd'T'HH:mm:ss'Z'} - %m%n</pattern>
</encoder> </encoder>
</appender> </appender>
<logger name="org.reflections" level="OFF"/>
<logger name="org.reflections" level="OFF" />
<logger name="emu.grasscutter" level="${LOG_LEVEL}" />
<root level="INFO"> <root level="INFO">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
<appender-ref ref="FILE" /> <appender-ref ref="FILE" />
</root> </root>
<logger name="emu.grasscutter.scripts.ScriptLib" level="DEBUG">
</logger>
</Configuration> </Configuration>