houseabsolute / Log-Dispatch

Dispatches messages to one or more outputs
https://metacpan.org/release/Log-Dispatch/
Other
12 stars 29 forks source link

Log::Dispatch::File doesn't re-chmod after re-open in close_after_write mode #56

Open shadowcat-mst opened 5 years ago

shadowcat-mst commented 5 years ago

File created correctly first time. After file goes away due to rotation, file recreated but $self->{chmodded} is still set so it doesn't check the permissions this time and the file doesn't get chmod()ed. Pretty sure all you need is to add 'delete $_[0]->{chmodded}' in the last 'if' of log_message, and in the mean time the following nasty hack appears to be holding up:

{ package Log::Dispatch::File; use Class::Method::Modifiers;
  after log_message => sub { delete $_[0]->{chmodded} if $_[0]->{close} } }
autarch commented 5 years ago

Doh, sorry for the slow response. A PR would be welcome.