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

Zend Log Laravel Package

zendframework/zend-log

Zend Log is a PHP logging component for writing messages to multiple backends (files, syslog, databases, email) with flexible formatting, filters, and priorities. Part of Zend Framework, it helps you capture, route, and manage application logs reliably.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install via Composer: composer require zendframework/zend-log
  • Create a basic logger in your bootstrap or service manager: instantiate Zend\Log\Logger and attach writers (e.g., Zend\Log\Writer\Stream for file logging)
  • First use case: log errors or activity to a local file:
    $logger = new Zend\Log\Logger();
    $logger->addWriter(new Zend\Log\Writer\Stream('data/logs/app.log'));
    $logger->err('Something went wrong');
    
  • Review the Zend Framework logging documentation (archived but still accessible) and examine src/Logger.php and src/Writer/ for core classes.

Implementation Patterns

  • Structured logging: Use Zend\Log\Formatter\JsonFormatter or custom formatters to emit JSON logs for compatibility with modern log aggregators (e.g., ELK, Datadog)
  • Priority-based filtering: Attach filters to writers (e.g., Zend\Log\Filter\Priority) to suppress low-priority messages in production:
    $writer->addFilter(new Zend\Log\Filter\Priority(Zend\Log\Logger::WARNING));
    
  • DI via service manager: Register LoggerInterface and wire up with ZendLogFactory in Zend Expressive/Laminas applications
  • PSR-3 bridge: Use Zend\Log\Logger as a PSR-3 logger (it implements Psr\Log\LoggerInterface) for drop-in compatibility with PSR-compliant tools
  • Async/async-like logging: Pair with Zend\Log\Writer\Stream and buffered writers to batch writes for performance-critical flows

Gotchas and Tips

  • Deprecated but stable: This package is archived (as of 2022); migrate to laminas/laminas-log (composer require laminas/laminas-log) to receive ongoing fixes
  • Namespace deprecation warnings: After migration to Laminas, ensure autoloading isn’t broken by lingering Zend\* references in your config or factories
  • Stream writer path pitfalls: Ensure the log file path is writable; use absolute paths instead of relative ones to avoid permission or working-directory issues
  • Formatter order matters: Add formatters before adding writers; once attached, reconfiguring the formatter may not propagate
  • Missing async support: For high-volume apps, consider wrapping writes in a background job (e.g., queues with RabbitMQ or Redis) since this package is synchronous by default
  • Debugging tip: Enable Zend\Log\Logger::DEBUG in development to trace internal behavior—check Zend\Log\Logger::DEBUG vs. Zend\Log\Logger::NOTICE priorities for granular control
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport