You can create a custom log handler to catch these log events. For more information, please refer to the answer in this thread.
Logger rootLogger = LogManager.getLogManager().getLogger(""); rootLogger.addHandler(new MyLogHandler());
Thank-you so much!
You solution worked for me and i managed to display error messages in log4j2 generated log files.
Hi @bmahajan
Have you been able to successfully connect at all? I ask because you seem to be connecting to a provider on localhost:14023 - are you starting up your own server? Have you tried connecting into an ADS? Also, do you want to solve the issue of failing to connect? Or do you want to know how to capture and process events within your application? Or both?
@nick.zincone
Hi Nick
Thanks for the reply!
I am successfully connected i do not have any connection issues.
It is a fail test requested by client. In case when server is down application tries to connect all possible host/channels defined in config xml file. Just want to capture the channel down event on log file generated by log4j2.xml. But when i call create consumer i only receive timeout exception did not get any info about the channels like on which channel it tries to connect and status of that channel.
Let me know if it is not clear!
Great - thanks for the clarification @bmahajan. @Jirapongse provided a code snippet below that outlines how to capture the log details, via the logger, within your application.