Skip to content

Commit

Permalink
Fix log4net console appender on unix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
rquinio committed Jul 21, 2018
1 parent 01a0cea commit 40f4ac6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
6 changes: 6 additions & 0 deletions PortraitBuilder/Parser/PortraitReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ private void Parse(string filename, PortraitData data) {
logger.Error(string.Format("File not found: {0}", filename));
return;
}
// Exclude vanilla files with known errors
if(filename.EndsWith("DefaultDialog.gfx") || filename.EndsWith("EU3_mapitems.gfx") || filename.EndsWith("chatfonts.gfx")
|| filename.EndsWith("fonts.gfx") || filename.EndsWith("mapitems.gfx")) {
logger.Info(string.Format("Skipping parsing of file: {0}", filename));
return;
}

StreamReader stream = new StreamReader(filename, Encoding.GetEncoding(1252));
string fileContent = stream.ReadToEnd();
Expand Down
21 changes: 16 additions & 5 deletions PortraitBuilder/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,26 @@
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
<appender name="ConsoleAppender" type="log4net.Appender.ManagedColoredConsoleAppender">
<mapping>
<level value="FATAL" />
<foreColor value="Red" />
</mapping>
<mapping>
<level value="ERROR"/>
<foreColor value="White"/>
<backColor value="Red, HighIntensity"/>
<foreColor value="Red"/>
</mapping>
<mapping>
<level value="WARN"/>
<backColor value="Yellow"/>
<foreColor value="Yellow" />
</mapping>
<mapping>
<level value="INFO" />
<foreColor value="Gray" />
</mapping>
<mapping>
<level value="DEBUG" />
<foreColor value="DarkBlue" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level %logger - %message%newline"/>
Expand All @@ -27,7 +38,7 @@
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="ColoredConsoleAppender"/>
<appender-ref ref="ConsoleAppender"/>
<appender-ref ref="FileAppender"/>
</root>
</log4net>
Expand Down

0 comments on commit 40f4ac6

Please sign in to comment.