Bug 324486 (MONO81811) - [PATCH] Log4net Remoting appender don't work with mono
Summary: [PATCH] Log4net Remoting appender don't work with mono
Status: RESOLVED FIXED
Alias: MONO81811
Product: Mono: Runtime
Classification: Mono
Component: remoting (show other bugs)
Version: 1.2
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Lluis Sanchez
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-05 19:12 UTC by Hubert FONGARNAND
Modified: 2007-09-15 21:24 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
LogServer.tar.gz (381.76 KB, application/octet-stream)
2007-06-05 19:14 UTC, Thomas Wiest
Details
bug-81811.diff (1009 bytes, patch)
2007-06-05 21:47 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:40:52 UTC


---- Reported by informatique.internet@fiducial.fr 2007-06-05 12:12:38 MST ----

Description of Problem:
I try to use to log4net RemotingAppender with mono (in order to create a
centralised log server for all our web applications)


Steps to reproduce the problem:
1. Create a simple RemotingAppender 
    <appender name="RemotingAppender"
type="log4net.Appender.RemotingAppender" >
	    <sink value="tcp://localhost:1234/LoggingSink" />
	    <lossy value="false" />
	    <bufferSize value="1" />
	    <onlyFixPartialEventData value="true" />
	</appender>
2. Create the server
3. 

Actual Results:

log4net:ERROR XmlHierarchyConfigurator: Could not create Appender
[RemotingAppen
der] of type [log4net.Appender.RemotingAppender]. Reported error follows.
System.Runtime.Remoting.RemotingException: Cannot create channel sink to
connect
 to URL tcp://localhost:1234/LoggingSink. An appropriate channel has
probably no
t been registered.
  at System.Runtime.Remoting.RemotingServices.GetClientChannelSinkChain
(System.
String url, System.Object channelData, System.String& objectUri) [0x0003e]
in /h
ome/hubert/mono/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs:674
 
  at System.Runtime.Remoting.RemotingServices.GetOrCreateClientIdentity
(System.
Runtime.Remoting.ObjRef objRef, System.Type proxyType, System.Object&
clientProx
y) [0x0001e] in
/home/hubert/mono/mcs/class/corlib/System.Runtime.Remoting/Remot
ingServices.cs:613 
  at System.Runtime.Remoting.RemotingServices.GetRemoteObject
(System.Runtime.Re
moting.ObjRef objRef, System.Type proxyType) [0x00000] in
/home/hubert/mono/mcs/
class/corlib/System.Runtime.Remoting/RemotingServices.cs:726 
  at System.Runtime.Remoting.RemotingServices.Connect (System.Type
classToProxy,
 System.String url, System.Object data) [0x00009] in
/home/hubert/mono/mcs/class
/corlib/System.Runtime.Remoting/RemotingServices.cs:183 
  at System.Activator.GetObject (System.Type type, System.String url,
System.Obj
ect state) [0x00012] in
/home/hubert/mono/mcs/class/corlib/System/Activator.cs:3
02 
  at log4net.Appender.RemotingAppender.ActivateOptions () [0x0001c] in
/home/hub
ert/Librairies DotNet/log4net/src/Appender/RemotingAppender.cs:148 
  at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender
(System
.Xml.XmlElement appenderElement) [0x0019a] in /home/hubert/Librairies
DotNet/log
4net/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs:329 
Expected Results:


How often does this happen? 
always

Additional Information:
it works well on MS.NET 1.1 it should works too with mono...
See the attached monodevelop solution test case!



---- Additional Comments From informatique.internet@fiducial.fr 2007-06-05 12:14:02 MST ----

Created an attachment (id=172108)
LogServer.tar.gz




---- Additional Comments From informatique.internet@fiducial.fr 2007-06-05 12:15:15 MST ----

the error is : Cannot create channel sink to connect to URL



---- Additional Comments From robertj@gmx.net 2007-06-05 14:13:13 MST ----

Hubert, if you have the sources, open the file which contains
the class RemotingAppender and replace ActivateOptions ()
with this:

public override void ActivateOptions()
{
    base.ActivateOptions();
    m_sinkObj = (IRemoteLoggingSink)
Activator.GetObject(typeof(IRemoteLoggingSink), m_sinkUrl);
}

 
The hashtable used by log4net as "channelData" is apparently
incompatible with mono:

    IDictionary state = new Hashtable();
    state["typeFilterLevel"] = "Full";
    m_sinkObj = (IRemoteLoggingSink) 
        Activator.GetObject(typeof(IRemoteLoggingSink), m_sinkUrl, state);

I'm uncertain if this is correct even on MS.NET, but it
seems to work there.

Am looking at this.




---- Additional Comments From robertj@gmx.net 2007-06-05 14:47:43 MST ----

Created an attachment (id=172109)
bug-81811.diff




---- Additional Comments From robertj@gmx.net 2007-06-05 14:49:31 MST ----

We need the old hack (see comment) only when channelData is a
IChannelDataStore, otherwise there is no way for the channel
to obtain the URI.




---- Additional Comments From lluis@ximian.com 2007-06-05 15:22:16 MST ----

The patch looks ok to me.



---- Additional Comments From robertj@gmx.net 2007-06-05 16:06:14 MST ----

Fixed in SVN r78667.




---- Additional Comments From informatique.internet@fiducial.fr 2007-06-06 06:25:02 MST ----

Thanks a lot for the fix, it works well for me

Could this patch be backported to the mono 1.2.4 branch... I've seen
that is trivial, and with this i could get log4net working on our
production server...

Imported an attachment (id=172108)
Imported an attachment (id=172109)