Thanks for the INFO logging. I like when we log that on startup when
something like that which is often under the covers configured and
people don't know about it, or its set on a JVM argument that people
can't normally see etc.


There is a System.out that snug in there ;)

On Wed, Nov 6, 2013 at 2:49 PM,  <ningji...@apache.org> wrote:
> CAMEL-6933 Polished the logging information
>
>
> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e972555d
> Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e972555d
> Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e972555d
>
> Branch: refs/heads/master
> Commit: e972555d86c182305cd017ef37fb9a09c677d2af
> Parents: 5489a1b
> Author: Willem Jiang <willem.ji...@gmail.com>
> Authored: Wed Nov 6 21:46:55 2013 +0800
> Committer: Willem Jiang <willem.ji...@gmail.com>
> Committed: Wed Nov 6 21:49:28 2013 +0800
>
> ----------------------------------------------------------------------
>  .../camel/converter/jaxp/XmlConverter.java       | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/camel/blob/e972555d/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
> ----------------------------------------------------------------------
> diff --git 
> a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java 
> b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
> index 79e71b9..ca56d24 100644
> --- 
> a/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
> +++ 
> b/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
> @@ -27,6 +27,8 @@ import java.io.Reader;
>  import java.io.StringReader;
>  import java.io.StringWriter;
>  import java.nio.ByteBuffer;
> +import java.util.ArrayList;
> +import java.util.List;
>  import java.util.Map;
>  import java.util.Properties;
>
> @@ -897,6 +899,7 @@ public class XmlConverter {
>
>      protected void setupFeatures(DocumentBuilderFactory factory) {
>          Properties properties = System.getProperties();
> +        List<String> features = new ArrayList<String>();
>          for (Map.Entry<Object, Object> prop : properties.entrySet()) {
>              String key = (String) prop.getKey();
>              if 
> (key.startsWith(XmlConverter.DOCUMENT_BUILDER_FACTORY_FEATURE)) {
> @@ -904,11 +907,25 @@ public class XmlConverter {
>                  Boolean value = Boolean.valueOf((String)prop.getValue());
>                  try {
>                      factory.setFeature(uri, value);
> +                    features.add("feature " + uri + " value " + value);
>                  } catch (ParserConfigurationException e) {
> -                    LOG.warn("DocumentBuilderFactory doesn't support the 
> feature {0} with value {1}, due to {2}.", new Object[]{uri, value, e});
> +                    LOG.warn("DocumentBuilderFactory doesn't support the 
> feature {} with value {}, due to {}.", new Object[]{uri, value, e});
>                  }
>              }
>          }
> +        if (features.size() > 0) {
> +            StringBuffer featureString = new StringBuffer();
> +            // just log the configured feature
> +            for (String feature: features) {
> +                if (featureString.length() != 0) {
> +                    featureString.append(", ");
> +                }
> +                featureString.append(feature);
> +            }
> +            System.out.println(featureString);
> +            LOG.info("DocumenterBuilderFactory has been set with features 
> {{}}.", featureString.toString());
> +        }
> +
>      }
>
>      public DocumentBuilderFactory createDocumentBuilderFactory() {
>



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

Reply via email to