Edge Server provides comprehensive logging capabilities to help with debugging, monitoring, and troubleshooting. You can control the verbosity of logs and where they are stored.

Basic Configuration

Add logging configuration to your YAML config file at the top-level root:
resources:
  my_ditto_db:
    resource_type: DittoDatabase
    db_id: "YOUR_APP_ID"
    auth:
      # ... auth configuration

logging:
  ditto_log_config:
    level: debug

Log Levels

The verbose log level can significantly impact performance due to the volume of log data generated. Use it only for debugging specific issues, not in production.
Available log levels from least to most verbose:
LevelDescriptionUse Case
errorOnly critical errorsProduction environments
warningWarnings and errors (default)Normal operation
infoInformational messagesBasic monitoring
debugDetailed debugging informationDevelopment and troubleshooting
verboseMaximum detail including internal operationsDeep debugging (may impact performance)

Log Output

Console Output

Logs are written to standard output (stdout) and standard error (stderr) by default. The verbosity is controlled by the configured log level.

File Output

Debug-level logs are automatically saved to disk while the Edge Server is running. These logs are stored in the ditto_logs subdirectory within the persistence directory. Default location:
<persistence_dir>/ditto_logs/

Configuration Examples

Production Configuration

Minimal logging for performance:
logging:
  ditto_log_config:
    level: error

Troubleshooting Configuration

Balanced approach for investigating issues:
logging:
  ditto_log_config:
    level: debug

Docker Logs

To persist logs between container restarts, mount the persistence directory:
docker run --rm -p 127.0.0.1:8080:8080 \
  -v ./quickstart_config.yaml:/config.yaml \
  -v ./data:/data \
  edge-server-quickstart:latest run -c /config.yaml

Best Practices

  1. Start with warning level: Use the default warning level for normal operation.
  2. Use debug for troubleshooting: When investigating issues, temporarily increase to debug level.
  3. Avoid verbose: The verbose level should only be used for short periods during debugging.
  4. Centralize logs: In production, consider shipping logs to a centralized logging system for analysis.

Log Rotation

The Edge Server application does not automatically rotate logs. But the underlying Ditto SDK does, see Logging for more information on log rotation and other logging advanced features.