serilog / serilog-sinks-file

Write Serilog events to files in text and JSON formats, optionally rolling on time or size
Apache License 2.0
334 stars 117 forks source link

Insert log record instead of append. #302

Closed rmos5 closed 11 months ago

rmos5 commented 11 months ago

Inserting log record is much better for reading than appending. You can see latest records immediately instead of scrolling to end and read from bottom to head.

Parameter in constructor would be fine. Thank you.

Cheers, rmos.

nblumhardt commented 11 months ago

Unfortunately the way files work on current operating systems makes this extremely slow to do (the entire contents of the log file need to be effectively re-written on every insert). There's an earlier discussion somewhere in the Serilog.Sinks.File repository about this, but I haven't been able to track it down so can't link it here, sorry. Thanks for dropping by, though!

bartelink commented 11 months ago

Closest I could find is https://github.com/serilog/serilog-sinks-file/issues/301 There may be a canonical issue somewhere on stackoverflow, but the bottom line is that this is infeasible

rmos5 commented 11 months ago

You're right, it's user point of view and is a responsibility of a log presentation software.

bartelink commented 11 months ago

Another one (again adding little): https://stackoverflow.com/questions/73650710/serilog-how-to-log-messages-in-ascending-order-in-text-file