From 0f940b36d7a89257694ed85639f1a89c4eb2a35a Mon Sep 17 00:00:00 2001 From: Peter-Josef Meisch Date: Fri, 10 Jul 2020 21:19:11 +0200 Subject: [PATCH] DATAES-883 - Fix log level on resource load error. Original PR: #493 --- .../data/elasticsearch/core/ReactiveResourceUtil.java | 4 ++-- .../data/elasticsearch/core/ResourceUtil.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/data/elasticsearch/core/ReactiveResourceUtil.java b/src/main/java/org/springframework/data/elasticsearch/core/ReactiveResourceUtil.java index 423eaa5f..ee0abf55 100644 --- a/src/main/java/org/springframework/data/elasticsearch/core/ReactiveResourceUtil.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/ReactiveResourceUtil.java @@ -65,13 +65,13 @@ public abstract class ReactiveResourceUtil { sink.next(sb.toString()); sink.complete(); } catch (Exception e) { - LOGGER.debug(String.format("Failed to load file from url: %s: %s", url, e.getMessage())); + LOGGER.warn(String.format("Failed to load file from url: %s: %s", url, e.getMessage())); sink.complete(); } finally { DataBufferUtils.release(it); } }).onErrorResume(throwable -> { - LOGGER.debug(String.format("Failed to load file from url: %s: %s", url, throwable.getMessage())); + LOGGER.warn(String.format("Failed to load file from url: %s: %s", url, throwable.getMessage())); return Mono.empty(); }); } diff --git a/src/main/java/org/springframework/data/elasticsearch/core/ResourceUtil.java b/src/main/java/org/springframework/data/elasticsearch/core/ResourceUtil.java index 17973223..852ae3bd 100644 --- a/src/main/java/org/springframework/data/elasticsearch/core/ResourceUtil.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/ResourceUtil.java @@ -38,8 +38,8 @@ public abstract class ResourceUtil { /** * Read a {@link ClassPathResource} into a {@link String}. * - * @param url - * @return + * @param url url the file url + * @return the contents of the file or null if it could not be read */ @Nullable public static String readFileFromClasspath(String url) { @@ -48,7 +48,7 @@ public abstract class ResourceUtil { try (InputStream is = classPathResource.getInputStream()) { return StreamUtils.copyToString(is, Charset.defaultCharset()); } catch (Exception e) { - LOGGER.debug(String.format("Failed to load file from url: %s: %s", url, e.getMessage())); + LOGGER.warn(String.format("Failed to load file from url: %s: %s", url, e.getMessage())); return null; } }