https://bz.apache.org/bugzilla/show_bug.cgi?id=69595

--- Comment #2 from Vijay <[email protected]> ---
Hi,
Adding more details to my proposed approach for this enhancement:

Configuration:
- Introduce an optional `maxFileSize` attribute for AccessLogValve (default:
disabled)
- When `maxFileSize` is not set or <= 0, existing behaviour remains unchanged

Rotation logic:
- Maintain an in-memory counter to track the current log file size
- After each log write, increment the counter and check against `maxFileSize`
- Trigger rotation when the configured size threshold is exceeded

Coexistence with existing date-based rotation:
- If `rotatable=true` and `maxFileSize` is configured:
- Rotation will occur when either condition is met (date change or size limit)
- On date change, the size-based rotation index will be reset

File naming:
- Follow existing naming convention and append an index for size-based
rotations, e.g.:
  access_log.YYYY-MM-DD.txt
  access_log.YYYY-MM-DD.1.txt
  access_log.YYYY-MM-DD.2.txt

Thread safety:
- Rotation logic will be synchronized to avoid concurrent rotations
- The log writing path will remain lightweight to minimize performance impact

Performance considerations:
- File size tracking will be maintained in-memory to avoid repeated filesystem
checks

Backward compatibility:
- No changes to existing behaviour unless `maxFileSize` is explicitly
configured

Note:
- This enhancement is intended to prevent uncontrolled growth of individual log
files.
- Log retention, cleanup, and disk capacity management are expected to be
handled by external tools (e.g. OS-level log rotation or container
orchestration policies).

Please let me know if this approach looks good or if there are any preferred
alternatives before I proceed with implementation.

Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to