The native module framework offers several ways for logging.
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.log( Level.ERROR, "Error Message", logAsync ); within your native module code.
Alternatively you can also log messages directly from module scope.
An example call is MyModule.AOM.log( Level.INFO, "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:
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.
Starting with version 3.1 all log methods have an additional parameter logLevel to control which log level should be used. The available log levels are:
Besides the development with log outputs there is the possibility of remote debugging.