Debug Logging
Debug logging must be configured to see more detailed “debug” level logs.
By default, FileBrowser logs all INFO, ERROR, WARNING, and API events to stdout with colors enabled. No configuration is required for basic logging.
Enable Debug Logging
Simply add debug
to the levels in your config.yaml
:
server:
logging:
- output: "stdout"
levels: "info|warning|error|debug" # Add debug to see detailed logs
Log Levels
Level | Description |
---|---|
error | Only error messages |
warning | Warnings and errors |
info | General information (default) |
debug | Detailed debugging information including file/line numbers |
api | API request/response logs (via apiLevels ) |
Log levels can be specified using multiple separators: "info|warning|error"
or "info warning error"
or "info,warning,error"
. Use whichever you prefer.
When debug logging is enabled, all log types will include the exact file and line number that caused the log event, not just debug logs.
What Debug Logging Shows
When debug logging is enabled, you’ll see detailed information about:
- HTTP request/response details
- File operations and permissions
- Authentication attempts
- Database queries
- Share creation and access
- Integration operations (OnlyOffice, FFmpeg)
- Exact file and line numbers for all log events
Logging Configuration Examples
Default Behavior (No Config Required)
If you don’t configure logging, you get this by default:
server:
port: 8080
# No logging config = default stdout with colors and API logs
sources:
- path: "/data"
name: "files"
This gives you INFO, WARNING, ERROR, and API logs to stdout with colors.
Enable Debug Logging
server:
port: 8080
logging:
- output: "stdout"
levels: "info|warning|error|debug"
sources:
- path: "/data"
name: "files"
File Output
Log to a file:
server:
port: 8080
logging:
- levels: "info|debug|warning|error"
output: "/var/log/filebrowser/debug.log"
noColors: true # Disable colors for file output
sources:
- path: "/data"
name: "files"
Structured JSON Logging
Enable JSON structured logs for log aggregation tools:
server:
port: 8080
logging:
- levels: "info|debug|warning|error"
output: "stdout"
json: true # Output in JSON format
utc: true # Use UTC timestamps
sources:
- path: "/data"
name: "files"
Multiple Log Outputs
You can have multiple file loggers and one stdout logger:
server:
port: 8080
logging:
# Console output without API logs
- output: "stdout"
levels: "info|warning|error"
apiLevels: "disabled"
# API events to separate file
- output: "api-events.log"
levels: "disabled" # Only log API events
noColors: true
# Errors to separate file
- output: "errors.log"
levels: "error|warning"
apiLevels: "disabled"
noColors: true
sources:
- path: "/data"
name: "files"
You can have as many file output loggers as you want, but only one stdout logger. If you configure multiple stdout loggers, only the first one will be used.
API-Specific Logging
Configure separate log levels for API requests:
server:
port: 8080
logging:
- output: "stdout"
levels: "info|warning|error"
apiLevels: "info|warning|error" # API logs at different levels
sources:
- path: "/data"
name: "files"
Or disable API logs entirely:
server:
port: 8080
logging:
- output: "stdout"
levels: "info|warning|error"
apiLevels: "disabled"
sources:
- path: "/data"
name: "files"
Complete Production Example
For production environments, recommended logging configuration:
server:
port: 8080
baseURL: "/"
database: "/database/database.db"
logging:
# Main application logs to file
- output: "/var/log/filebrowser/app.log"
levels: "info|warning|error"
noColors: true
json: true
utc: true
# Error-only logs for monitoring
- output: "/var/log/filebrowser/errors.log"
levels: "error"
apiLevels: "disabled"
noColors: true
json: true
utc: true
# API events to separate file
- output: "/var/log/filebrowser/api.log"
levels: "disabled"
apiLevels: "info|warning|error"
noColors: true
json: true
utc: true
sources:
- path: "/data"
name: "files"
config:
denyByDefault: false
auth:
tokenExpirationHours: 2
methods:
password:
enabled: true
Special Log Behaviors
FATAL Logs
FATAL logs are considered errors and cannot be disabled. FATAL logs always print to console regardless of configuration, as they indicate the program is about to terminate.
Debug Mode Line Numbers
When debug logging is enabled, all log types (not just debug) will include the exact file and line number that caused the log event. This helps with troubleshooting but adds overhead.
Troubleshooting
Terminal Shows Weird Characters
If you see 033[0m
or similar text in your logs:
server:
logging:
- output: "stdout"
levels: "info|warning|error"
noColors: true # Disable color codes
sources:
- path: "/data"
name: "files"
Enable Debug Logging Temporarily
For troubleshooting, temporarily enable debug logging:
server:
logging:
- output: "stdout"
levels: "info|warning|error|debug" # Add debug level
sources:
- path: "/data"
name: "files"
Debug logging can generate large amounts of output and includes file/line numbers for all logs. Use it only for troubleshooting and disable it in production to avoid performance impact and disk space issues.
Log Rotation
FileBrowser doesn’t handle log rotation internally. Use external tools like logrotate
:
/var/log/filebrowser/*.log {
daily
rotate 7
compress
delaycompress
notifempty
create 0640 filebrowser filebrowser
sharedscripts
postrotate
systemctl reload filebrowser
endscript
}
Next Steps
- [Troubleshooting" />}}
- Configuration Reference