Logger: File backend can completely break if log file is not writable #210

Closed
opened 2020-11-17 05:58:41 +00:00 by jamie · 5 comments
jamie commented 2020-11-17 05:58:41 +00:00 (Migrated from git.hazaar.io)

I think application logging needs to be revisited urgently as I've come across a couple of problems.

The main issue is, if the log file is not writable, then lots of errors get thrown. This is because the private member variables for the Hazaar\Logger\Backend\File class are messed up. Basically the hLog and hErr variables are never defined explicitly. They are defined implicitly when the logger starts up. The main issue here is we do a file is_writable() check before doing so and if the file can not be written to, the variables are never defined.

Updates:

  • If the file is not writable, we should throw an exception because logging is enabled and we want to know if it's not working.
  • I need to fix up the class variables
  • Logging should be disabled by default and enabled with a config directive. It may already work like this, but I need to confirm and make it more clear.
I think application logging needs to be revisited urgently as I've come across a couple of problems. The main issue is, if the log file is not writable, then lots of errors get thrown. This is because the private member variables for the `Hazaar\Logger\Backend\File` class are messed up. Basically the `hLog` and `hErr` variables are never defined explicitly. They are defined implicitly when the logger starts up. The main issue here is we do a file `is_writable()` check before doing so and if the file can not be written to, the variables are never defined. Updates: * If the file is not writable, we should throw an exception because logging is enabled and we want to know if it's not working. * I need to fix up the class variables * Logging should be disabled by default and enabled with a config directive. It may already work like this, but I need to confirm and make it more clear.
jamie commented 2021-03-12 01:26:31 +00:00 (Migrated from git.hazaar.io)

created merge request !119 to address this issue

created merge request !119 to address this issue
jamie commented 2021-03-12 01:26:32 +00:00 (Migrated from git.hazaar.io)

mentioned in merge request !119

mentioned in merge request !119
jamie commented 2021-03-12 05:41:33 +00:00 (Migrated from git.hazaar.io)

Looks like most of this was fixed up in 87755cd72271a1c0ba2c54ebf38133fe9bf5310f outside of any branch. Need to stop doing that!!! (I have 😄)

Just testing and confirming things. Looks like the exception I'm now throwing is messing with error stylesheets.

Looks like most of this was fixed up in 87755cd72271a1c0ba2c54ebf38133fe9bf5310f outside of any branch. Need to stop doing that!!! (I have :smile:) Just testing and confirming things. Looks like the exception I'm now throwing is messing with error stylesheets.
jamie commented 2021-03-12 23:54:15 +00:00 (Migrated from git.hazaar.io)

mentioned in commit 44cfeb4098b201a08e195e414476043637a047eb

mentioned in commit 44cfeb4098b201a08e195e414476043637a047eb
jamie (Migrated from git.hazaar.io) closed this issue 2021-03-12 23:54:15 +00:00
jamie commented 2021-03-13 00:13:36 +00:00 (Migrated from git.hazaar.io)

mentioned in commit ca5d6aed697ebfa58eb27a3ba4fe79b0b05cdd54

mentioned in commit ca5d6aed697ebfa58eb27a3ba4fe79b0b05cdd54
jamie self-assigned this 2025-09-04 01:15:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/framework#210
No description provided.