Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Now that #1559310: 404 pages should be language aware is in, an option to suppress 404 messages being logged would be useful to sites that get a lot of 404 requests.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#9 | add_an_option_to-2836458-9.patch | 9.39 KB | tduong |
#9 | interdiff-2836458-7-9.txt | 10.67 KB | tduong |
#7 | add_an_option_to-2836458-7.patch | 9.37 KB | tduong |
#7 | interdiff-2836458-5-7.txt | 809 bytes | tduong |
#5 | Screen Shot 2017-02-10 at 15.18.06.png | 64.85 KB | tduong |
Comments
Comment #2
BerdirDid some quick research, looks like the best way to do this is to add a decorator for the logger factory and return a null logger for the page not found channel.
Comment #3
jeetmail72Hi @Berdir,
Can you please explain the requirement that you are looking from this module.
Comment #4
tduong CreditAttribution: tduong at MD Systems GmbH commentedComment #5
tduong CreditAttribution: tduong at MD Systems GmbH commented- added the suppress_404 setting form in admin/config/search/redirect/settings
- implemented a decorator service with logger factory to avoid logging 404 events if the setting is enabled, otherwise let the default logger do its work
- added test coverage
Comment #7
tduong CreditAttribution: tduong at MD Systems GmbH commentedFixed the failing test(s) caused by a recent commit in core (4h ago #2815845: Importing (deploying) REST resource config entities should automatically do the necessary route rebuilding).
Comment #8
Berdirthis label can be improved: Whether to log page not found messages to the standard log or not
Suppress "page not found" log messages
Prevents page not found log messages, can be safely enabled when this module is used which stores them separately and nothing else relies on those messages.
that it can is not really an important information here. I'd write "Allows page not found log messages to be suppressed by returning a NullLogger".
Redirect404LogSuppressor?
use loggerChannelFactory and $logger_channel_factory.
error logging can happen very early, we don't know for sure that the config is readable and so on. It might also not be needed.
just assign this as $configFactory only read the config in case we have a page not found $channel request.
the the order then and read from $this->configFactory->get()...
this is weird, because there will then be two different instances, ourself with the parent and the inner.
Do not extend, only implement the interface. And call $this->loggerChannelFactory instead.
we can probably skip a good amount of those permission as we don't need the dblog UI.
no need to use LIKE
Comment #9
tduong CreditAttribution: tduong at MD Systems GmbH commentedAddressed comment #8
Comment #11
BerdirComment #13
BerdirThat interdiff was pretty useless :)
Changes look good though, committed.
Comment #15
jenlamptonHi all, thanks for working on this much needed feature. Is there a matching Drupal 7 issue? I've got a handful of D7 sites I'd like to use this on.
Comment #16
JasonLuttrellI would like to +1 or second the comment by jenlampton. I have some legacy D7 sites that have this issue, it would be great if someone can back port a fix like this or let us know if one is already available. Thanks!