Basic Configuration
Add logging configuration to your YAML config file at the top-level root: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.
edge_server
Logging configuration for the Edge Server application itself.
Environment Variable Override: Setting
EDGE_SERVER_LOG environment variable will override the level configured here.
Log Levels
Available log levels from least to most verbose: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.Rotating Logs Configuration
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
Theconsole_logs field controls where console logs are written:
Configuration Examples
Production Configuration
Minimal logging for performance:Development Configuration
Verbose logging with console output:Production with Rotating Logs
Balanced logging with file rotation for production monitoring:Troubleshooting Configuration
Maximum verbosity for debugging:Docker Logs
To persist logs between container restarts, mount the persistence directory:Best Practices
-
Start with
warninglevel: Use the default warning level for normal operation. -
Use
debugfor 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_logsconfiguration 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_LOGenvironment variable for temporary debugging without config changes.
Related Resources
- Ditto SDK Logging - Advanced logging features for the underlying Ditto SDK