exceptionfactory opened a new pull request, #5945:
URL: https://github.com/apache/nifi/pull/5945
#### Description of PR
NIFI-9871 Corrects stack trace logging for extension components to avoid
sending summarized stack trace causes to the SLF4J Logger. This change
preserves the stack trace summary in bulletin messages and avoids writing
duplicate information to application log files.
The `ConnectableTask` includes log wording adjustments to indicate the
difference between termination, failure, and halted because of an uncaught
exception.
The updated `TestSimpleProcessLogger` includes several new test methods to
improve coverage and ensure consistent formatting.
The updated `SimpleProcessLogger` implementation of `ComponentLog` behaves
as follows when logging an error:
1. Bulletin Messages contain a simple message with a summary of causes:
```
ListSFTP[id=d4ee5196-b059-3bab-4416-9f59a45cd7b0] Processing failed:
org.apache.nifi.processors.standard.socket.ClientConnectException: SSH Client
connection failed [192.168.1.1:22]
- Caused by: com.exceptionfactory.socketbroker.BrokeredConnectException:
Proxy Address [/192.168.1.100:8888] connection failed
- Caused by: java.net.NoRouteToHostException: No route to host (Host
unreachable)
```
2. Application Log Messages contain a simple message and full stack trace
without duplicating the summary of causes:
```
2022-04-07 12:30:45,500 ERROR [Timer-Driven Process Thread-7]
o.a.nifi.processors.standard.ListSFTP
ListSFTP[id=d4ee5196-b059-3bab-4416-9f59a45cd7b0] Processing failed
org.apache.nifi.processors.standard.socket.ClientConnectException: SSH
Client connection failed [192.168.1.1:22]
at
org.apache.nifi.processors.standard.ssh.StandardSSHClientProvider.getClient(StandardSSHClientProvider.java:115)
at
org.apache.nifi.processors.standard.util.SFTPTransfer.getSFTPClient(SFTPTransfer.java:598)
at
org.apache.nifi.processors.standard.util.SFTPTransfer.getListing(SFTPTransfer.java:302)
at
org.apache.nifi.processors.standard.util.SFTPTransfer.getListing(SFTPTransfer.java:264)
at
org.apache.nifi.processors.standard.ListFileTransfer.performListing(ListFileTransfer.java:120)
at
org.apache.nifi.processors.standard.ListSFTP.performListing(ListSFTP.java:151)
at
org.apache.nifi.processors.standard.ListFileTransfer.performListing(ListFileTransfer.java:112)
at
org.apache.nifi.processor.util.list.AbstractListProcessor.listByNoTracking(AbstractListProcessor.java:562)
at
org.apache.nifi.processor.util.list.AbstractListProcessor.onTrigger(AbstractListProcessor.java:532)
at
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1283)
at
org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:214)
at
org.apache.nifi.controller.scheduling.AbstractTimeBasedSchedulingAgent.lambda$doScheduleOnce$0(AbstractTimeBasedSchedulingAgent.java:63)
at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.exceptionfactory.socketbroker.BrokeredConnectException: Proxy
Address [/192.168.1.100:8888] connection failed
at
com.exceptionfactory.socketbroker.BrokeredSocket.connect(BrokeredSocket.java:100)
at net.schmizz.sshj.SocketClient.connect(SocketClient.java:138)
at
org.apache.nifi.processors.standard.ssh.StandardSSHClientProvider.getClient(StandardSSHClientProvider.java:112)
... 20 common frames omitted
Caused by: java.net.NoRouteToHostException: No route to host (Host
unreachable)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:607)
at
com.exceptionfactory.socketbroker.BrokeredSocket.connect(BrokeredSocket.java:97)
... 22 common frames omitted
```
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [X] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [X] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA
number you are trying to resolve? Pay particular attention to the hyphen "-"
character.
- [X] Has your PR been rebased against the latest commit within the target
branch (typically `main`)?
- [X] Is your initial contribution a single, squashed commit? _Additional
commits in response to PR reviewer feedback should be made on this branch and
pushed to allow change tracking. Do not `squash` or use `--force` when pushing
to allow for clean monitoring of changes._
### For code changes:
- [X] Have you ensured that the full suite of tests is executed via `mvn
-Pcontrib-check clean install` at the root `nifi` folder?
- [X] Have you written or updated unit tests to verify your changes?
- [X] Have you verified that the full build is successful on JDK 8?
- [ ] Have you verified that the full build is successful on JDK 11?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE` file, including the main
`LICENSE` file under `nifi-assembly`?
- [ ] If applicable, have you updated the `NOTICE` file, including the main
`NOTICE` file found under `nifi-assembly`?
- [ ] If adding new Properties, have you added `.displayName` in addition to
.name (programmatic access) for each of the new properties?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which
it is rendered?
### Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI for
build issues and submit an update to your PR as soon as possible.
--
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]