Loggers
Content Integration Framework provides logging interface
using the slf4j
library. By adding dependency for the
slf4j
library, the plugins can use its API for adding loggers inside
service implementations.
dev-kits
manage
their dependencies using Apache Maven. The following entry is found in the POM
file:<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.26</version>
</dependency>
slf4j-api
to avoid conflict. Once the
required dependency is added, the logger object can be obtained by directly accessing
the slf4j
API.Logger log = LoggerFactory.getLogger(YOUR_CLASS.class);
Alternatively, project Lombok can also be used to get the logger object for your class. Lombok provides @Slf4j annotation, which can be used to inject the earlier mentioned property inside the annotated class. For more information on project Lombok, please visit its official web page.
Additionally, the application logs can be found in AssetPicker/logs
directory under platform home. By default, all the loggers from your plugin will reside
in the common log file configured in
AssetPicker/conf/logging/log4j2.xml file. You can alter the
log4j2.xml configuration file to route your loggers to a
different file, for troubleshooting during development. Configuration of
log4j2
is not part of the scope of this guide. Please refer to the
official documentation of Apache Log4j2 for more information.