Finally, Apache log4net made to run on MonoTouch iOS. It's a work in progress, alpha quality code base. Please help me by reporting and fixing bugs!
Because MonoTouch doesn't support System.Configuration, you must use a plain xml configuration file, and include it as a bundled resource. The file watch feature is also removed. Lastly, the following appenders are working.
Logs to Xamarin Studio application output when debugging. Also logs to Apple System Log (but only at the Warning level), so they show up in the device console.
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
Logs to the application caches directory. Log file can be downloaded using the Xcode Organizer.
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="log/log-file.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
Logs to the application caches directory. Log files can be downloaded using the Xcode Organizer.
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log/log-file.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
Logs to Apple System Log with the corresponding levels. Unfortunately, ASL will filter out INFO and DEBUG level entries. Therefore only use this appender for severity of WARN and above.
<appender name="LocalSyslogAppender" type="log4net.Appender.LocalSyslogAppender">
<facility value="Local6" />
<identity value="MyApp" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
Logs to a remote server using UDP protocol.
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
<remoteAddress value="127.0.0.1" />
<remotePort value="8080" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
Logs to a remote syslogd server.
<appender name="RemoteSyslogAppender" type="log4net.Appender.RemoteSyslogAppender">
<identity value="MyApp" />
<remoteAddress value="127.0.0.1" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>