exceptionfactory commented on a change in pull request #5555:
URL: https://github.com/apache/nifi/pull/5555#discussion_r758642358



##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseCEF.java
##########
@@ -339,7 +351,7 @@ public void process(OutputStream out) throws IOException {
             session.transfer(flowFile, REL_SUCCESS);
         } catch (CEFHandlingException e) {
             // The flowfile has failed parsing & validation, routing to 
failure and committing
-            getLogger().error("Failed to parse {} as a CEF message due to {}; 
routing to failure", new Object[] {flowFile, e});
+            getLogger().error("Failed to parse {} as a CEF message due to {}; 
routing to failure", new Object[] {flowFile, e}, e);

Review comment:
       The error logging could also be adjusted to avoid repeating the 
exception:
   ```suggestion
               getLogger().error("Reading CEF Event Failed: {}", flowFile, e);
   ```

##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseCEF.java
##########
@@ -262,12 +273,13 @@ public void process(final InputStream in) throws 
IOException {
             // validator failed to identify an invalid Locale
             final Locale parcefoneLocale = 
Locale.forLanguageTag(context.getProperty(DATETIME_REPRESENTATION).getValue());
             final boolean validateData = 
context.getProperty(VALIDATE_DATA).asBoolean();
-            event = parser.parse(buffer, validateData, parcefoneLocale);
+            final boolean acceptEmptyExtensions = 
context.getProperty(ACCEPT_EMPTY_EXTENSIONS).asBoolean();
+            event = parser.parse(buffer, validateData, acceptEmptyExtensions, 
parcefoneLocale);
 
         } catch (Exception e) {
             // This should never trigger but adding in here as a fencing 
mechanism to
             // address possible ParCEFone bugs.
-            getLogger().error("Parser returned unexpected Exception {} while 
processing {}; routing to failure", new Object[] {e, flowFile});
+            getLogger().error("Parser returned unexpected Exception {} while 
processing {}; routing to failure", new Object[] {e, flowFile}, e);

Review comment:
       The wrapping `new Object[]{ ... }` can be removed, and now that the 
exception stack will be logged, what do you think about adjusting the message 
itself to avoid repeating the exception message?
   
   ```suggestion
               getLogger().error("CEF Parsing Failed: {}", flowFile, e);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to