Debugging & Logging - Logging Settings
Configure log file, rotation, and slow page logging settings
Overview
Logging is essential for monitoring application health, troubleshooting issues, and maintaining security. The Logging Settings page in the ColdFusion Administrator allows you to configure how ColdFusion records events, errors, and diagnostic information. Proper logging configuration helps you quickly identify and resolve issues while minimizing performance impact and storage costs.
This guide covers log severity types, log rotation, slow page logging, and best practices for production logging. Understanding these settings helps you balance comprehensive logging with system performance and disk space management.
Source: Adobe: Use the ColdFusion Administrator (Logging Settings page)
Log Severity Types
ColdFusion log entries carry one of the severity types below. Severity is set per entry by the type attribute of cflog (or the writeLog() function). The Logging Settings page has no global or per-log level setting that filters entries by severity.
Information
- Use Case
- General informational messages about normal operations
- Includes
- Server startup/shutdown, configuration changes, successful operations
Warning
- Use Case
- Potentially harmful situations that don't stop execution
- Includes
- Deprecated features, configuration issues with fallbacks, resource constraints
Error
- Use Case
- Error events that might still allow application to continue
- Includes
- Handled exceptions, failed operations with fallbacks, database connection failures
Fatal
- Use Case
- Severe errors causing application shutdown
- Includes
- Unrecoverable errors, critical resource exhaustion, security violations
Log Directory Configuration
Log Directory Path
{cfusion}/logs/ (Source: Adobe: Install the server configuration)C:\ColdFusion2025\cfusion\logs\/opt/coldfusion2025/cfusion/logs/- Separate logs from application files
- Easier backup and archival
- Can use dedicated storage with better I/O
- Simplifies log aggregation
- Use separate partition/drive for high-traffic sites
- Ensure sufficient disk space and configure monitoring
Log File Rotation Settings
Control how ColdFusion rotates log files to manage disk space while retaining historical data.
Maximum Log File Size
Medium sites: 10-25 MB
Large sites: 25-50 MB
Maximum Number of Archives
Log Rotation Behavior
- Set file size limits to prevent individual files from becoming too large
- Configure enough archives to cover troubleshooting period (typically 7-30 days)
- Monitor total log directory size
- Consider external archival for long-term retention
- Use log aggregation tools for better management
- Test restore procedures for archived logs
Slow Page Logging
Identify slow requests by logging pages that take longer than a specified number of seconds to process.
Log Slow Pages Taking Longer Than [n] Seconds
server.logAdditional Logging Options
Enable Logging for Scheduled Tasks
- Setting
- Logs ColdFusion Executive task scheduling
- Log File
- scheduler.log
- Logs
- Scheduled events submitted for execution, whether submission succeeded, the page URL, date and time, and a task ID
Enable for scheduled task monitoring and troubleshooting.
Mail Logging
- Configured On
- Server Settings > Mail (Error Log Severity, Log All Mail Messages Sent By ColdFusion)
- Log Files
- mail.log, mailsent.log
- Logs
- mail.log: SMTP-related errors; mailsent.log: To, From, and Subject of sent messages
Monitor mail.log regularly for email delivery issues.
Exception Logging
- Log File
- exception.log
- Logs
- Stack traces for exceptions that occur in ColdFusion
Critical - monitor exception.log closely in production environments.
Production Logging Best Practices
Log Severity in Application Code
- Choose the cflog/writeLog
typethat matches the event (Information, Warning, Error, Fatal). The default is Information - Avoid logging routine events in high-traffic code paths
- Write application logs to dedicated files with the
fileattribute
Storage and Retention
- Size log files appropriately for rotation frequency
- Keep enough archives to cover typical incident investigation period
- Use separate disk/partition for logs on high-traffic sites
- Implement external archival for long-term retention
- Monitor disk space and set up alerts
- Compress old logs to save space
Security Considerations
- Protect log files with appropriate file system permissions
- Never log sensitive data (passwords, credit cards, PII)
- Sanitize user input before logging
- Regularly review logs for security incidents
- Implement log integrity monitoring (detect tampering)
- Comply with data retention regulations (GDPR, HIPAA, etc.)
Performance Optimization
- Log only what you need to reduce I/O overhead
- Consider asynchronous logging for high-traffic applications
- Use fast storage (SSD) for log directories
- Avoid logging in tight loops or high-frequency operations
- Implement log sampling for very high-volume events
Monitoring and Alerting
- Monitor exception.log for application errors
- Alert on Fatal level messages immediately
- Track error rates and trends over time
- Review slow page entries in server.log regularly for performance issues
- Set up alerts for disk space consumption
- Monitor log file growth rates
Structured Logging Recommendations
What Is Structured Logging?
- Definition: Logging in machine-parseable format (JSON, XML, etc.)
- Benefits:
- Easier automated analysis
- Better integration with log aggregation tools
- More efficient searching and filtering
- Enables advanced analytics and dashboards
- Comparison: Traditional text logs vs structured JSON logs
Implementing Structured Logging
- Custom Logging: Create JSON-formatted log entries
- Include Standard Fields:
- timestamp - When event occurred
- level - Log severity (ERROR, WARN, INFO)
- message - Human-readable description
- context - Request ID, user ID, session ID
- application - Application name/version
- server - Server hostname/instance
- Use cflog: Write to custom log files
- Consider Log4j: Advanced logging framework (Java-based)
Example Structured Log Entry
{
"timestamp": "2025-01-28T10:30:45Z",
"level": "ERROR",
"message": "Database connection failed",
"datasource": "myDB",
"error": "Connection timeout",
"requestId": "abc123",
"userId": "user@example.com"
}Benefits: Easy to parse, search, and analyze programmatically
Log Aggregation and Analysis
Why Use Log Aggregation?
- Centralization: Collect logs from multiple servers in one place
- Search: Quickly find relevant log entries across all systems
- Correlation: Connect related events across different logs
- Visualization: Dashboards and charts for trends and patterns
- Alerting: Automated notifications for critical events
- Retention: Long-term storage with compression
Popular Log Aggregation Tools
- ELK Stack (Elasticsearch, Logstash, Kibana):
- Open source, powerful search and visualization
- Industry standard for log management
- Scales to billions of log entries
- Splunk:
- Commercial enterprise log management
- Advanced analytics and machine learning
- Excellent visualization and reporting
- Graylog:
- Open source alternative to Splunk
- Built on Elasticsearch
- Good balance of features and simplicity
- Cloud Solutions:
- AWS CloudWatch Logs
- Azure Monitor Logs
- Google Cloud Logging
- Datadog, New Relic, Sumo Logic
Integrating ColdFusion with Log Aggregation
- File-Based: Use Filebeat or Logstash to ship log files
- Syslog (UNIX only): The Log Files page option "Use operating system logging facilities" also writes messages to the UNIX syslog facility
- HTTP/API: Custom logging to API endpoints
- Agent-Based: Install monitoring agent on CF server
- Recommendation: Use Filebeat with ELK for cost-effective solution
Common Issues and Solutions
Log Files Growing Too Large
- Application code logging too many routine events
- Application errors generating excessive logs
- Max file size or archive count too high
- External archival not configured
- Reduce unnecessary cflog/writeLog calls
- Fix application issues causing errors
- Reduce max file size and archive count
- Implement external log archival and cleanup
- Compress or delete old archived logs
Missing Log Entries
- Application using cflog to different file
- Buffering delay in log writing
- Disk full preventing log writes
- Check custom log files
- Verify disk space availability
- Check file permissions
Slow Page Logging Not Working
- Slow page logging not enabled
- Threshold set too high
- Enable the slow page option in Logging Settings
- Lower the threshold
Log Rotation Not Occurring
- Max file size set to very large value
- File permissions preventing rotation
- Verify rotation settings in administrator
- Check file system permissions
Troubleshooting with Logs
Essential Logs for Troubleshooting
- exception.log: Stack traces for exceptions that occur in ColdFusion
- application.log: Every ColdFusion error reported to a user, including syntax, ODBC, and SQL errors
- server.log: ColdFusion server errors and slow page entries
- mail.log: Email sending problems
- scheduler.log: Scheduled task execution
Common Error Patterns
- OutOfMemoryError: Heap exhaustion (check JVM settings)
- Database connection errors: Datasource configuration or network issues
- Template not found: Mapping or path resolution problems
- Method not found: Component or function calling errors
- Null pointer: Variable scope or initialization issues
Log Analysis Techniques
- Search for specific error messages or stack traces
- Correlate timestamps across different log files
- Look for patterns in error frequency and timing
- Compare logs before and after deployments
- Use grep/findstr for command-line log searching
- Leverage log aggregation tools for advanced queries