Design a logging framework
The interviewer asks you to design the classes behind a logger: any part of a program writes a line, and each line ends up in the right places. Picture the office at a zoo. Keepers drop notes into a wire tray, and one helper copies each note into the day book, and phones the vet when a note is urgent. A note too minor to keep never goes in the tray. If the tray is full, the new note stays out, and a tally on the side counts it. At closing, a "last one" card goes in the tray, and the helper goes home on reaching it.
It is also asked as "design a logger" or "design Log4j". The closest other case study is the pub/sub broker, which also hands messages between threads. Interviewers like it because two patterns are tempting, so the round tests whether you use a pattern only when it earns its place. This page is the class-level part. What to log, and what logs cost across a fleet, belongs to Observability.
Below is a full 45-minute round on the LLD framework. You are the candidate. At each Guess before you read on, stop and answer first. The full runnable project, with its tests, is a download in Java, JavaScript and Python.
Run the full project
This design as a project you can run, with its tests and a demo. You only need Java 21, Node 24 or Python 3.13. The README says how to run it.
Step 1 · Clarify the requirements and cut the scope
Minutes 0–5 · How this step works
Interviewer: Design a logging framework.
You: Which levels do you need?
Interviewer: DEBUG, INFO, WARN and ERROR.
You: Where do lines go, and does each place get every level?
Interviewer: The console shows INFO and above. A file keeps everything.
You: What does a line hold?
Interviewer: The time, the level, the logger's name and the message, as plain text.
You: Do many threads write at once?
Interviewer: Yes. Assume 50 threads and about 2,000 lines a second at peak. Logging must not slow a request down.