You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/07/16 04:37:28 UTC

[2/3] git commit: CAMEL-6551 RemoteFileConsumer uust writing the warning message at the first time.

CAMEL-6551 RemoteFileConsumer uust writing the warning message at the first time.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3b03fb9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3b03fb9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3b03fb9

Branch: refs/heads/master
Commit: f3b03fb9336072675f1d44b74a11577a0f8ca929
Parents: 19c966b
Author: Willem Jiang <ni...@apache.org>
Authored: Tue Jul 16 10:35:24 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Tue Jul 16 10:35:24 2013 +0800

----------------------------------------------------------------------
 .../camel/component/file/remote/RemoteFileConsumer.java  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f3b03fb9/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
index e347c7d..39e23ce 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
@@ -28,6 +28,7 @@ import org.apache.camel.component.file.GenericFileOperationFailedException;
  */
 public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
     protected boolean loggedIn;
+    protected boolean loggedInWarning;
 
     public RemoteFileConsumer(RemoteFileEndpoint<T> endpoint, Processor processor, RemoteFileOperations<T> operations) {
         super(endpoint, processor, operations);
@@ -66,10 +67,16 @@ public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
 
         if (!loggedIn) {
             String message = "Cannot connect/login to: " + remoteServer() + ". Will skip this poll.";
-            log.warn(message);
+            if (!loggedInWarning) {
+                log.warn(message);
+                loggedInWarning = true;
+            } 
             return false;
+        } else {
+            // need to log the failed log again
+            loggedInWarning = false;
         }
-
+       
         return true;
     }
 


Re: [2/3] git commit: CAMEL-6551 RemoteFileConsumer uust writing the warning message at the first time.

Posted by Willem jiang <wi...@gmail.com>.
Hi Claus,

I'm sorry, I just saw the mail today.  

The patch is for avoiding writing the same warning message again and again. It is annoying as we already see the warning at the first time.
If the route doesn't work, we could be able to trace the warning message easily.

The loggedInWarning flag will be reset if the connection is OK, so we will not miss the warning message if the connection is lost again.

If we use the back off setting, we will not be able to retry the connection in a short time period if the max limit is very high.

Any thoughts?  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem


Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Sunday, July 28, 2013 at 1:20 AM, Claus Ibsen wrote:

> Hi
>  
> Any comment to this? I really think this is the wrong way of a
> solution, as mentioned in previous email.
>  
>  
> On Wed, Jul 17, 2013 at 9:05 AM, Claus Ibsen <claus.ibsen@gmail.com (mailto:claus.ibsen@gmail.com)> wrote:
> > Hi
> >  
> > I dont think this "improvement" is a good idea.
> >  
> > Instead we have a ticket about allow to configure the scheduled poll
> > consumers with backoff settings, so if there has been no succesfull
> > polls after X time then the polling can backoff (eg slow down). So in
> > this case with the "cannot connect" we could use the backoff to slow
> > down so it does not run so frequently.
> > https://issues.apache.org/jira/browse/CAMEL-6071
> > https://issues.apache.org/jira/browse/CAMEL-4876
> >  
> > There is monitoring tools that do log parsing. And with no more WARNs
> > being logged the tooling can't detect that there is a problem still.
> >  
> > I would like this change to be reverted as I think its wrong to hide
> > the problem, and only log it once. And we do not do this in other
> > components, so this will just take people by surprise that its
> > "special" for ftp consumer only.
> >  
> > On Tue, Jul 16, 2013 at 4:37 AM, <ningjiang@apache.org (mailto:ningjiang@apache.org)> wrote:
> > > CAMEL-6551 RemoteFileConsumer uust writing the warning message at the first time.
> > >  
> > >  
> > > Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> > > Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3b03fb9
> > > Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3b03fb9
> > > Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3b03fb9
> > >  
> > > Branch: refs/heads/master
> > > Commit: f3b03fb9336072675f1d44b74a11577a0f8ca929
> > > Parents: 19c966b
> > > Author: Willem Jiang <ningjiang@apache.org (mailto:ningjiang@apache.org)>
> > > Authored: Tue Jul 16 10:35:24 2013 +0800
> > > Committer: Willem Jiang <ningjiang@apache.org (mailto:ningjiang@apache.org)>
> > > Committed: Tue Jul 16 10:35:24 2013 +0800
> > >  
> > > ----------------------------------------------------------------------
> > > .../camel/component/file/remote/RemoteFileConsumer.java | 11 +++++++++--
> > > 1 file changed, 9 insertions(+), 2 deletions(-)
> > > ----------------------------------------------------------------------
> > >  
> > >  
> > > http://git-wip-us.apache.org/repos/asf/camel/blob/f3b03fb9/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
> > > ----------------------------------------------------------------------
> > > diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
> > > index e347c7d..39e23ce 100644
> > > --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
> > > +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
> > > @@ -28,6 +28,7 @@ import org.apache.camel.component.file.GenericFileOperationFailedException;
> > > */
> > > public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
> > > protected boolean loggedIn;
> > > + protected boolean loggedInWarning;
> > >  
> > > public RemoteFileConsumer(RemoteFileEndpoint<T> endpoint, Processor processor, RemoteFileOperations<T> operations) {
> > > super(endpoint, processor, operations);
> > > @@ -66,10 +67,16 @@ public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
> > >  
> > > if (!loggedIn) {
> > > String message = "Cannot connect/login to: " + remoteServer() + ". Will skip this poll.";
> > > - log.warn(message);
> > > + if (!loggedInWarning) {
> > > + log.warn(message);
> > > + loggedInWarning = true;
> > > + }
> > > return false;
> > > + } else {
> > > + // need to log the failed log again
> > > + loggedInWarning = false;
> > > }
> > > -
> > > +
> > > return true;
> > > }
> >  
> >  
> >  
> >  
> >  
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
>  
>  
>  
>  
>  
> --  
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen




