CAMEL-6637: Beanio should log invalid at DEBUG level if configured to ignore. Thanks to Sam Lewis for the patch.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f099af73 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f099af73 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f099af73 Branch: refs/heads/master Commit: f099af7339a917261938f54e3c4e352ac90064e2 Parents: c7ebd0c Author: Claus Ibsen <davscl...@apache.org> Authored: Wed Aug 14 14:55:55 2013 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Aug 14 14:55:55 2013 +0200 ---------------------------------------------------------------------- .../dataformat/beanio/BeanIODataFormat.java | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f099af73/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java index 75e5ffb..63b8632 100644 --- a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java +++ b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java @@ -163,27 +163,33 @@ public class BeanIODataFormat extends ServiceSupport implements DataFormat, Came @Override public void invalidRecord(InvalidRecordException ex) throws Exception { - LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText()); - - if (!ignoreInvalidRecords) { + String msg = LOG_PREFIX + "InvalidRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText(); + if (ignoreInvalidRecords) { + LOG.debug(msg); + } else { + LOG.warn(msg); throw ex; } } @Override public void unexpectedRecord(UnexpectedRecordException ex) throws Exception { - LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText()); - - if (!ignoreUnexpectedRecords) { + String msg = LOG_PREFIX + "UnexpectedRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText(); + if (ignoreUnexpectedRecords) { + LOG.debug(msg); + } else { + LOG.warn(msg); throw ex; } } @Override public void unidentifiedRecord(UnidentifiedRecordException ex) throws Exception { - LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText()); - - if (!ignoreUnidentifiedRecords) { + String msg = LOG_PREFIX + "UnidentifiedRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText(); + if (ignoreUnidentifiedRecords) { + LOG.debug(msg); + } else { + LOG.warn(msg); throw ex; } }