danieleteti / loggerpro

An modern and pluggable logging framework for Delphi
Apache License 2.0
357 stars 91 forks source link

Question: PID and log rotation? #78

Closed luebbe closed 1 year ago

luebbe commented 1 year ago

I could probably answer the question myself by looking at the code ;-), but: How does the log rotation handle PIDs in filen ames, or how would it handle dates in file names (#66)? If I start an application over and over again with a unique identifier in the log file name (PID, Date (kind of unique) :-), Date+Time, ...), would I get an infinite number of log files? My expectation is that the log rotation should limit the number of created files by tag. So if I set the log rotation to ten and use a "unique" ID in the file name, the last ten starts of the application would be logged into separate files with a unique ID each.

danieleteti commented 1 year ago

PID in log file names has 2 utilization scenarios:

In all the other cases is not useful.

luebbe commented 1 year ago

Let's rephrase this:

danieleteti commented 8 months ago

Log Rotation requires that the filename can be regenerated based only on "index". So the filename cannot depend on time. About the PID the reason a a bit different. Log Rotation can rotate logs generated by the same "run" but cannot rotate logs generated by a previuos run. However, in the case of PID, this is what you need (don't overwrite log from a previous run), so it's OK.