Modify

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#11905 closed defect (fixed)

DeveloperLogModule doesn't work in Trac 1.1.2

Reported by: Ryan J Ollos Owned by: Jun Omae
Priority: normal Component: TracDeveloperPlugin
Severity: normal Keywords:
Cc: Jun Omae, lkraav Trac Release: 1.2

Description

In Trac 1.1.2 the classes implementing IRequestHandler are cached in a dictionary, so DeveloperLogModule is not longer able to insert itself to the front of the handlers list in order to force itself to be processed first: tracdeveloperplugin/trunk/tracdeveloper/log.py@7968:32-33#L24. See trac:#11597 and [trac 12922#file7].

Attachments (4)

t11905.patch (2.1 KB) - added by Ryan J Ollos 3 years ago.
1.1.2dev.png (196.2 KB) - added by Ryan J Ollos 3 years ago.
1.0.2dev.png (128.8 KB) - added by Ryan J Ollos 3 years ago.
t11905.2.patch (2.1 KB) - added by Ryan J Ollos 3 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 3 years ago by Ryan J Ollos

Cc: Jun Omae lkraav added; anonymous removed
Status: newassigned

Changed 3 years ago by Ryan J Ollos

Attachment: t11905.patch added

Changed 3 years ago by Ryan J Ollos

Attachment: 1.1.2dev.png added

Changed 3 years ago by Ryan J Ollos

Attachment: 1.0.2dev.png added

comment:2 Changed 3 years ago by Ryan J Ollos

Proposed patch in attachment:t11905.patch. The result is that we log a bit more than before. Screen captures below are from navigating to WikiStart with log level set to DEBUG.

1.0.2dev:

1.1.2dev

Changed 3 years ago by Ryan J Ollos

Attachment: t11905.2.patch added

comment:3 Changed 3 years ago by Ryan J Ollos

Better patch: t11905.2.patch.

comment:4 Changed 3 years ago by Olemis Lang

Thanks for submitting the patch . I'll take a look into this in the next few days

comment:5 Changed 3 years ago by Jun Omae

t11905.2.patch looks good to me. However, I think we should show log view except in the case of the following.

  • /chrome request (before the patch, the plugin doesn't show log view for the request)
  • Ajax request (I don't think log view is needed in the case)
  • No TRAC_DEVELOP permission (I think the plugin should check it)
    # IRequestHandler methods
    def pre_process_request(self, req, handler):
        if not isinstance(handler, Chrome) and \
                req.get_header('X-Requested-With') != 'XMLHttpRequest' and \
                'TRAC_DEVELOP' in req.perm:
            if self.log_handler not in self.log.handlers:
                self.log.addHandler(self.log_handler)
            req._tracdeveloper_hdlr = self.log_handler
        return handler
Last edited 3 years ago by Jun Omae (previous) (diff)

comment:6 in reply to:  5 Changed 3 years ago by Ryan J Ollos

Replying to jun66j5:

  • /chrome request (before the patch, the plugin doesn't show log view for the request)

Yeah that seems like an especially good idea. The additionally logging after t11905.2.patch (as shown in the screen captures), is usually just noise from the standpoint of the developer.

Last edited 3 years ago by Ryan J Ollos (previous) (diff)

comment:7 Changed 2 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

In 14627:

0.3.0dev: Compatibility with Trac >= 1.1.2.

  • DeveloperLogModule was not functional for Trac >= 1.1.2.
  • Don't show log for /chrome request.
  • Don't show log for Ajax request.
  • Don't append TracDeveloperHandler unless user has TRAC_DEVELOP permission.

Thanks to Jun Omae for help with the patch. Fixes #11905.

comment:8 Changed 2 years ago by Ryan J Ollos

Owner: changed from Olemis Lang to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.