Problem
We published a "Logging Best Practices" style guide. It said: use JSON format, include correlation IDs, follow a consistent schema. Six months later, every service logged differently. Some used JSON, some didn't. Some had correlation IDs, most didn't. The style guide was ignored.
Key Insight
Standards that require discipline fail. Standards that require an import succeed.
We replaced the style guide with a shared logging library:
# Before: style guide that nobody followed
import logging
logger = logging.getLogger(__name__)
logger.info(f"Loan {loan_id} processed") # free-form string
# After: library that enforces the schema
from shared.logging import get_logger
logger = get_logger(__name__)
logger.info("loan_processed", loan_id=loan_id) # structured, typedThe library handles JSON serialization, correlation ID injection, and Datadog-compatible formatting. Teams just import it.
Takeaway
Ship a logging library with enforced schema. Import it, don't configure it. The best logging system is the one developers actually use consistently — make it the path of least resistance.