Overview
Fracta uses Go’slog/slog for structured JSON logging, wrapped by the internal/fractalog package. All log output includes a "component" tag identifying the subsystem that emitted it.
Fracta also has an internal event bus for structured lifecycle and infrastructure events. The event bus does not replace slog or fractalog; it uses them through LogSink. See docs/event-bus.md for the event-bus architecture and how it relates to logging.
Configuration
Add alogging section to fracta.yaml:
- Absolute path (e.g.,
/var/log/fracta.log) — used as-is - Relative path or bare filename (e.g.,
fracta.log,logs/fracta.log) — resolved from the working directory where thefractabinary runs
logging.level in config > FRACTA_LOG_LEVEL env var > default (info)
When logging.file is set, logs go to both stderr and the file. When omitted, logs go to stderr only (original behavior).
Full fracta.yaml example
Architecture
Event Bus Interaction
Logging architecture is still based onslog + fractalog.
What changed with spec-28 is the path for event-style observability:
- bus emitters send
events.Eventthroughevents.Bus LogSinkwrites the event as a normal structured log line under componenteventsStoreSinkpersists the event without logging againK8sEventSinkmay also export selected events to Kubernetes Events in K8s mode
- ordinary application logs still use
fractalog.Component("name")directly - bus events become structured log lines through
LogSink - logging configuration and output destinations are unchanged
Usage
Struct with a logger field
Standalone function
Rules
- Always use
fractalog.Component("name")— never bareslog.Info()orslog.Default().With("component", ...). - Never use package-level
var log = fractalog.Component(...)— the handler is captured at call time, which is beforeAttachFileruns. Always create loggers inside functions. - Component names should match the package or subsystem name (e.g.,
"gateway","reconciler","serve","worker").
Component Registry
| Component | Package |
|---|---|
serve | cmd/serve.go |
worker | cmd/worker.go |
controlplane | internal/controlplane |
reaper | internal/controlplane |
signal-handler | internal/controlplane |
admission | internal/admission |
orchestrator | internal/orchestrator |
worker | internal/worker |
pgqueue | internal/queue/postgres |
mcpclient | internal/mcpclient |
mcpserver | internal/mcpserver |
strategy | internal/mcpserver (strategy tools) |
gateway | internal/gateway |
graph | internal/graph/falkordb |
rag | internal/graph/rag |
reconciler | internal/registry |
sidecar | internal/strategy |
mailbox | internal/state/sqlitestore |
config | internal/config |
loaders | internal/loaders |

