I'm having trouble using a log4net FileAppender
with mono. If I spawn the processess in the background (i.e. mono MyApp.exe &
), the process suspends after a short period of time. If I run the process in the foreground, the logger works correctly.
On the other hand, if I use a ConsoleAppender
and redirect it (i.e. mono MyApp.exe > debug.log &
), things are fine.
Here is my configuration for the application:
<appender name="debug-log" type="log4net.Appender.FileAppender">
<file value="debug.log" />
<appendToFile value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-8timestamp [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<appender name="console" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-8timestamp [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" /开发者_JS百科>
<appender-ref ref="debug-log" />
</root>
I am using the mono-specific version of the log4net assembly.
EDIT
Mono version: 2.10.1
I just noticed another interesting behavior... I am able to use the FileAppender
to write to the debug-log as long as I redirect stdout
anywhere. For example, if I start my process using the following:
mono MyApp.exe > /dev/null &
The process executes normally, writing to the debug-log. In this case, I am only using the debug-log, not the console appender. Using the same configuration, the process will suspend after writing a small amount of data to debug-log when I remove the redirect.
精彩评论