RFA Java: How to catch library internal error?

We've seen some unfortunate events with so called API internal errors, meaning those that are unexpected but are caught by the API itself and then reported in the log. Example:

19-Nov-2018 10:29:02.128 SEVERE
[_Default::MPOP1 Session EventQueueGroup]
com.reuters.rfa.internal.connection.rssl.RSSLConnection.processTransportData
com.reuters.rfa.connection.rssl._Default.MPOP1C

Caught internal exception .......
.....

In addition to reporting this to RDC we would also like to programmatically catch these events. How can this be done?

Why? We've seen the application stall in such a situation and it would seem much better to simply exit the application (possibly to let it restart) when something unexpected like that happens. The current functionality, which is to report in the log but then continue as if nothing has happened, is a dangerous path.

Tagged:

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @Lars-at-Addicticks

    From the description, the events appear in the log. Therefore, you can create a custom log handler to catch these log events. You can refer to this example.

    	public class MyLogHandler extends Handler{


    @Override
    public void publish(LogRecord record) {
    // TODO Auto-generated method stub
    System.out.println("### Log "+record.getMessage());
    }


    @Override
    public void flush() {
    // TODO Auto-generated method stub

    }


    @Override
    public void close() throws SecurityException {
    // TODO Auto-generated method stub

    }

    }


    Logger logger = Logger.getLogger("com.reuters.rfa");

    MyLogHandler myLogHandler = new MyLogHandler();
    myLogHandler.setLevel(Level.SEVERE);
    logger.addHandler(myLogHandler);

Answers