You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Mark Womack <mw...@bevocal.com> on 2002/03/07 02:14:18 UTC

[SUBMIT] ServerSocketAppender.java

Enclosed is a new appender, ServerSocketAppender.java.  Please consider it
for inclusion in the log4j project.  If there are concerns with the source
or design, please let me know so I can correct them.

ServerSocketAppender borrows heavily from the SocketAppender, and the code
will look remarkably the same.  But instead of connecting to a remote
socket, ServerSocketAppender creates a ServerSocket object and then accepts
any number of connections by remote clients.  When a log event is to be
appended, the event is sent to the set of current connections.  If an error
is encountered sending the event, the connection is dropped.  No attempt is
made to reconnect since it is the responsibility of the client to make the
connection to begin with.

Why ServerSocketAppender?  If you have a group of developers accessing the
same logging event source server, each one will need their own
SocketAppender defined to pump log events to their client.  Add another
developer, add another SocketAppender.  With ServerSocketAppender, you set
up the appender once, let everyone know the port number and then have their
clients connect to it when ever they want to.  It is always there, ready to
send you log events.  It also conserves socket ports since you only need one
port instead of a port per SocketAppender.

I am working on modifications to Chainsaw so that it can actively initiate
connections with ServerSocketAppenders instead of only passively accept
connections from SocketAppenders.  Then you could use it to connect to any
number of sources.

If you have any questions, or concerns, please let me know.

thanks,
-Mark


Re: [SUBMIT] ServerSocketAppender.java

Posted by Robert Bushman <bo...@traxel.com>.
On Thu, 7 Mar 2002, Niclas Hedhman wrote:

>
> Great idea.
> Had a quick look, and saw the ObjectOutputStream (I have not looked at
> the SocketAppender) and thought; why?
>
> Text output would be much more practical. Telnet to the port, and the
> log messages arrives, formatted and ready...
>
> Am I missing something here?

Not necessarily. If what you prefer is text ouput,
what you describe is the ideal solution, and I think
TelnetAppender is already included with the 1.2
beta.

OTOH, I think the idea of this one is to be able
to access the event objects, which can then be
redirected to a local handler (EG to a local
RollingFileAppender, or for display in a GUI
tool, like Lumbermill). In fact, if and when
I ever have a free moment from my job again :(,
I was going to write the exact same thing.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] ServerSocketAppender.java

Posted by Niclas Hedhman <ni...@ewarna.com>.
Great idea.
Had a quick look, and saw the ObjectOutputStream (I have not looked at 
the SocketAppender) and thought; why?

Text output would be much more practical. Telnet to the port, and the 
log messages arrives, formatted and ready...

Am I missing something here?

Niclas

Mark Womack wrote:

>Enclosed is a new appender, ServerSocketAppender.java.  Please consider it
>for inclusion in the log4j project.  If there are concerns with the source
>or design, please let me know so I can correct them.
>
>ServerSocketAppender borrows heavily from the SocketAppender, and the code
>will look remarkably the same.  But instead of connecting to a remote
>socket, ServerSocketAppender creates a ServerSocket object and then accepts
>any number of connections by remote clients.  When a log event is to be
>appended, the event is sent to the set of current connections.  If an error
>is encountered sending the event, the connection is dropped.  No attempt is
>made to reconnect since it is the responsibility of the client to make the
>connection to begin with.
>
>Why ServerSocketAppender?  If you have a group of developers accessing the
>same logging event source server, each one will need their own
>SocketAppender defined to pump log events to their client.  Add another
>developer, add another SocketAppender.  With ServerSocketAppender, you set
>up the appender once, let everyone know the port number and then have their
>clients connect to it when ever they want to.  It is always there, ready to
>send you log events.  It also conserves socket ports since you only need one
>port instead of a port per SocketAppender.
>
>I am working on modifications to Chainsaw so that it can actively initiate
>connections with ServerSocketAppenders instead of only passively accept
>connections from SocketAppenders.  Then you could use it to connect to any
>number of sources.
>
>If you have any questions, or concerns, please let me know.
>
>thanks,
>-Mark
>
>
>------------------------------------------------------------------------
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
> ServerSocketAppender.java
>
> Content-Type:
>
> application/octet-stream
> Content-Encoding:
>
> quoted-printable
>
>
> ------------------------------------------------------------------------
> Part 1.3
>
> Content-Type:
>
> text/plain
>
>


Re: [SUBMIT] ServerSocketAppender.java

Posted by Gary Udstrand <gb...@completeis.com>.
    I took a different approach to the same problem.  In my case I wrote a
UDPMulticastAppender for log4j and modified chainsaw to read and display
these messages.  Advantages are that anyone on the subnet is able to join
the multicast group and view the server log messages.  In our particular
case we have clustered servers (Weblogic) that are all able to broadcast to
a single port to be read and combined by Chainsaw.

    I am in the process of adding the ability to change the port and the
multicast address in Chainsaw so that I am able to switch between our
dev/test/vendor/prod areas and watch the system log messages in real time
without having to stop and reconfigure Chainsaw.

    Since UDP is not secure I plan on adding some level of encryption to the
packets to prevent just anyone from viewing the data in a prod environment.

    I am not sure that I am quite ready to distribute this Appender on this
list but if there is enough interest I will.

Thanks
-Gary


