Skip to content

The logger

garry-ut99 edited this page Oct 28, 2024 · 83 revisions

uBlock Origin (uBO) comes with a logger, which gives the ability to inspect what uBO is doing with network requests and DOM elements, whether something is blocked or allowed or redirected, whether any scriptlet injections occurred, and which filter, if any, matched a network request or DOM element. This logger is unified, meaning it will display everything uBO does as it occurs.

The logger is the tool of choice to see, understand, diagnose and fix the functioning of uBO.

To access the logger, click on the list icon of uBO's popup UI:

list icon

For detailed instructions regarding opening the logger see here.

The request logger will open in a new tab:

logger window

The color of a row hints at how the resource was filtered:

  • No color: The request for the resource was allowed to go through because it matched no filter/rule.
  • Purple: The request for the resource was modified by one of the "Modifier filters".
  • Red: The request for the resource was canceled (--) because of a block filter/rule.
  • Gray: The request for the resource was allowed to go through "Dynamic filtering" engine, because of noop rule.
  • Green: The request for the resource was allowed to go through (++) because it matched a filter/rule whose purpose is to bypass a matching block filter/rule.
  • Yellow:
    • A DOM element which was blocked by a cosmetic filter; OR
    • A blocked request for a resource was redirected (<<) to a local, "neutered" replacement resource.
    • A defuser scriptlet was injected into the page (+js(...))
  • Blue font:

Particular columns indicate:

  1. Timestamp of the event
  2. For blocked/allowed/hidden resources, the column will contains the responsible filter. For redirection, local resource used as replacement to the blocked network request.
  3. Action taken by uBO:
    • -- blocked request
    • ++ allowed by exception filter/rule
    • << redirection to neutered resource
  4. Context identifier (domain) in which the filter is evaluated
  5. Partyness of the network request related to main document, and optionally after comma, partyness of the request in relation to embedded subdocument
    • 1 for the first-party requests, from current page domain (the one you see in address bar)
    • 3 for third-party requests, from other domains
    • 0 for tabless requests (behind the scene, requests not assigned to any opened page)
  6. HTTP request method
  7. Type of request
  8. Address of the resource on which filter was applied

Time, Filter/Rule, Context and Partyness columns can be disabled in Settings dialog

Take note that the network request logger in uBO is a forward-looking logger: this means only future requests can be logged.

In the spirit of efficiency, uBO will log entries IF AND ONLY IF the logger is opened. Otherwise, if the logger is not opened, no CPU/memory resources are consumed by uBO for logging purpose.

Tip

Hold the Shift key while clicking the "Open the logger" icon to toggle between opening the logger in a separate window or in a separate tab. uBO will remember that setting when you open the logger next time, without having to hold the Shift key.



Components


Page selector

page selector drop-down list

The drop-down selector is to display log entries which are related to a specific page. This will hide from view all log entries which are not related to the selected page. By selecting All again, all log entries will be displayed again.

Note in the figure above the entry named "Tabless": selecting this entry allows to show network requests not associated with any tab. Tabless request are denoted in the log by font shadow effect and 0 in "Context" column (fifth).


Reload

reload button

The big reload button aside the page selector is to force a reload of the content of the selected page. This button is enabled only for when a specific page is selected.

Click it with Ctrl, Shift or Cmd (Mac) to bypass cache.


DOM inspector

code icon

Complementary tool to the element picker.

Please read more on dedicated page: "DOM inspector"


Accessing popup UI of a specific page

uBO icon

By clicking this button you can access the popup UI of a specific tab.


Expand

arrow down icon

By default log entries in the logger are collapsed so as to take no more than one line. Some log entries however might be truncated as a result. This button can be used to expand all entries vertically to larger number of lines (configurable in Settings dialog, default 4) making them more visible.


Void log entries

x icon

With "All" selected in "Page selector" if you close a tab for which there are entries in the logger, these entries will be marked as void, i.e. they will be faded out, to indicate the tab for these entries does not exist anymore.

The X button in the toolbar allows you to remove those void entries from the logger.


Clear

rubber icon

This is to clear the logger, to remove all entries from the selected/filtered context (Ars Technica tab in this example).

Tabless request (faded out) may also appear in current page log. To clear them out, click Clear icon second time.


Pause the logger

pause icon


Filtering the logger output

expression picker drop down interface

