Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Propel Logger Bundle Laravel Package

divi/propel-logger-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation: Add to composer.json under require-dev:

    "divi/propel-logger-bundle": "2.2.*@dev"
    

    Run composer update divi/propel-logger-bundle.

  2. Enable Bundle: Register in AppKernel.php:

    new Divi\PropelLoggerBundle\DiviPropelLoggerBundle(),
    
  3. Configure: Define namespaces in config.yml (e.g., ["Acme", "Foo\\Bar"]).

    divi_propel_logger:
        namespaces: ["Acme"]
    
  4. First Use Case: Trigger a Propel query in your controller/service. Open the Symfony Profiler (e.g., /_profiler/). The Propel Logger tab will now show:

    • Full query stacktraces (file/class context).
    • Duplicate queries (highlighted for optimization).

Implementation Patterns

Workflow Integration

  1. Debugging Queries:

    • Use the Profiler tab to inspect slow or duplicate queries.
    • Click a stacktrace to jump to the exact line in your code (via IDE or browser).
  2. Performance Tuning:

    • Filter queries by namespace (e.g., Acme\Service) to isolate bottlenecks.
    • Reuse QueryModel objects to avoid duplicates (the bundle flags them).
  3. Conditional Logging:

    • Disable in production by removing the bundle from AppKernel.php or setting divi_propel_logger.enabled: false in config.
  4. Custom Logging:

    • Extend the logger by overriding Divi\PropelLoggerBundle\Logger\PropelLogger and inject your instance via dependency injection.

Common Use Cases

  • Development: Identify N+1 queries or inefficient joins.
  • Code Reviews: Share profiler snapshots to highlight query issues.
  • Legacy Code: Pinpoint where Propel queries are called indirectly (e.g., via services).

Gotchas and Tips

Pitfalls

  1. Namespace Regex Quirk:

    • Use Foo\\Bar (double backslash) for exact matches. Omitting it treats it as a regex.
    • Example: ["Acme", "App\\Controller"] logs only those classes.
  2. Performance Overhead:

    • Only use in dev/staging. The bundle adds ~5–10% overhead to Propel queries.
    • Exclude heavy endpoints (e.g., APIs) by filtering namespaces.
  3. Symfony 2.2+ Only:

    • Fails silently on older versions. Check AppKernel.php for compatibility.
  4. Profiler Cache:

    • Clear cache (php app/console cache:clear) if logs don’t appear after config changes.

Debugging Tips

  • Missing Logs?:
    • Verify divi_propel_logger.namespaces includes your app’s namespace.
    • Check AppKernel.php for the bundle registration.
  • Stacktrace Truncation:
    • Increase xdebug.max_nesting_level in php.ini if queries span many levels.
  • Duplicate Queries:
    • Use QueryModel::clear() sparingly—it resets the entire query cache.

Extension Points

  1. Custom Formatter:
    • Override Divi\PropelLoggerBundle\Formatter\QueryFormatter to change output (e.g., add execution time).
  2. Event Listeners:
    • Subscribe to propel.logger.query events to log queries to external tools (e.g., Datadog).
  3. Propel Events:
    • Hook into propel.logger.before_query to modify queries dynamically.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui