How to use log4net FileAppender under mono when running in the background?

I'm having problems using log4net FileAppender with mono. If I create a procession in the background (i.e. mono MyApp.exe & ), the process pauses after a short period of time. If I run the process in the foreground, the log works correctly.

On the other hand, if I use ConsoleAppender and redirect it (i.e. mono MyApp.exe > debug.log & ), everything is 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" /> <appender-ref ref="debug-log" /> </root> 

I am using a mono-specific version of the log4net assembly.

EDIT

Mono version: 2.10.1

I noticed another interesting behavior ... I can use 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 runs fine by writing to the debug log. In this case, I use only the debug log, not the console appender. Using the same configuration, the process will be suspended after writing a small amount of data to debug-log when deleting the redirect.

+7
source share

All Articles