James,

It should work with any loop, like this:

class A {

Logger loggerA = Logger.getLogger(A.class.getName());

void loop {
   while (true) {
   // some logix  
   ...
   // some verification
   if (condition) {
      loggerA.error("xxx"); // error msg 
   }  
   // sleep for a while...
  }
}

the problem is I have this kind of behavior in many parts of my code,
and I wanted this "error msg" printed only once while the condition is
true, without creating additional conditional variables inside the
code.

is it possible to do it? 

[]'s
Ivan Linhares


ps: I should try Aron solution as well, but it requires some extra coding too


On 5/24/05, James Stauffer <[EMAIL PROTECTED]> wrote:
> Any loop or one specific loop?  If it is one specific loop you could
> configure the logger that it uses.
> 
> On 5/24/05, Ivan Linhares Martins <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I�m using log4j version 1-3 alpha 6, working with Socket and File Appenders.
> >
> > I would like to know if i can prevent repeated messages generated in a
> > loop appearing in files or remote receivers only by configuring Log4j,
> > i.e. not writing additional code. Is it possible?
> >
> > Thanks,
> > Ivan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
> 


-- 
Esta mensagem (incluindo arquivos anexos) cont�m informa��es
confidenciais, privilegiadas ou protegidas por lei. Ela � dirigida
exclusivamente ao seu destinat�rio que a empregar� nos ditames legais.
Se voc� n�o � o destinat�rio desta mensagem, deve imediatamente
destru�-la e advertir o remetente do erro de envio e a destrui��o da
mensagem. Qualquer divulga��o, utiliza��o, dissemina��o ou reprodu��o
(total ou parcial) desta mensagem ou das informa��es nela contidas �
proibida e sujeitar� as san��es criminais a que incorrer, sem preju�zo
de perdas e danos.

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

Reply via email to