log4net on Mono

777 views
Skip to first unread message

jakescott

unread,
Mar 9, 2011, 8:48:40 AM3/9/11
to servic...@googlegroups.com
I know this is log4net releated but I am a Linux retard

I notice that for log4net 1.2.10 there are binaries for both net 2.0 and mono 2.0. Should I be using the mono specific dlls? It shouldn't matter as long as I use the appenders that should work on both windows and linux right? e.g the file appender

I am running the app under mod-mono-server4 - Do I need to do anything special in terms of being able to write to directories on Linux like you do in Windows (e.g giving the asp.net worker process access to that directory?

BTW I managed to get the app living at the root path (http://localhost) using a Virtual Host config setup which I generated here http://go-mono.com/config-mod-mono/


Any help would be much appreciated :)
Thanks Jake

jakescott

unread,
Mar 9, 2011, 9:40:10 AM3/9/11
to servic...@googlegroups.com
I can answer this myself after a little bit of playing around I verified that you can do FileAppender logging with either of the log4net dlls mono or net.

I cheated a wee bit and used the File manager to just go and grant all users permission to read and write to a log file that I created.

Now I get to play with MySql using DBLinq and the Mongo driver :)

Cheers
Jake

Demis Bellot

unread,
Mar 9, 2011, 9:59:14 AM3/9/11
to servic...@googlegroups.com, jakescott
Hi Jake,

Sorry for the delayed reply, I was AFK for a few hours.

Yeah I don't think there should be anything prohibiting the use of the Log4Net dlls on MONO. Are you getting this dlls from the https://github.com/ServiceStack/ServiceStack.Logging/ project? I've got 2.10 and 2.9 log4net dlls with adapter projects to work with the logging interfaces in ServiceStack.Interfaces.dll project.

Security in MONO is a lot more straightforward basically all you need is the user that's running apache (which is usually apache) will need write access to the files/folders you need to write to. They should have the executable bit, i.e. 'x' in (rwx) of all the directories leading up to the logging directory as well.

That should be all that's needed.

Cheers,
Demis

jakescott

unread,
Mar 9, 2011, 10:17:38 AM3/9/11
to servic...@googlegroups.com, jakescott
Yeah sweet, I can see log messages from ServiceStack as well as my own. I am using the log4net dlls from ServiceStack.

For example I can see service stack logs:
WARN  ServiceStack.Common.Extensions.IPAddressExtensions [(null)] - MONO does not support NetworkInterface.GetAllNetworkInterfaces(). Could not detect local ip subnets.

Yeah I still need to setup the directories that I want to be able to write to properly, but that should be easy enough.

Thanks
Jake


Demis Bellot

unread,
Mar 9, 2011, 10:27:26 AM3/9/11
to servic...@googlegroups.com
Yeah those logs are there as a reminder that the latest version of MONO still doesn't allow me to inspect the network interfaces using a .NET API. This only impacts the 'Security Attributes' in ServiceStack where you could potentially limit a call of your service to say 'Only be accessible from a local network'. In order to do this, I have to know what IP addresses the server thinks are Internal. Although having said that, this is a rarely used feature so I think I might just take the log warning out and mention this limitation in the ServiceStack+MONO docs.

Cheers,
Demis
Reply all
Reply to author
Forward
0 new messages