Skip to content

Please don't override log4j configuration in IDE #27

@ForNeVeR

Description

@ForNeVeR

While investigating #22, we've found the root cause of the issue: it's the log.xml configuration file which is loaded by the LuaLoggerManager component:

final VirtualFile logXml = LuaFileUtil.getPluginVirtualDirectoryChild("log.xml");
File logXmlFile = new File(logXml.getPath());
String text = FileUtil.loadFile(logXmlFile);
text = StringUtil.replace(text, SYSTEM_MACRO, StringUtil.replace(PathManager.getSystemPath(), "\\", "\\\\"));
text = StringUtil.replace(text, APPLICATION_MACRO, StringUtil.replace(PathManager.getHomePath(), "\\", "\\\\"));
text = StringUtil.replace(text, LOG_DIR_MACRO, StringUtil.replace(PathManager.getLogPath(), "\\", "\\\\"));
new DOMConfigurator().doConfigure(new StringReader(text), LogManager.getLoggerRepository());

(note that, while this component is disabled in the source code of the plugin, it is, nevertheless, enabled in the plugin builds uploaded to the Marketplace, which I've already reported as #26)

This log.xml configures the following appender:

IDLua/include/log.xml

Lines 5 to 13 in ffc0589

<appender name="CONSOLE-WARN" class="org.apache.log4j.ConsoleAppender">
<param name="target" value="System.err"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%7r] %6p - %30.30c - %m \n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="WARN"/>
</filter>
</appender>

This appender just passes logs with WARN level to the process' stderr.

At the same time, Rider (for reasons beyond the scope of current investigation) has a special mechanism that does a reverse thing: takes its stderr and passes back to logger.

So, any log with the WARN level will get passed to the logger, which will try to write it into stderr, which will get mirrored back to the logger, etc. etc., which will either cause a stack overflow or out of memory error (we've encountered both during the investigation).

While this particular issue will likely be fixed in Rider 2021.1, it isn't recommended to change the IDE log settings from the plugin. Instead of that, please use the IDE logging system as-is and use the IDE debug log settings (available in Help → Diagnostic Tools → Debug Log Settings… main menu item) if you want to enable / disable logging on the go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions