Nancy, thanks for the details.  I believe I understand what you are trying
to do.

Yes, it is possible to restrict the set of logging events sent to the remote
client by the SocketHubAppender.  And I think this is a very good use of
SocketHubAppender, btw, given your requirements.

The best method for restricting events that are sent via SocketHubAppender
(or SocketAppender for that matter) is configuring a filter chain on that
appender.  You can see the javadoc information on log4j filters at:

http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/spi/Filter.html

And there are few good examples in the varia package:

http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/varia/package-fram
e.html

But, I have been working on a new package of useful filters for the v1.3
release.  They are fully compatible with v1.2.X.  If I package them up into
a jar file, would you be interested in giving them a try?  They allow full
configuration of a filter chain using almost any set of source criteria you
might want (contents of the message string, contents of the MDC, contents of
the NDC, level of the logger, etc).

And this invitation is for anyone out there that might be interested.

-Mark

> -----Original Message-----
> From: Nancy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 11, 2002 11:14 AM
> To: Log4J Users List
> Subject: Re: questions related to config xml file
> 
> 
> Hi,Mark:
> 
> Thank you so much for your reply.
> 
> Sorry for not providing enough information.
> 
> The following is the description of what I am attemping to accomplish:
> We have developed a web application. Now I am developing a 
> swing application
> which is used to monitor some major activities (such as place 
> orders, login,
> logout and etc.) happened in the web application. The 
> connection between the
> swing application and the web application is initialized by the swing
> application(I mean when a system admin clicks the connect 
> button on the
> swing user interface). After the connection is established, 
> whenever users
> login, logout, or place orders in the web application, the 
> swing application
> should IMMEDIATELY detects them, and display the appropriate 
> message(Such as
> "user has place an order", "user has login the web site"). 
> After doing some
> study on log4j api, we decided to use SocketHubAppender in the web
> application to accomplish the senario.
> 
> 
> I am using xml formate to config the configuration file. The 
> following is
> what I configured in the configuration file: (I omitted the 
> parts that are
> not related to the senario):
> ...
> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
>    .......
>   <!-- for Activity monitor purpose.-->
>     <!-- SocketHubAppender does not use a layout-->
> 
>     <appender name="SOCKET_HUB"
> class="org.apache.log4j.net.SocketHubAppender">
>        <param name="Port" value="7001"/>
>     </appender>
> 
>     <root>
> ....
>     <!-- for Activity monitor purpose. -->
>       <appender-ref ref="SOCKET_HUB" />
>     </root>
> 
> </log4j:configuration>
> 
> 
> Question1:                   What else do I need to config in the
> configuration file?
> Question2:                    I ONLY want SOME activities to use
> SocketHubAppender,  for instance, activities such as login, 
> logout, place
> orders. How should I do to limit the use of SocketHubAppender 
> only to those
> activities? We have already used logging mechnism for ALL 
> activities for
> general logging purpose(such as logging to file systems, 
> console), and we
> prefer those general logging still exist while add the use 
> SocketHubAppender
> for some activities.
> 
> I tried my best to make the senario and the questions clear. 
> However,  I am
> very glad to explain them in more detail  if you have any confuse.
> 
> Thank you very much for your reply.
> 
> Best regards,
> 
> Nancy
> 
> 
> 
> 
> ----- Original Message -----
> From: "Mark Womack" <[EMAIL PROTECTED]>
> To: "'Log4J Users List'" <[EMAIL PROTECTED]>
> Sent: Thursday, February 06, 2003 12:52 PM
> Subject: RE: questions related to config xml file
> 
> 
> > Nancy,
> >
> > Can you give more detail of what you are trying to accomplish.  The
> > SocketHubAppender does not accept any configuration for the 
> XMLAppender.
> It
> > is just a mechanism to stuff the logging event over a 
> socket to a remote
> > client.  The remote client would be responsible for setting up an
> > XMLAppender for output.
> >
> > -Mark
> >
> > > -----Original Message-----
> > > From: Nancy [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, December 10, 2002 11:54 AM
> > > To: Log4J Users List
> > > Subject: questions related to config xml file
> > >
> > >
> > > Hi:
> > >
> > > I am implementing remote debugging using SocketHubAppender. I
> > > want to use
> > > XML to write the configuration file. I read log4j.dtd, 
> but not fully
> > > understand it. I guess because I am doing remote debugging,
> > > so I need to
> > > config log4j:eventSet, and inside the element, there can be 0-many
> > > log4j:event elements.I tried to find an example on how to
> > > config this, but
> > > unfortunatly, I didn't find. Could you help me on how to 
> config the
> > > configuration file, or point me to a link where there is an
> > > example. Thank
> > > you very much for your help.
> > >
> > > regards,
> > >
> > > Nancy
> > >
> > >
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> > >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to