Re: [2/3] git commit: CAMEL-6551 RemoteFileConsumer uust writing the warning message at the first time.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Any comment to this? I really think this is the wrong way of a
solution, as mentioned in previous email.


On Wed, Jul 17, 2013 at 9:05 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> I dont think this "improvement" is a good idea.
>
> Instead we have a ticket about allow to configure the scheduled poll
> consumers with backoff settings, so if there has been no succesfull
> polls after X time then the polling can backoff (eg slow down). So in
> this case with the "cannot connect" we could use the backoff to slow
> down so it does not run so frequently.
> https://issues.apache.org/jira/browse/CAMEL-6071
> https://issues.apache.org/jira/browse/CAMEL-4876
>
> There is monitoring tools that do log parsing. And with no more WARNs
> being logged the tooling can't detect that there is a problem still.
>
> I would like this change to be reverted as I think its wrong to hide
> the problem, and only log it once. And we do not do this in other
> components, so this will just take people by surprise that its
> "special" for ftp consumer only.
>
> On Tue, Jul 16, 2013 at 4:37 AM,  <ni...@apache.org> wrote:
>> CAMEL-6551 RemoteFileConsumer uust writing the warning message at the first time.
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3b03fb9
>> Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3b03fb9
>> Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3b03fb9
>>
>> Branch: refs/heads/master
>> Commit: f3b03fb9336072675f1d44b74a11577a0f8ca929
>> Parents: 19c966b
>> Author: Willem Jiang <ni...@apache.org>
>> Authored: Tue Jul 16 10:35:24 2013 +0800
>> Committer: Willem Jiang <ni...@apache.org>
>> Committed: Tue Jul 16 10:35:24 2013 +0800
>>
>> ----------------------------------------------------------------------
>>  .../camel/component/file/remote/RemoteFileConsumer.java  | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/camel/blob/f3b03fb9/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
>> ----------------------------------------------------------------------
>> diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
>> index e347c7d..39e23ce 100644
>> --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
>> +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
>> @@ -28,6 +28,7 @@ import org.apache.camel.component.file.GenericFileOperationFailedException;
>>   */
>>  public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
>>      protected boolean loggedIn;
>> +    protected boolean loggedInWarning;
>>
>>      public RemoteFileConsumer(RemoteFileEndpoint<T> endpoint, Processor processor, RemoteFileOperations<T> operations) {
>>          super(endpoint, processor, operations);
>> @@ -66,10 +67,16 @@ public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
>>
>>          if (!loggedIn) {
>>              String message = "Cannot connect/login to: " + remoteServer() + ". Will skip this poll.";
>> -            log.warn(message);
>> +            if (!loggedInWarning) {
>> +                log.warn(message);
>> +                loggedInWarning = true;
>> +            }
>>              return false;
>> +        } else {
>> +            // need to log the failed log again
>> +            loggedInWarning = false;
>>          }
>> -
>> +
>>          return true;
>>      }
>>
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: [2/3] git commit: CAMEL-6551 RemoteFileConsumer uust writing the warning message at the first time.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I dont think this "improvement" is a good idea.

Instead we have a ticket about allow to configure the scheduled poll
consumers with backoff settings, so if there has been no succesfull
polls after X time then the polling can backoff (eg slow down). So in
this case with the "cannot connect" we could use the backoff to slow
down so it does not run so frequently.
https://issues.apache.org/jira/browse/CAMEL-6071
https://issues.apache.org/jira/browse/CAMEL-4876

There is monitoring tools that do log parsing. And with no more WARNs
being logged the tooling can't detect that there is a problem still.

I would like this change to be reverted as I think its wrong to hide
the problem, and only log it once. And we do not do this in other
components, so this will just take people by surprise that its
"special" for ftp consumer only.

On Tue, Jul 16, 2013 at 4:37 AM,  <ni...@apache.org> wrote:
> CAMEL-6551 RemoteFileConsumer uust writing the warning message at the first time.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3b03fb9
> Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3b03fb9
> Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3b03fb9
>
> Branch: refs/heads/master
> Commit: f3b03fb9336072675f1d44b74a11577a0f8ca929
> Parents: 19c966b
> Author: Willem Jiang <ni...@apache.org>
> Authored: Tue Jul 16 10:35:24 2013 +0800
> Committer: Willem Jiang <ni...@apache.org>
> Committed: Tue Jul 16 10:35:24 2013 +0800
>
> ----------------------------------------------------------------------
>  .../camel/component/file/remote/RemoteFileConsumer.java  | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/camel/blob/f3b03fb9/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
> ----------------------------------------------------------------------
> diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
> index e347c7d..39e23ce 100644
> --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
> +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
> @@ -28,6 +28,7 @@ import org.apache.camel.component.file.GenericFileOperationFailedException;
>   */
>  public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
>      protected boolean loggedIn;
> +    protected boolean loggedInWarning;
>
>      public RemoteFileConsumer(RemoteFileEndpoint<T> endpoint, Processor processor, RemoteFileOperations<T> operations) {
>          super(endpoint, processor, operations);
> @@ -66,10 +67,16 @@ public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
>
>          if (!loggedIn) {
>              String message = "Cannot connect/login to: " + remoteServer() + ". Will skip this poll.";
> -            log.warn(message);
> +            if (!loggedInWarning) {
> +                log.warn(message);
> +                loggedInWarning = true;
> +            }
>              return false;
> +        } else {
> +            // need to log the failed log again
> +            loggedInWarning = false;
>          }
> -
> +
>          return true;
>      }
>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen