~learn.
0:00 / 1:22
LLD · Logging framework

The log disk is full. So the logger logs that. To the disk.

transcript

The log disk is full. Every write to it fails. So the logger logs the failure. Through itself. Onto the full disk.

A logger publishes every record to a bus. Sinks subscribe to it. Here, the console. And a sink that writes to disk. Search logs a slow query warning. The disk sink throws. Disk full.

No isolation? The exception stops the delivery loop. Every other sink is skipped. The console never prints. Worse, the exception reaches the caller. Search was only logging a warning.

So the bus guards every sink. The disk sink throws? Catch it. Count it. Sink errors: one. Carry on. The console still prints the warning. Search never sees an error.

But here's the catch. Shouldn't the broken sink report its error? Log it, like everything else?

It logs disk full, through the same bus. The bus delivers that record to every sink. Including the broken one. Which fails again. And logs again. Forever.

So sinks report their problems through a counter. Never through the logger. A broken sink fails alone. It never silences the others, or loops on itself.

Full breakdown in the lecture.