Logging
The native module framework offers several ways for logging similar to the one of the Server Code Module .
The "model" object (and every object of the type " AbstractClientDataModel ") provides a variety of log...() methods in each hook class.
To log an error simply use for example myModelInstance.logError( "Error Message", logAsync ); within your native module code.
Alternatively you can alsolog messages directly from module scope.
An example call is MyModule.AOM.log( request.getApplicationName(), "My Output", logAsync ); .
All available logging methods have an additional boolean parameter logAsync since version 2.5, to give you the possibility to log the message asynchronously. The message will be added to a logging queue internally and a periodically running job will add these methods to the log output. Note that these messages may not be in the correct order and thus may not help you to trace a problem while developing your module, but it may improve the performance of your module. The periodical log timer will run every 30 seconds by default; this can be changed using the logTaskPeriodInSeconds setting in the config file.
Another performance improvement may be the configuration of asynchronous loggers in the log4j2.xml of your installation. You can learn more about that on log4j's offical documentation.
The following entry within the log4j2.xml defines the module logging configuration:
<Logger name=
"com.apiomat.backend.persistence.LogEntry"
level=
"trace"
additivity=
"false"
>
<AppenderRef ref=
"CONSOLE"
/>
</Logger>
In addition to the server log, the output is visible through the logging console which can be accessed in the Dashboard by clicking the
symbol in the upper right corner.
The logging level within the log4j2.xml defines which logging messages will be displayed in the logging console.
Besides the development with log outputs there is the possibility of remote debugging.