By default, the Spam module logs "Important" messages, which should include major actions such as blocking a comment, etc. However, when the module is configured to log important messages, nothing at all is showing up in my spam log.

When I drop the log level to debug, I do see debug logs, hence this apparently only affects some logs.

Comments

jeremy’s picture

Status: Active » Fixed

It looks like log levels are working fine, but the default log mode doesn't really log much. I changed one log message, committed here:
http://drupal.org/cvs?commit=247156

gnassar’s picture

Title: Logging levels are not working correctly » Default logging logs too little
Status: Fixed » Needs work

Yeah, I wasn't able to replicate this one. I thought the sparse default logging was intentional, though I did think it was perhaps too far on the light side. Maybe we should be coming up with a list of use cases that we'd want logged by default ([content] logged as spam, moderated spam approved, etc), and from there change the code to match? Better than going piecemeal with it, I think.

jeremy’s picture

Sure, sounds like a plan. I reviewed the log levels when reviewing this issue and decided I liked the current settings -- what further logs do you feel should be showing up?

gnassar’s picture

Title: Default logging logs too little » Consistent logging across modules

I started going through all spam_log calls and making a list of what I thought should be upped, realized that some of it maybe needed to be downgraded, and then realized what the real issue was: it's not really the levels of logging, it's that they're not consistently applied. For example, Bayesian and custom will return some final results as SPAM_VERBOSE, while duplicate and custom won't (and surbl won't return a success at all, it seems).

So I was thinking maybe it was better to propose some guidelines for logging in general that all modules should follow, and then we can go through each and modify them to comply with those guidelines.

My first pass:

SPAM_LOG
* content marked as spam by spam.module, with final score
* content marked as spam or not-spam by user
* any "this is never supposed to happen" errors (as they're probably indicative of a bug)

SPAM_VERBOSE
* content marked as not-spam by spam module, with final score
* individual filters indicating spam, with scores

SPAM_DEBUG
* individual filters calculating all content score
* any internal processes that would be handy to expose for debugging

jeremy’s picture

Yes, I like this. There may be some missing actions, but we can add them as we find them when auditing the code.

We should create a DEVELOPER.txt file (or whatever name you prefer) and put these guidelines in there, and any others we agree upon as time goes by.

gnassar’s picture

Just thought I'd bump this, now that we're cleaning up code.

gnassar’s picture

Category: bug » task

Committed a DEVELOPER.txt file.
http://drupal.org/cvs?commit=470512

Changing to "task" but leaving at "needs work," as we never really did go through to make sure we adhere to our own best practices on this.

AlexisWilke’s picture

I guess we could add all sorts of documentation for developers in that .txt file. 8-)

avpaderno’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

I am closing this issue, since it's for a Drupal version no longer supported.