1
votes

How can I log all exceptions in mobilefirst 8.0 java adapters ?

I need to get that log at Analytics Console.

1

1 Answers

1
votes

MobileFirst Foundation provides a logger function. Logs that are logged with the mechanism that MobileFirst Foundation provides can be forwarded to the Analytics server.

If you can tunnel "all exceptions" via the provided Logger functionality, good. Otherwise you'll need to customize your exceptions output to use the provided Logger.

To forward logs to the Analytics server, follow these instructions: https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/adapters/server-side-log-collection/java-adapter/

Import the java logging package:

import java.util.logging.Logger;

Define a logger:

static Logger logger = Logger.getLogger(JavaLoggerTestResource.class.getName());

Use the logger for your future logging activities.

In MobileFirst Operations Console select the Settings option from the sidebar navigation.

Click the Edit button in the Runtime Properties tab.
In the Analytics → Additional packages section, specify the class name of the Java adapter, for example com.sample.JavaLoggerTestResource, to forward logs to the MobileFirst Server.