You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Ian Dykes <ia...@esendex.com> on 2007/10/25 12:21:45 UTC

UdpAppender uses UdpClient?

Hi,

We're looking to use the RemoteSyslogAppender from a bunch of Windows
services running on the same machine, sending log events to one server
listening to one port.  Looking through the source, RemoteSyslogAppender
inherits from UdpAppender, and UdpAppender uses a UdpClient object.  If
I try to start two applications on the same machine aiming to send log
event to the same remote sys log I get an error saying "only one usage
of socket address is normally permitted".

I've seen this exception before in my own work with sockets, and I got
around it by using a Socket instead of UdpClient, but I suspect you can
set the ExclusiveAddressUse property as well.  I can't see a way of
setting this property through the appender though.

Is there any way I can use multiple UdpAppenders/RemoteSyslogAppenders
sending to the same address/port on the same machine?

Thanks
Ian 

Ian Dykes
Software Developer
Esendex Ltd

T: +44 (0)115 852 5762
F: +44 (0)115 852 5757
Email: ian.dykes@esendex.com
Web: www.esendex.com
Blog: http://devproj20.blogspot.com/

Esendex: Connect and Communicate
 
Confidentiality: This e-mail (and any associated files) is intended only for the use of log4net-user@logging.apache.org and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not log4net-user@logging.apache.org you are hereby notified that any disclosure, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and then delete it from your computer. Messages sent to and from us may be monitored. The views expressed in this message are those of the author Ian Dykes and do not necessarily represent the views of Esendex Ltd.
 
Security: This e-mail and any attachments are believed to be free from any virus but it is the responsibility of the recipient to ensure this is so. E-mail is not a 100% secure communications medium. We recommend you observe this when e-mailing us.
 
Esendex Ltd is a limited company registered in the UK, with company number 04217280 and having its registered office at 32a Stoney Street . Nottingham . NG1 1LL . United Kingdom.
 
[v1.1 EN]

RE: UdpAppender uses UdpClient?

Posted by Ian Dykes <ia...@esendex.com>.
Ahh, that does explain something.  I'll give it a go and see if it
works.

Thanks
Ian 



Ian Dykes
Software Developer
Esendex Ltd

T: +44 (0)115 852 5762
F: +44 (0)115 852 5757
Email: ian.dykes@esendex.com
Web: www.esendex.com
Blog: http://devproj20.blogspot.com/

Esendex: Connect and Communicate
-----Original Message-----

From: Walden H. Leverich [mailto:WaldenL@TechSoftInc.com] 
Sent: 25 October 2007 16:13
To: Log4NET User
Subject: RE: UdpAppender uses UdpClient?

Are you setting the LocalPort for the RemoteSyslogAppender? You
shouldn't be. In the InitializeClientConnection of the UdpAppender you
should see:

       if (this.LocalPort == 0)
        {
            this.Client = new UdpClient();
        }
        else
        {
            this.Client = new UdpClient(this.LocalPort);
        }

If localport is 0 then the client is created w/out a port, so you should
get a random (and unused) one. If you've set the local port, then yes,
the second attempt to open will fail since you've already bound
something to that port.

-Walden

--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@TechSoftInc.com
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)


-----Original Message-----
From: Ian Dykes [mailto:ian.dykes@esendex.com]
Sent: Thursday, October 25, 2007 6:22 AM
To: Log4NET User
Subject: UdpAppender uses UdpClient?

Hi,

We're looking to use the RemoteSyslogAppender from a bunch of Windows
services running on the same machine, sending log events to one server
listening to one port.  Looking through the source, RemoteSyslogAppender
inherits from UdpAppender, and UdpAppender uses a UdpClient object.  If
I try to start two applications on the same machine aiming to send log
event to the same remote sys log I get an error saying "only one usage
of socket address is normally permitted".

I've seen this exception before in my own work with sockets, and I got
around it by using a Socket instead of UdpClient, but I suspect you can
set the ExclusiveAddressUse property as well.  I can't see a way of
setting this property through the appender though.

Is there any way I can use multiple UdpAppenders/RemoteSyslogAppenders
sending to the same address/port on the same machine?

Thanks
Ian 

