Symfony Logging Ownership
packages/symfony is the long-term framework entrypoint for Symfony logging.
The current codebase still carries Symfony logging pieces under packages/logging, but the ownership line is now:
packages/symfonyowns the publicinstructor.loggingconfig subtree, Symfony bundle wiring, compiler passes, and framework-specific presetspackages/loggingowns reusable logging primitives such as pipelines, enrichers, filters, formatters, writers, and framework-agnostic listeners
Existing Symfony-Specific Surface
The current Symfony logging integration lives in these files:packages/logging/src/Factories/SymfonyLoggingFactory.phppackages/logging/src/Integrations/Symfony/InstructorLoggingBundle.phppackages/logging/src/Integrations/Symfony/DependencyInjection/InstructorLoggingExtension.phppackages/logging/src/Integrations/Symfony/DependencyInjection/Configuration.phppackages/logging/src/Integrations/Symfony/DependencyInjection/Compiler/WiretapEventBusPass.phppackages/logging/src/Integrations/Symfony/Resources/config/services.yaml
Migration Strategy
What moves behind packages/symfony
The following responsibilities should move into the new bundle surface:
- public config under
instructor.logging - service registration in
packages/symfony/resources/config/logging.yaml - compiler-pass ownership for wiring logging listeners into the package-owned event bus
- request, route, session, and security-aware enrichment that depends on Symfony container services
- preset selection for Symfony runtime shapes such as development, production, AgentCtrl, and later native-agent flows
What stays in packages/logging
These remain reusable logging building blocks:
LoggingPipeline- enrichers
- filters
- formatters
- writers
- generic event-pipeline listeners that do not need Symfony bundle ownership
packages/symfony side of the boundary even if it composes reusable logging primitives.
Compatibility Plan
The existingInstructorLoggingBundle should be treated as a compatibility layer during migration, not the future public surface.
Recommended path:
- Implement
instructor.logginginpackages/symfony. - Keep the current
instructor_loggingbundle path temporarily as a shim. - Translate or proxy the old bundle behavior onto the new package-owned services where practical.
- Mark the old Symfony logging bundle path as deprecated once the new bundle wiring is complete.
- Remove the old bundle path only after the Symfony package is documented and stable for at least one normal release cycle.
Current Config Surface
The bundle-owned logging subtree now lives underinstructor.logging:
enabled: falseso logging remains opt-in until the Symfony package finishes its observability presetspreset: productionfor the safest default baseline once enabledevent_bus_service: Cognesy\Events\Contracts\CanHandleEventsso logging attaches to the package-owned event bus by defaultdevelopmentis the supported development preset name; the olderdefaultpreset remains as a deprecated alias for one release cycle
packages/symfony owns the config root, service registration, and event-bus wiretap wiring. The underlying pipeline implementation still composes reusable primitives from packages/logging.
Presets
packages/symfony now ships three practical preset paths:
development: debug-friendly logging with request and user enrichment, high-value templates for Instructor, native-agent, and AgentCtrl events, and low-value HTTP or streaming noise suppressed by defaultproduction: warning-and-above logging with noisy debug, partial-response, and streaming delta events filtered outcustom: start with the reusable primitives and overridechannel,level,exclude_events,include_events, andtemplatesdirectly
default preset is accepted as a compatibility alias and emits a deprecation warning so existing configs can migrate to development without breaking.
Legacy Bundle Path
The olderCognesy\Logging\Integrations\Symfony\InstructorLoggingBundle still works as a compatibility layer, but it now emits a deprecation warning at load time. The supported installation path is:
- install
cognesy/instructor-symfony - enable
Cognesy\Instructor\Symfony\InstructorSymfonyBundle - configure logging under
instructor.logging
Concrete Migration Steps
If your app currently enables the legacy bundle:- move from
instructor_loggingtoinstructor.logging - rename the old
defaultpreset todevelopment - keep using
event_bus_serviceonly if you intentionally wire logging to a non-default package-owned bus - keep custom
exclude_events,include_events, andtemplatesarrays; the new bundle still passes those through to the reusable logging pipeline primitives
Implementation Guidance
When later tasks wire logging for real:- prefer
instructor.loggingover a second config root - reuse
packages/loggingprimitives instead of copying logic - keep event-bus attachment aligned with the package-owned
CanHandleEventsservice frompackages/symfony - avoid leaving request or security enrichment factories in
packages/loggingonce the Symfony package owns the bundle surface
- Symfony apps install
cognesy/instructor-symfony - Symfony logging is configured through the same
instructorroot as the rest of the package packages/loggingremains reusable outside Symfony without owning a second framework bundle long term