Лог-файлы

Logfiles are an essential part when it comes to debugging your server and figuring what went wrong. This page contains logfiles from SpongeForge and SpongeVanilla servers including short descriptions.

Configure Logging

Sometimes plugins log messages that the server owner does not need, or the sheer number of messages hide some more important information. In other cases, plugins or the server will log debug messages that normally don’t appear in any logs. This section explains how to configure the logging. It is also possible to configure the logging in a way that splits the logs in two or more separate files. One could be optimized for the moderators that pay attention to their users“ activity/behavior and other logs could be used to monitor plugins that are important to the admins.

Примечание

If you think that a plugin logs too many/few messages or on wrong log levels, please report it to its author.

The simplest way to configure the logging is modifying the log4j2.xml configuration file that will be used by Minecraft/Forge itself. You can find and extract it from the root of the forge-...-universal.jar and minecraft_server.jar. Do NOT edit the file inside the jar.

You can tell log4j2 to use the new config file by adding a start parameter to your server launch script.

java -Dlog4j.configurationFile=log4j2_server.xml -jar server.jar

The default configuration looks similar to the following example.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" packages="com.mojang.util,net.minecraftforge.server.console.log4j">
    <Appenders>
        <TerminalConsole name="Console">
            <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level] [%logger]: %msg%n"/>
        </TerminalConsole>

        <RollingRandomAccessFile name="DebugFile" fileName="logs/debug.log" filePattern="logs/debug-%i.log.gz">
            <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level] [%logger]: %msg%n"/>
            <Policies>
                <OnStartupTriggeringPolicy/>
                <SizeBasedTriggeringPolicy size="200MB"/>
            </Policies>
            <DefaultRolloverStrategy max="5" fileIndex="min"/>
        </RollingRandomAccessFile>
    </Appenders>
    <Loggers>
        <Logger level="info" name="org.spongepowered"/>
        <Logger level="info" name="com.example.mod"/>
        <Root level="all">
            <AppenderRef ref="Console" level="info"/>
            <AppenderRef ref="DebugFile"/>
        </Root>
    </Loggers>
</Configuration>

Примечание

This example lacks some comments that are present in the original, make sure you read them to understand why they are there.

The Appenders section defines the output channels for the log messages. This could be a file, the console, or even a central log collection and analysis server. Read more about configuring appenders here.

The Loggers section defines filters for loggers and to which targets the messages should be forwarded to. This is usually the section you must edit if you want to mute a specific plugin in the logs. Let’s look into this a bit more:

<Logger level="info" name="com.example.mod"/>

This will limit the logs of com.example.mod to info and higher messages. Beware, this affects all output channels and also any logger that is created for a sub-package of the given path. Read more about filters here.

<Root level="all">
    <AppenderRef ref="Console" level="info"/>
    <AppenderRef ref="DebugFile"/>
</Root>

This section configures two output channels. First, the appender called Console with a log level filter of info and higher, and last, the appender called DebugFile. It is recommended to keep at least one logger to a persistent target such as a file for later error search.

Примечание

If you are wondering why your new plugin’s log messages don’t seem to show up: The Console’s log level is configured to be at least info by default which hides your debug messages.

If you don’t want to reconfigure the entire logging, but want to hide a certain plugin from the logs you can also use composite logging options. This can be achieved by referencing both the original logging config and your specialized config that only contains the changed logging options. The following example shows this:

java -Dlog4j.configurationFile=log4j2_server.xml,log4j2_custom.xml -jar server.jar
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Loggers>
        <Logger name="com.example.logspammer" level="off"/>
    </Loggers>
</Configuration>

In this example all logs from the com.example.logspammer package won’t be shown or saved. For debugging purposes, it might be useful to include your plugin’s log messages in the console so you don’t have to tail the debug log. This can be achieved using the following example:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Loggers>
        <Logger name="com.example.newplugin" level="all" additivity="false">
            <AppenderRef ref="Console"/>
            [...]
        </Logger>
    </Loggers>
</Configuration>

Совет

Logging affects performance. If you log too much you might lose a small amount of tps. Also remember that it will become harder to reproduce errors if there are no/incomplete logs available.

Лог-файлы SpongeForge

SpongeForge writes several logfiles to the /logs folder located inside your server’s directory. As of Forge 1.12.2 - 14.23.4.2705 these are:

  1. debug.log

  2. latest.log

debug.log

Примечание

Only a few example lines are shown here. To read the full example log, follow this link: SpongeForge 1.12.2 - 7.1.0-BETA-3126 debug.log file