----- Original Message -----
From: "Mark Womack" <mw...@bevocal.com>
To: "Log4j-Dev (E-mail)" <lo...@jakarta.apache.org>
Sent: Wednesday, March 06, 2002 7:14 PM
Subject: [SUBMIT] ServerSocketAppender.java


> Enclosed is a new appender, ServerSocketAppender.java.  Please consider it
> for inclusion in the log4j project.  If there are concerns with the source
> or design, please let me know so I can correct them.
>
> ServerSocketAppender borrows heavily from the SocketAppender, and the code
> will look remarkably the same.  But instead of connecting to a remote
> socket, ServerSocketAppender creates a ServerSocket object and then
accepts
> any number of connections by remote clients.  When a log event is to be
> appended, the event is sent to the set of current connections.  If an
error
> is encountered sending the event, the connection is dropped.  No attempt
is
> made to reconnect since it is the responsibility of the client to make the
> connection to begin with.
>
> Why ServerSocketAppender?  If you have a group of developers accessing the
> same logging event source server, each one will need their own
> SocketAppender defined to pump log events to their client.  Add another
> developer, add another SocketAppender.  With ServerSocketAppender, you set
> up the appender once, let everyone know the port number and then have
their
> clients connect to it when ever they want to.  It is always there, ready
to
> send you log events.  It also conserves socket ports since you only need
one
> port instead of a port per SocketAppender.
>
> I am working on modifications to Chainsaw so that it can actively initiate
> connections with ServerSocketAppenders instead of only passively accept
> connections from SocketAppenders.  Then you could use it to connect to any
> number of sources.
>
> If you have any questions, or concerns, please let me know.
>
> thanks,
> -Mark
>
>


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] ServerSocketAppender.java

Posted by Ceki Gülcü <ce...@qos.ch>.
Contrary to others, I don't get it. I'll read the code to see whether I' 
understand
any better. Regards, Ceki

At 17:14 06.03.2002 -0800, you wrote:
>Enclosed is a new appender, ServerSocketAppender.java.  Please consider it
>for inclusion in the log4j project.  If there are concerns with the source
>or design, please let me know so I can correct them.
>
>ServerSocketAppender borrows heavily from the SocketAppender, and the code
>will look remarkably the same.  But instead of connecting to a remote
>socket, ServerSocketAppender creates a ServerSocket object and then accepts
>any number of connections by remote clients.  When a log event is to be
>appended, the event is sent to the set of current connections.  If an error
>is encountered sending the event, the connection is dropped.  No attempt is
>made to reconnect since it is the responsibility of the client to make the
>connection to begin with.
>
>Why ServerSocketAppender?  If you have a group of developers accessing the
>same logging event source server, each one will need their own
>SocketAppender defined to pump log events to their client.  Add another
>developer, add another SocketAppender.  With ServerSocketAppender, you set
>up the appender once, let everyone know the port number and then have their
>clients connect to it when ever they want to.  It is always there, ready to
>send you log events.  It also conserves socket ports since you only need one
>port instead of a port per SocketAppender.
>
>I am working on modifications to Chainsaw so that it can actively initiate
>connections with ServerSocketAppenders instead of only passively accept
>connections from SocketAppenders.  Then you could use it to connect to any
>number of sources.
>
>If you have any questions, or concerns, please let me know.
>
>thanks,
>-Mark

--
Ceki Gülcü


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [SUBMIT] ServerSocketAppender.java

Posted by Ceki Gülcü <ce...@qos.ch>.
Hi March,

I finally get it. The SocketAppender/SocketServer combination is designed for
a setting with multiple log sources but one viewer. The ServertSocketAppender
is intended for situations with one log source but multiple viewers. Correct?

In the SocketAppender/SocketServer combination the SocketServer can be
configured to fan out input to multiple destinations based on a config file
placed on the SocketServer side but your approach is obviously more dynamic.

All in all, very cool. More comments inline.

At 17:14 06.03.2002 -0800, Mark Womack wrote:
>Enclosed is a new appender, ServerSocketAppender.java.  Please consider it
>for inclusion in the log4j project.  If there are concerns with the source
>or design, please let me know so I can correct them.
>
>ServerSocketAppender borrows heavily from the SocketAppender, and the code
>will look remarkably the same.  But instead of connecting to a remote
>socket, ServerSocketAppender creates a ServerSocket object and then accepts
>any number of connections by remote clients.  When a log event is to be
>appended, the event is sent to the set of current connections.

Right.

>If an error is encountered sending the event, the connection is 
>dropped.  No attempt is
>made to reconnect since it is the responsibility of the client to make the
>connection to begin with.

Makes sense.

>Why ServerSocketAppender?  If you have a group of developers accessing the
>same logging event source server, each one will need their own
>SocketAppender defined to pump log events to their client.  Add another
>developer, add another SocketAppender.  With ServerSocketAppender, you set
>up the appender once, let everyone know the port number and then have their
>clients connect to it when ever they want to.  It is always there, ready to
>send you log events.

The above paragraph was essential for my understanding.

>It also conserves socket ports since you only need one
>port instead of a port per SocketAppender.

Well... the total number of opened connected is identical in both 
architectures.
Not an excessively strong argument imho.

>I am working on modifications to Chainsaw so that it can actively initiate
>connections with ServerSocketAppenders instead of only passively accept
>connections from SocketAppenders.  Then you could use it to connect to any
>number of sources.

Good. Let me know how it goes. Cheers, Ceki

ps: Thanks for the neat contribution by the way!



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>