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
| Field | Type | Required | Description |
|---|
level | string | Yes | Log level for Edge Server logs (see Log Levels below) |
console_logs | string | Yes | Console log destination: std_out, std_err, or off |
rotating_logs | object/null | No | Configuration 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:
| Level | Description | Use Case |
|---|
error | Only critical errors | Production environments |
warning | Warnings and errors (default) | Normal operation |
info | Informational messages | Basic monitoring |
debug | Detailed debugging information | Development and troubleshooting |
verbose | Maximum detail including internal operations | Deep 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
| Field | Type | Default | Description |
|---|
directory | string | Required | Path to the directory where rotating log files should be stored. Relative paths are relative to the config file location |
prefix | string | "edge-server.log" | Prefix for log file names. Must match pattern ^[a-zA-Z0-9_\-]+[a-zA-Z0-9_\-]$ |
rotation_frequency | string | "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:
| Value | Description |
|---|
std_out | Write logs to standard output (default) |
std_err | Write logs to standard error |
off | Disable 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
-
Start with
warning level: Use the default warning level for normal operation.
-
Use
debug for troubleshooting: When investigating issues, temporarily increase to debug level.
-
Avoid
verbose: The verbose level should only be used for short periods during debugging.
-
Configure rotating logs for production: Use the
rotating_logs configuration to manage log file sizes and retention.
-
Centralize logs: In production, consider shipping logs to a centralized logging system for analysis.
-
Use environment variables: Override log levels using the
EDGE_SERVER_LOG environment variable for temporary debugging without config changes.