Configuring Logs
Karnak offers the possibility of injecting your own log configuration to customize how logs are generated and stored.
The logging system used by Karnak is Logback. For detailed information about Logback configuration, see the official manual.
Available Variables
The following variables can be used in your custom Logback configuration file to capture specific de-identification context:
| Variable | Description |
|---|---|
| issuerOfPatientID | Issuer of patient ID before de-identification |
| PatientID | Patient ID before de-identification |
| SOPInstanceUID | SOP Instance UID before de-identification |
| DeidentifySOPInstanceUID | SOP Instance UID after de-identification |
| SeriesInstanceUID | Series Instance UID before de-identification |
| DeidentifySeriesInstanceUID | Series Instance UID after de-identification |
| ProjectName | Project name used for de-identification |
| ProfileName | Profile name used for de-identification |
| ProfileCodenames | Concatenated list of profile items applied during de-identification |
For usage examples, see the default Logback configuration.
Inject the Logback Configuration File
Using Docker
Set the environment variable LOGBACK_CONFIGURATION_FILE with the path to your Logback configuration file. This will override the default log configuration.
Example:
If you create a custom configuration file named my-logback.xml in the same directory as your docker-compose.yml:
- Create a volume to mount the file inside the Karnak container
- Define the
LOGBACK_CONFIGURATION_FILEenvironment variable with the container path
Using Java
If you run Karnak directly from the JAR file, add the following parameter at startup: -Dlogging.config=my-logback.xml
Default Logback Configuration
The default logback configuration file supports two operating modes:
Development Mode
- Set the
ENVIRONMENTvariable toDEVto activate this mode - Logs everything at the
INFOlevel by default - Packages
org.karnakandorg.weasisare logged at theDEBUGlevel for detailed troubleshooting
Production Mode
- Active by default (when
ENVIRONMENTis not set toDEV) - Logs everything at the
WARNlevel or higher - Creates two log files:
all.log
Contains:
- All
WARNlevel logs and above org.weasislogs atINFOlevelorg.karnaklogs atINFOlevel (excluding clinical logs)
clinical.log
Contains:
- All logs marked with the
CLINICALmarker - Specifically tracks de-identification operations and clinical data processing
Info
Clinical logs provide detailed tracking of the de-identification process, including which profiles were applied and how patient data was transformed. This is useful for auditing and compliance purposes.