Ian Dykes
Software Developer
Esendex Ltd

T: +44 (0)115 852 5762
F: +44 (0)115 852 5757
Email: ian.dykes@esendex.com
Web: www.esendex.com
Blog: http://devproj20.blogspot.com/

Esendex: Connect and Communicate
 
Confidentiality: This e-mail (and any associated files) is intended only
for the use of log4net-user@logging.apache.org and may contain
information that is confidential, subject to copyright or constitutes a
trade secret. If you are not log4net-user@logging.apache.org you are
hereby notified that any disclosure, copying or distribution of this
message, or files associated with this message, is strictly prohibited.
If you have received this message in error, please notify us immediately
by replying to the message and then delete it from your computer.
Messages sent to and from us may be monitored. The views expressed in
this message are those of the author Ian Dykes and do not necessarily
represent the views of Esendex Ltd.
 
Security: This e-mail and any attachments are believed to be free from
any virus but it is the responsibility of the recipient to ensure this
is so. E-mail is not a 100% secure communications medium. We recommend
you observe this when e-mailing us.
 
Esendex Ltd is a limited company registered in the UK, with company
number 04217280 and having its registered office at 32a Stoney Street .
Nottingham . NG1 1LL . United Kingdom.
 
[v1.1 EN]

RE: UdpAppender uses UdpClient?

Posted by "Walden H. Leverich" <Wa...@TechSoftInc.com>.
Are you setting the LocalPort for the RemoteSyslogAppender? You
shouldn't be. In the InitializeClientConnection of the UdpAppender you
should see:

       if (this.LocalPort == 0)
        {
            this.Client = new UdpClient();
        }
        else
        {
            this.Client = new UdpClient(this.LocalPort);
        }

If localport is 0 then the client is created w/out a port, so you should
get a random (and unused) one. If you've set the local port, then yes,
the second attempt to open will fail since you've already bound
something to that port.

-Walden

-- 
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@TechSoftInc.com
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)


-----Original Message-----
From: Ian Dykes [mailto:ian.dykes@esendex.com] 
Sent: Thursday, October 25, 2007 6:22 AM
To: Log4NET User
Subject: UdpAppender uses UdpClient?

Hi,

We're looking to use the RemoteSyslogAppender from a bunch of Windows
services running on the same machine, sending log events to one server
listening to one port.  Looking through the source, RemoteSyslogAppender
inherits from UdpAppender, and UdpAppender uses a UdpClient object.  If
I try to start two applications on the same machine aiming to send log
event to the same remote sys log I get an error saying "only one usage
of socket address is normally permitted".

I've seen this exception before in my own work with sockets, and I got
around it by using a Socket instead of UdpClient, but I suspect you can
set the ExclusiveAddressUse property as well.  I can't see a way of
setting this property through the appender though.

Is there any way I can use multiple UdpAppenders/RemoteSyslogAppenders
sending to the same address/port on the same machine?

Thanks
Ian 

Ian Dykes
Software Developer
Esendex Ltd

T: +44 (0)115 852 5762
F: +44 (0)115 852 5757
Email: ian.dykes@esendex.com
Web: www.esendex.com
Blog: http://devproj20.blogspot.com/

Esendex: Connect and Communicate
 
Confidentiality: This e-mail (and any associated files) is intended only
for the use of log4net-user@logging.apache.org and may contain
information that is confidential, subject to copyright or constitutes a
trade secret. If you are not log4net-user@logging.apache.org you are
hereby notified that any disclosure, copying or distribution of this
message, or files associated with this message, is strictly prohibited.
If you have received this message in error, please notify us immediately
by replying to the message and then delete it from your computer.
Messages sent to and from us may be monitored. The views expressed in
this message are those of the author Ian Dykes and do not necessarily
represent the views of Esendex Ltd.
 
Security: This e-mail and any attachments are believed to be free from
any virus but it is the responsibility of the recipient to ensure this
is so. E-mail is not a 100% secure communications medium. We recommend
you observe this when e-mailing us.
 
Esendex Ltd is a limited company registered in the UK, with company
number 04217280 and having its registered office at 32a Stoney Street .
Nottingham . NG1 1LL . United Kingdom.
 
[v1.1 EN]