[logback-user] Any advice ? duplicate messages with only a singlelogger in the logger context.

Gibbons, P (Paul) Paul.gibbons at diamond.ac.uk
Sat Apr 12 14:19:14 CEST 2008


Thanks

Yes you understood the situation exactly. I will try to creat a special logger context for the SimpleSocketServer of GP as you suggested which will not resent to VP.

Thanks again for the response

Paul

-----Original Message-----
From: logback-user-bounces at qos.ch on behalf of Ceki Gulcu
Sent: Fri 11-Apr-08 11:40 PM
To: logback users list
Cc: paul at pkami.e7even.com
Subject: Re: [logback-user] Any advice ? duplicate messages with only a singlelogger in the logger context.
 

Hello,

I'd be happy to help. However, I have difficulty following the various
process names. To rephrase, there are 3 processes SP, GP and VP. SP
sends events via SocketAppender to GP and VP. GP also sends events to
VP. Given that GP *resends* the events it receives from SP to VP, the
events generated by SP are duplicated on VP. Does this properly
describe the situation?

You could prevent GP from resending its events by modifying
SimpleSocketServer. BTW, are you using SimpleSocketServer currently?
If so, on the instance of SimpleSocketServer, create a LoggerContext
and configure it to log as you wish but without resending events to
VP.

To configure a LoggerContext see the examples in Chapter 3,

   http://logback.qos.ch/manual/joran.html

In particular, under the section "The same with JoranConfigurator".
In short, it's similar to:

  LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
  try {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.shutdownAndReset();
    configurator.doConfigure(PATH_TO_A_CONFIG_FILE_OF_YOUR_CHOICE);
  } catch (JoranException je) {
    StatusPrinter.print(lc);
  }

I hope I understood the problem correctly. It would also be helpful if
you could describe the code that runs within VP and GP to receive events.


Gibbons, P (Paul) wrote:
> Hi 
> 
> Sorry for putting the phrase 'Any advice?' in the title as of course
> that is the point of an e-mail to this list. However my previous attempt
> to elicit advice was unsuccessful. 
> 
> 
> My setup consists of:
> 
> serverProcess - generates messages which are sent via SocketAppender to
> guiProcess and viewerProcess guiProcess - displays messages received
> from serverProcess and also generates messages which it displays and are
> sent via SocketAppender to viewerProcess viewerProcess - displays
> messages received from guiProcess and serverProcess.
> 
> My problem is that messages generateg by serverProcess appear twice on
> viewerProcess. One instance comes directly from serverProcess and the
> other from guiProcess.
> 
> The guiProcess is treated messages from serverProcess as local messages
> and so sends them via its SocketAppender to the viewerProcess.
> 
> I cannot use filters to prevent the guiProcess SocketAppender resending
> the serverProcesses as the message formats are the same from both the
> serverProcess and guiProcess.
> 
> One option could be to use a different logger context in the guiProcess
> handling of messages it receives from serverProcess. I am not sure of
> how to create a logger context which is not the default logger context
> for the application.
> 
> Can anyone suggest how best to prevent the guiProcess from resending the
> messages it receives from the serverProcess or any other way of
> preventing the duplication of messages appearing on the viewerProcess. I
> suppose I could somehow simply drop a message from being processed on
> the viewerProcess if it is the same as the previous message; I am not
> sure how to do this however.
> 
> 
> Thanks
> 
> 
> 
> Paul
> 
> 
> <DIV><FONT size="1" color="gray">This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
> Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
> Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
> Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
> </FONT></DIV> 
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user

-- 
Ceki Gülcü
QOS.ch is looking to hire talented developers in Switzerland.  If
interested, please contact c e k i @ q o s . c h

_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://qos.ch/mailman/listinfo/logback-user

<DIV><FONT size="1" color="gray">This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
</FONT></DIV> 



More information about the Logback-user mailing list