Logging

Here, you can find a detailed description on how to use built-in logging functionality.


The Dataspace Connector provides multiple ways for logging and accessing information.

Static Configuration

You may configure logging setting in the log4j2.xml at src/main/resources. There, you will find the different loggers and the target outputs used within the Dataspace Connector.

To change the logging level of the Dataspace Connector, modify the attribute level of the logger named io.dataspaceconnector. The different values of logging level can be found here.

<Logger name="io.dataspaceconnector" level="info">
    <AppenderRef ref="ConsoleAppender"/>
</Logger>

The AppenderRef of the logger controls the output of the log. Add or remove elements of type AppenderRef to add additional outputs or remove existing ones.

The Dataspace Connector offers preconfigured appenders. For logging to console use ConsoleAppender or to file use RollingFile as values for the ref attribute.

<Logger name="io.dataspaceconnector" level="debug">
    <AppenderRef ref="ConsoleAppender"/>
    <AppenderRef ref="RollingFile"/>
</Logger>

To add additional logging outputs or change the logging format consult here or for more information see here.

Runtime Configuration

The Dataspace Connector allows the modification of logging levels at runtime. To enable this feature, you will need to locate application.properties under src/main/resources.

Enable or add the following lines:

management.endpoints.web.exposure.include=loggers
management.endpoint.loggers.enabled=true

A list of all available loggers and their current logging level will be exposed under /actuator/loggers.

To change the logging level at runtime, you will need to perform a POST request against the logger. Here is an example using curl:

curl -i -k -X POST -H 'Content-Type: application/json'
    -d '{"configuredLevel": "OFF"}' https://localhost:8080/actuator/loggers/io.dataspaceconnector

Remote Access

To get remote access to the log file, find the application.properties at src/main/resources. By default, the Dataspace Connector disables all optional endpoints.

Enable or add the following lines:

management.endpoints.web.exposure.include=logfile
management.endpoint.logfile.enabled=true
management.endpoint.logfile.external-file=./log/dataspaceconnector.log

The logfile will be available by performing a pull request on /actuator/logfile.

For more information, see here.