This document describes the debug flags system used in CeWinFileCacheFS for controlling WinFsp's internal logging behavior.
The debug flags system uses WinFsp's built-in debug logging mechanism, which operates independently from the application's Logger system. These flags control what internal WinFsp operations are logged and where the output is sent.
# Disable all debug logging (default)
CeWinFileCacheFS -d 0
# Enable all debug logging
CeWinFileCacheFS -d
# Enable all debug logging (explicit)
CeWinFileCacheFS -d -1
# Enable specific debug categories
CeWinFileCacheFS -d 1 # Enable category 1
CeWinFileCacheFS -d 7 # Enable categories 1, 2, and 4 (bitmask: 0111)
CeWinFileCacheFS -d 15 # Enable categories 1, 2, 4, and 8 (bitmask: 1111)| Value | Hex | Description |
|---|---|---|
0 |
0x00000000 |
No debug logging - All logging disabled (default) |
-1 |
0xFFFFFFFF |
Full debug logging - All categories enabled |
1 |
0x00000001 |
Enable debug category 1 |
2 |
0x00000002 |
Enable debug category 2 |
4 |
0x00000004 |
Enable debug category 3 |
8 |
0x00000008 |
Enable debug category 4 |
| Custom | Various | Bitmask combinations - Enable specific category combinations |
The debug flags use a 32-bit bitmask where each bit represents a different category of WinFsp operations:
Bit: 31 30 29 ... 3 2 1 0
Flag: ? ? ? ... ? ? ? ?
- Each bit = 1: Enable logging for that category
- Each bit = 0: Disable logging for that category
- Combine multiple categories: Use bitwise OR of values
# Enable categories 1 and 2
-d 3 # Binary: 0011 = 1 + 2
# Enable categories 1, 4, and 8
-d 13 # Binary: 1101 = 1 + 4 + 8
# Enable categories 2 and 16
-d 18 # Binary: 10010 = 2 + 16WinFsp debug logging typically includes:
- File operations: Create, open, read, write, close, delete
- Directory operations: Enumerate, create, delete, rename
- Attribute queries: File size, timestamps, permissions
- Volume operations: Mount, unmount, query volume info
- IRP (I/O Request Packet) processing: Kernel-level I/O requests
- Cache operations: Page cache interactions, write-through behavior
- Security operations: Access checks, token validation
- Handle management: File handle creation and cleanup
- Timing information: Operation durations, bottlenecks
- Error conditions: Failed operations, retry attempts
- Memory allocation: Buffer management, memory pressure
- Thread operations: Worker thread activity, synchronization
WinFsp debug output can be sent to different destinations:
Output goes to attached debugger:
- WinDbg
- Visual Studio debugger
- DebugView utility
- Kernel debugger
// In application code:
FspDebugLogSetHandle(fileHandle);When a file handle is set, debug output goes to the specified file instead of the debugger.
// From main.cpp
if (i + 1 < argc && argv[i + 1][0] != L'-')
{
options.debug_flags = StringUtils::parseULong(argv[++i]); // Parse specific value
}
else
{
options.debug_flags = static_cast<ULONG>(-1); // Enable all debug
}// Debug flags are passed directly to WinFsp
result = host.Mount(mount_point_copy.data(), nullptr, FALSE, options_.debug_flags);- Type:
ULONG(32-bit unsigned integer) - Range: 0 to 4,294,967,295 (0x00000000 to 0xFFFFFFFF)
- Default: 0 (no logging)
Important: WinFsp debug flags are separate from the application's Logger system:
| System | Purpose | Output | Control |
|---|---|---|---|
| WinFsp Debug Flags | Log internal WinFsp operations | Debugger or file | -d flag |
| Application Logger | Log application-level messages | Console, file, or debug output | Logger::initialize() |
# Start with minimal logging
-d 1
# Gradually increase if needed
-d 7
# Use full logging only for complex issues
-d -1# Disable debug logging for performance
-d 0# File I/O problems
-d 15 # Enable basic file operations
# Performance issues
-d 255 # Enable performance-related categories
# Mount/unmount problems
-d -1 # Enable all logging# Enable file operation logging
CeWinFileCacheFS --config compilers.json --mount M: -d 3# Enable timing and cache logging
CeWinFileCacheFS --config compilers.json --mount M: -d 31# Enable all logging for comprehensive debugging
CeWinFileCacheFS --config compilers.json --mount M: -d -1- Check if debugger is attached (use DebugView utility)
- Verify debug flags are set: Look for "Debug flags: 0x..." in application log
- Check WinFsp installation: Ensure WinFsp is properly installed
- Reduce debug level: Use smaller bitmask values
- Filter output: Use debugger filtering capabilities
- Redirect to file: Set up file logging to avoid console spam
- Default: Goes to debugger, not console
- File logging: Requires application code changes
- Console output: Not directly supported by WinFsp debug system