2022

Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Every AppCode should log the Open, Read, Write and Set Context operations so that the results can be visible in the DBSync LogViewer. Note that DBSync runs in the scheduled batch mode so to view the results, it is importint to view the LogViewer which shows the log traces for all the syncs completed and running 

To add the Logger we need to add the following code: 

1. In the Service class which implements ApiCode ,import java.util.Logger

2. Instantiate the Logger instance, static Logger logger = Logger.getLogger(MyDummyService.class.getName());

3. For logging the normal execution you need to use LogLevel as info. E.g in the Read, Write and open methods, we need to keep a log trace.logger.log(Level.INFO, "MyDummyService.readMyFirst Called: for Query:" + filter.name);

4. For logging unhandled errors which could be unhandled exception, we need to use the LogLevel as SEVERE. In this case e is the exception thrown.logger.log(Level.SEVERE, "Error while executing method MyDummyService:readMyFirst", e);

5. In case of write operation, there are scenarios where the integration runs partially with some errors while the sync process. In such a situation it is important that we return the errors as a SaveResult error rather than just logging it as an exception. E.g. The below snippet of code shows how to handle an empty input list error

  • No labels