You can visually filter entries in the logger using filter expressions. Expressions can be chosen from expression picker, available by hovering mouse cursor over filter input box. Log entries which do not match all filter expressions will be hidden from view.

expression picker arrow down

Clicking on arrow in the filtering input box deactivates expression picker.

funnel icon

Funnel icon toggles on/off current filter expression.

Filter can also be entered manually. Supported syntax:

  • Enter foo to only show entries which have a string foo.
  • Enter |foo to only show entries which have a field starting with foo.
    • Tip: use |-- to show only entries which were blocked (-- may work for the most part, but there could be false positives).
  • Enter foo| to only show entries which have a field ending with foo.
  • Enter |foo| to only show entries which have exactly a field with foo.
  • Prefix any expression with ! to reverse the meaning of the expression.
    • !foo means display only entries which do not have the string foo in it.
    • !|-- means display only entries which were not blocked.
  • When more than one filter expression appear, a logical and between the expressions is implied.
  • You can or multiple expressions together:
    • css || image means display entries which match either css or image.
    • xhr || other |http: means display entries which match either xhr or other and have a field which starts with http:.
    • !css || image means display entries which do not match either css or images (equivalent to !css !image really).
    • Warning: With or'ed expressions, the not (!) operator can only apply to the resulting or'ed expression.
  • Enclose expression in slash / characters to treat it as Regular Expression.

Examples:

  • !|-- facebook: show only non-blocked entries with the string facebook in it.
  • |xhr google: show only entries of type XMLHttpRequest with the word google in it.
  • !|image !|css: show only entries which are not of type image, neither css.

Verbose mode

speaker icon

Provide more information from injected scriptlets when available.


Export dialog

clipboard icon

export dialog

Allows to easily export log to the system clipboard in format compatible with various discussion boards.


Settings dialog

gear icon

settings dialog


Finding from which list(s) a static filter originates

You can find out from which filter list(s) a static filter originates, by simply clicking on it (or in any other highlighted column):

mouse over log in active column

filter details dialog

  • Clicking on filter list name will open assets viewer with content of that list.
  • Home icon next to the filter name will bring you to the support site for that list.

Source code viewer

New in 1.47.3b4.

You can use the logger to view beautified and syntax-highlighted source code of HTML/CSS/JS/xhr resources when clicking on the arrow at the end of the link in a logger entry, it will automatically open the source code viewer. The goal is to save time and to make it easier for filter list authors to investigate filter-related issues.

the arrow to open the source code viewer source code viewer

Creating filters

mouse over log in active column

Clicking on the highlighted cell of the log entry will give you access to the filtering tools dialog (modal), from where you can easily create dynamic URL filtering rules or just standard static filters.


Dynamic URL filtering rules

URL rule tab in details dialog

Point-and-click to create dynamic URL filtering rules. These rules are temporary by default - click the padlock button if you want to make them permanent. Pressing Ctrl (Cmd on Mac) when setting rules will make them permanent immediately. Useful to find out which network requests need to be blocked or allowed on a page in order, to fix a broken page, or to further block more useless resources from a page.

See "Overview of uBlock's network filtering engine: details" for more details about where dynamic URL filtering fits in the overall filtering engine.


Static network filters

Static filter tab in details dialog

This dialog will assist you in creating static filters compatible with ABP filter syntax. Note that creating static filters incur a significant overhead relative to dynamic URL filtering rules. Typically, you will first use dynamic URL filtering rules to quickly diagnose which network requests need to be allowed/blocked.

See "Overview of uBlock's network filtering engine: details" for more details about where static filtering fits in the overall filtering engine.


Temporary exception filters

The button to toggle the "exceptor" on/off is labeled #@#:

filtering tools dialog

Prior to 1.45.3rc2/1.46, the feature worked only for static extended filters (i.e. cosmetic, scriptlet & HTML filters) and was hidden under an advanced setting.
It now works with all static filters (including network filters) and open for regular use.

The temporary exceptions will be disabled when closing the logger (after 1.45.3rc2/1.46) or by manually toggling them off.

Important - When toggling on/off a temporary exception, filter lists are now fully reloaded and this means there might be a perceptible delay when adding/removing temporary exceptions. At this point, this is considered to be an acceptable side-effect just to bring the ability to easily create temporary exception for network filters.

Clone this wiki locally