question

Upvotes
Accepted
2 0 1 5

How to capture below error in java code? Always receiving timeout exception in java.

1635963585628.png

elektron-sdkema-apijava-8
1635963585628.png (68.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
82.7k 279 53 77

@bmahajan

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());
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1636115233792.png


@Jirapongse

Thank-you so much!

You solution worked for me and i managed to display error messages in log4j2 generated log files.


1636115233792.png (67.4 KiB)
Upvotes
18.6k 85 39 63

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?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.