Skip to main content
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:
logging:
  ditto_sdk: debug        # SDK logging level
  edge_server:            # Edge Server logging config
    level: debug
    console_logs: std_out
    rotating_logs: null

resources:
  my_ditto_db:
    resource_type: DittoDatabase
    db_id: "YOUR_APP_ID"
    device_name: "my-device"
    auth:
      # ... auth configuration

Configuration Structure

The logging configuration has two main sections:

ditto_sdk

Global logging level for all Ditto database resources. This controls the verbosity of SDK logs written to stderr.
logging:
  ditto_sdk: warning  # error, warning, info, debug, or verbose
Note: When retrieving log files, the level is permanently set to DEBUG regardless of this setting.

edge_server

Logging configuration for the Edge Server application itself.
logging:
  edge_server:
    level: warning              # Log level (required)
    console_logs: std_out       # Console output destination (required)
    rotating_logs: null         # Optional rotating log file configuration
FieldTypeRequiredDescription
levelstringYesLog level for Edge Server logs (see Log Levels below)
console_logsstringYesConsole log destination: std_out, std_err, or off
rotating_logsobject/nullNoConfiguration for rotating log files (see Rotating Logs below)
Environment Variable Override: Setting EDGE_SERVER_LOG environment variable will override the level configured here.

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)

Rotating Log Files

You can configure Edge Server to automatically rotate log files based on time intervals. This is useful for managing log storage and archiving.
logging:
  edge_server:
    level: debug
    console_logs: std_out
    rotating_logs:
      directory: "./logs"           # Required: Path to log directory
      prefix: "edge-server.log"     # Optional: Log file name prefix (default: "edge-server.log")
      rotation_frequency: Hour      # Optional: Rotation frequency (default: "Hour")

Rotating Logs Configuration

FieldTypeDefaultDescription
directorystringRequiredPath to the directory where rotating log files should be stored. Relative paths are relative to the config file location
prefixstring"edge-server.log"Prefix for log file names. Must match pattern ^[a-zA-Z0-9_\-]+[a-zA-Z0-9_\-]$
rotation_frequencystring"Hour"How often log files rotate: Minute, Hour, Day, or Never

Log File Naming

The rotation frequency affects log file naming with timestamps:
  • Minute: <directory>/<prefix>.yyyy-MM-dd-HH-mm
  • Hour: <directory>/<prefix>.yyyy-MM-dd-HH
  • Day: <directory>/<prefix>.yyyy-MM-dd
  • Never: <directory>/<prefix> (no rotation)

Console Output Destinations

The console_logs field controls where console logs are written:
ValueDescription
std_outWrite logs to standard output (default)
std_errWrite logs to standard error
offDisable console logging

Configuration Examples

Production Configuration

Minimal logging for performance:
logging:
  ditto_sdk: error
  edge_server:
    level: error
    console_logs: std_err
    rotating_logs: null

Development Configuration

Verbose logging with console output:
logging:
  ditto_sdk: debug
  edge_server:
    level: debug
    console_logs: std_out
    rotating_logs: null

Production with Rotating Logs

Balanced logging with file rotation for production monitoring:
logging:
  ditto_sdk: warning
  edge_server:
    level: info
    console_logs: std_out
    rotating_logs:
      directory: "/var/log/edge-server"
      prefix: "edge-server.log"
      rotation_frequency: Day

Troubleshooting Configuration

Maximum verbosity for debugging:
logging:
  ditto_sdk: verbose
  edge_server:
    level: verbose
    console_logs: std_out
    rotating_logs:
      directory: "./debug-logs"
      prefix: "debug.log"
      rotation_frequency: Hour

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. Configure rotating logs for production: Use the rotating_logs configuration to manage log file sizes and retention.
  5. Centralize logs: In production, consider shipping logs to a centralized logging system for analysis.
  6. Use environment variables: Override log levels using the EDGE_SERVER_LOG environment variable for temporary debugging without config changes.