Page MenuHomePhabricator

Use wfDebugLog instead of wfDebug by default
Closed, ResolvedPublic


It is currently difficult to see only a specific type of debug information, for example, only SQL queries to the database. The user has to filter through the main debug log deleting all the stuff they aren't interested in.

It would be useful if users could define $wgDebugLogGroups to see specific types of debugging. I propose having all classes use wfDebugLog instead of wfDebug. For example the various database access classes could do wfDebugLog( 'database', $msg ) instead of wfDebug( $msg ). Then if a user wanted to see all database interaction, they could just define a $wgDebugLogGroups for 'database'.

Since wfDebugLog by default just passes messages to wfDebug if no log is defined in $wgDebugLogGroups, the default logging behavior would be exactly the same as it is now.

Aside from database interaction, caching, and authentication could be logged to different logs.

Version: 1.21.x
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:14 PM
bzimport set Reference to bz14601.
bzimport added a subscriber: Unknown Object (MLST).

dev wrote:

I've started this locally, I'd say something like 'database' 'article' 'user' 'upload' (also import) and 'other' as defaults, however there are times when it all overlaps, so I'm not sure how productive that would be. That said, I'll give it a shot.

Is this request still relevant? And shouldn't be filed under Logs component?

It's still relevant in that the core code still uses wfDebug instead of wfDebugLog in most places. I really don't care one way or the other any more though so in that sense it's no longer relevant. Feel free to close or whatever...

Yes this bug is still relevant :-]  Having almost everything logged by wfDebug() is not very helpful.

(In reply to comment #2)

Is this request still relevant? And shouldn't be filed under Logs component?

Logs component is about wiki user log events (Special:Log, 'logging' database etc.).

This bug is about debug logs generated by the software for developers.

Related RFC at [[:mw:Requests_for_comment/Structured_logging]]

daniel wrote:

Related: Bug 62713 - wfDebugLog timestamp should show fraction of second
(includes patch)

cneubauer claimed this task.
cneubauer added a subscriber: cneubauer.

Structured logging fixes this as far as I'm concerned. Closing.