[main/INFO] [FML]: Forge Mod Loader version 14.23.4.2705 for Minecraft 1.12.2 loading
[main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_162, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_162
[main/DEBUG] [FML]: Java classpath at launch is:
[main/DEBUG] [FML]:     forge-1.12.2-14.23.4.2705-universal.jar
[main/DEBUG] [FML]: Java library path at launch is:
[main/DEBUG] [FML]:     C:\ProgramData\Oracle\Java\javapath

Образец лог-файла указывает, что мы работаем с:

  • Forge 14.23.4.2705 (Version 2705)

  • Java 8 64bit Update 162

  • Windows 10 x64

  • каталог Java был установлен как (см. строку 4)

Предупреждение

In order to run Sponge, you must be running Java 8 Update 20 or above. Older builds or newer Java major versions (like 9 or 10) are not supported.

[main/DEBUG] [FML]: Examining for coremod candidacy spongeforge-1.12.2-2705-7.1.0-BETA-3136.jar
[main/INFO] [FML]: Loading tweaker org.spongepowered.asm.launch.MixinTweaker from spongeforge-1.12.2-2705-7.1.0-BETA-3136.jar

This indicates that SpongeForge 3136 was found and loaded by Forge. For further help regarding the SpongeForge naming scheme, have a look at Название загруженного файла.

latest.log

Примечание

Only a few example lines are shown here. To read the full example log, follow this link: SpongeForge 1521 latest.log

Этот вывод вы увидите в графическом интерфейсе сервера Minecraft.

Лог-файлы SpongeVanilla

latest.log

Примечание

Only a few example lines are shown here. To read the full example log, follow this link: SpongeVanilla 1.12.2-7.1.0-BETA-54 latest.log

Этот вывод вы увидите в графическом интерфейсе сервера Minecraft.

Чтение лог-файлов

Если вы не знаете как читать общие краш-логи, вы найдёте помощь тут, но для начала нам нужен будет краш-лог. Для этого короткого введения мы будем использовать образец краш-лога из статьи Отладка: Пример краш-лога устаревшей версии SpongeForge.

WARNING: coremods are present:
SpongeCoremod (sponge-1.8-1499-2.1DEV-575.jar)
Contact their authors BEFORE contacting forge

Для элементарного понимания лучше получить перевод лога при помощи программы-переводчика. Первое, что мы замечаем, это Предупреждение, что coremods присутствуют. Здесь не о чем беспокоиться, это не ошибка, вего лишь предупреждение для связи с поддержкой Sponge, не Forge.

java.lang.NoClassDefFoundError: org/spongepowered/api/event/game/state/GameStartingServerEvent

Несколько строк ниже это фактическая ошибка. Строки такого вида переводить не надо. В нашем случае это NoClassDefFoundError Если вы не знаете что это значит — загляните на страницу Отладка. Если это распространённая ошибка, то она будет отражена на этой странице. Если нет, то вы всегда можете задать об этом вопрос на нашем форуме! Только убедитесь, что вы предоставляете полный лог ошибки.

К счастью, детали вашей системы будут приведены в нижней части лога ошибки:

Minecraft Version: 1.8
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 515666256 bytes (491 MB) / 782761984 bytes (746 MB) up to 1847590912 bytes (1762 MB)
JVM Flags: 0 total;
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1521 5 mods loaded, 5 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UC     mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UC     FML{8.0.99.99} [Forge Mod Loader] (forge.jar)
UC     Forge{11.14.3.1521} [Minecraft Forge] (forge.jar)
UC     Sponge{1.8-1499-2.1DEV-575} [SpongeForge] (minecraft.jar)
U      Core{unknown} [Core Plugin] (Core.jar)
Loaded coremods (and transformers):
SpongeCoremod (sponge-1.8-1499-2.1DEV-575.jar)

Это означает, что

  • Minecraft 1.8 и Forge версии 1521 был запущен на

  • Java 8 Update 51 (64bit версия), и что

  • 2 дополнительные модификации установлены

    • SpongeForge 1.8-1499-2.1DEV-575 (сборка #575) и

    • Ядро

Примечание

Пожалуйста, обратите внимание, что три других установленных модификации (mcp, FML, Forge) требуются для любого Forge сервера и необходимы для правильной загрузки.

Исходя из этого, можно предположить, что:

  • причиной краша сервера мог стать плагин

  • Версия SpongeForge не совпадает с версией Forge: требуется 1499, установлена 1521

Если вы хотите узнать как решить это — загляните в наш список на странице Отладка.

Распространённые ошибки

О самых распространённых ошибках можно прочесть далее, в статье Отладка.