[3.3][BETA] Notify admins on new error log entries

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

[3.3][BETA] Notify admins on new error log entries

Post by MarkDHamill »

This is a relatively simple extension that notifies administrators if a new entry is made to phpBB’s error log. The admin must have the view logs permission.

phpBB won’t draw attention to new entries in this log, yet the errors in this log are typically important and require prompt analysis and correction. For example, if phpBB can’t send an email, a notification will typically appear in phpBB’s error log. Unless an admin checks this log, however, the error will be ignored. To see the error log: ACP > Maintenance > Forum logs > Error log

A notification is sent to all applicable admins except to the admin triggering the error, who should see it when it occurs. By default, no email notification is sent. However, the extension allows an admin with the privilege to get an email notification too. This setting must be enabled: UCP > Board preferences > Edit notification options > Admin log error notification. See screenshot.

notify-on-error-ucp.png

This extension is in beta status and should not be used on a production board. It can be downloaded from its page or from the GitHub branch. If downloaded from GitHub, place it in an /ext/phpbbservices/notifyonerror folder.

This extension can be hard to test unless you can trigger an actual error. For testing then you might want to change the code temporarily to have it notify you when any entry is added to the admin log. Just make sure to revert these changes after testing.

Change /event/main_listener.php, line 83 from:

Code: Select all

		if ($vars['mode'] === 'critical')	// Change this to 'admin' to test. Submitting any ACP form will then trigger the error.
to:

Code: Select all

		if ($vars['mode'] === 'admin')	// Change this to 'admin' to test. Submitting any ACP form will then trigger the error.
You do not have the required permissions to view the files attached to this post.
Last edited by MarkDHamill on Thu Jun 30, 2022 1:57 am, edited 3 times in total.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
warmweer
Jr. Extension Validator
Posts: 11870
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: [3.3][DEV] Notify admins on new error log entries

Post by warmweer »

MarkDHamill wrote: Sun May 22, 2022 4:56 pm This is a relatively simple extension that notifies administrators if a new entry is made to phpBB’s error log. The admin must have the view log permission.
...
Nice idea for an extension :thumbsup:
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [3.3][DEV] Notify admins on new error log entries

Post by MarkDHamill »

A lot of my extensions amount to little things in the way phpBB works that aren't optimal.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: [3.3][DEV] Notify admins on new error log entries

Post by david63 »

Perhaps I am missing something but if you are getting an error that no emails are sent how are you going to send an email to an Admin to advise of the error? Surely the UCP setting must also include the ability to use notifications.

And how will the extension cater for a situation where a Founder Admin does not want other Admins to be notified of some errors - I am thinking here about errors emanating from other extensions.
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [3.3][DEV] Notify admins on new error log entries

Post by MarkDHamill »

Well, this is a first attempt. So you raise good questions.

If an email cannot be sent, at least a notification will appear on the navigation bar.

Not sure what you mean about a UCP setting for using notifications. Someone with the privilege can uncheck both checkboxes to turn it off.

It may be desirable to have an ACP interface which allows founders control over who should see or not see these notifications. But I'm not sure it's a big deal. If an admin has the view logs permission, why not allow them to decide for themselves if they don't want these notifications? Presumably they were granted the permission because they need to monitor these events.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
warmweer
Jr. Extension Validator
Posts: 11870
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: [3.3][DEV] Notify admins on new error log entries

Post by warmweer »

david63 wrote: Sun May 22, 2022 8:56 pm Surely the UCP setting must also include the ability to use notifications.
Isn't this covered in the red rectangle Image
or am I missing something? ;)
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [3.3][DEV] Notify admins on new error log entries

Post by MarkDHamill »

I would think so.

To answer one of David's concerns, if emailing in general fails, this will be noted in phpBB's error log because this happens now. My extension uses phpBB's notification system to send emails, and the notification system presumably is fault tolerant enough not to crash if emailing goes awry.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
ac_roma
Registered User
Posts: 321
Joined: Thu Mar 08, 2007 2:48 pm
Location: egypt,alexandria

Re: [3.3][DEV] Notify admins on new error log entries

Post by ac_roma »

important extension

thanks
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53567
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [3.3][DEV] Notify admins on new error log entries

Post by Brf »

MarkDHamill wrote: Sun May 22, 2022 9:55 pm To answer one of David's concerns, if emailing in general fails, this will be noted in phpBB's error log because this happens now. My extension uses phpBB's notification system to send emails, and the notification system presumably is fault tolerant enough not to crash if emailing goes awry.
But vanilla phpBB does not send a notification for log entries -- thus this extension. What happens if the Email notification for a log entry cannot be sent, and thus causes a log entry to be created, which your extension then tries to create a new notification for. Loopy?
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [3.3][DEV] Notify admins on new error log entries

Post by MarkDHamill »

Brf wrote: Fri Jun 24, 2022 9:26 pm
MarkDHamill wrote: Sun May 22, 2022 9:55 pm To answer one of David's concerns, if emailing in general fails, this will be noted in phpBB's error log because this happens now. My extension uses phpBB's notification system to send emails, and the notification system presumably is fault tolerant enough not to crash if emailing goes awry.
But vanilla phpBB does not send a notification for log entries -- thus this extension. What happens if the Email notification for a log entry cannot be sent, and thus causes a log entry to be created, which your extension then tries to create a new notification for. Loopy?
I think I answered this in the fifth post.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [3.3][BETA] Notify admins on new error log entries

Post by MarkDHamill »

Version 1.0.1 is available. It has a Beta status. There's nothing really new in this release, it's just an evolution as I learn more about the notifications system. Links are in the first post.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.

Return to “Extensions in Development”