Skip to main content

Logging

DeepWiki implements a comprehensive logging system designed for production environments, providing detailed insights into system behavior while maintaining performance and security.

Configuration

Environment Variables

Configure DeepWiki’s logging behavior through environment variables:

Docker Compose Configuration

Log Levels

DeepWiki uses standard log levels with specific meanings:

Debug

Detailed information for diagnosing problems:

Info

General informational messages:

Warn

Warning messages for potentially harmful situations:

Error

Error events that might still allow the application to continue:

File Management

Log File Location

Default log file structure:

Rotation Configuration

Configure log rotation with environment variables or logrotate:

Programmatic Rotation

Docker Logging

Container Logging Strategy

Centralized Logging with Fluentd

Docker Logs Commands

Structured Logging

JSON Log Format

Standard JSON log structure:

Custom Log Formatter

Common Debug Patterns

Request Tracking

Database Query Logging

Error Context Logging

Performance Considerations

Asynchronous Logging

Sampling Strategies

Performance Metrics

Security Best Practices

Data Sanitization

Compliance Logging

Log Aggregation

ELK Stack Integration

Prometheus Integration

Monitoring & Alerting

Alert Rules

Health Check Logging

Dashboard Integration

Best Practices

  1. Use Structured Logging: Always log in JSON format for easy parsing
  2. Include Context: Add request IDs, user IDs, and session IDs to all logs
  3. Avoid Blocking: Use asynchronous logging in production
  4. Sanitize Data: Never log passwords, tokens, or sensitive personal data
  5. Set Appropriate Levels: Use debug in development, info in production
  6. Monitor Log Volume: Set up alerts for unusual log volumes
  7. Implement Retention: Define log retention policies based on compliance needs
  8. Use Correlation IDs: Track requests across services with unique IDs
  9. Log Metrics: Include performance data in logs for analysis
  10. Test Log Output: Verify logs work correctly in all environments

Troubleshooting

Common Issues

Debug Mode

Enable verbose logging for troubleshooting: