archivebox.core.settings_logging

Module Contents

Classes

NoisyRequestsFilter

DaphneCloseTimeoutFilter

Drop daphne’s noisy “killed slow response after client disconnect” warning.

AsyncioCancelledShieldFilter

Drop asyncio’s “CancelledError exception in shielded future” noise.

CustomOutboundWebhookLogFormatter

StripANSIColorCodesFilter

Data

IGNORABLE_URL_PATTERNS

ERROR_LOG

LOGS_DIR

LOG_LEVEL_DATABASE

LOG_LEVEL_REQUEST

SETTINGS_LOGGING

API

archivebox.core.settings_logging.IGNORABLE_URL_PATTERNS[source]

None

class archivebox.core.settings_logging.NoisyRequestsFilter(name='')[source]

Bases: logging.Filter

filter(record) bool[source]
class archivebox.core.settings_logging.DaphneCloseTimeoutFilter(name='')[source]

Bases: logging.Filter

Drop daphne’s noisy “killed slow response after client disconnect” warning.

Daphne emits this whenever a request handler is still running when the client disconnects (e.g. iframe gets navigated away mid-response while fetching favicon / screenshot / preview html). For our use case these are always benign — the disconnect is the browser cancelling a request, not a server-side fault — so we suppress them outright rather than spamming WARNING. Other daphne.server lines pass through unchanged.

Initialization

Initialize a filter.

Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.

filter(record) bool[source]
class archivebox.core.settings_logging.AsyncioCancelledShieldFilter(name='')[source]

Bases: logging.Filter

Drop asyncio’s “CancelledError exception in shielded future” noise.

When a browser disconnects mid-request, daphne cancels the asgi task and asgiref’s sync_to_async shields the synchronous Django view via asyncio.shield(exec_coro). The shield wakes up to find its parent cancelled and re-raises CancelledError; asyncio’s default exception handler then logs the full traceback via the asyncio logger. There’s nothing the server can do (the client is already gone), so these tracebacks are pure noise and cause hundreds of lines of spam per disconnect.

We match conservatively: only drop the specific shielded-future message that points back into asgiref’s shield path. Other asyncio errors fall through unchanged.

Initialization

Initialize a filter.

Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.

filter(record) bool[source]
class archivebox.core.settings_logging.CustomOutboundWebhookLogFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]

Bases: logging.Formatter

format(record)[source]
class archivebox.core.settings_logging.StripANSIColorCodesFilter(name='')[source]

Bases: logging.Filter

_ansi_re[source]

‘compile(…)’

_bare_re[source]

‘compile(…)’

filter(record) bool[source]
archivebox.core.settings_logging.ERROR_LOG[source]

None

archivebox.core.settings_logging.LOGS_DIR[source]

None

archivebox.core.settings_logging.LOG_LEVEL_DATABASE[source]

‘WARNING’

archivebox.core.settings_logging.LOG_LEVEL_REQUEST[source]

‘WARNING’

archivebox.core.settings_logging.SETTINGS_LOGGING[source]

None