Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Fix: Add missing logging configuration#94

Merged
jordanpartridge merged 2 commits into
masterfrom
fix/add-logging-config
Dec 6, 2025
Merged

Fix: Add missing logging configuration#94
jordanpartridge merged 2 commits into
masterfrom
fix/add-logging-config

Conversation

@jordanpartridge
Copy link
Copy Markdown
Contributor

@jordanpartridge jordanpartridge commented Aug 6, 2025

Summary

  • Fixes 'Call to undefined method Psr\Log\NullLogger::channel()' error
  • Adds proper logging.php configuration file

Problem

When running Conduit commands like conduit spotify:play, users encounter:

Error: Call to undefined method Psr\Log\NullLogger::channel()

This happens because Laravel's exception handler expects a logger with a channel() method but receives NullLogger when no logging configuration exists.

Solution

Added a proper logging.php configuration file with:

  • Default single file logging channel
  • Null channel for suppressing deprecations
  • Daily rotation option
  • Emergency logging support
  • Proper storage path handling for global installations

Test Plan

  1. Install Conduit globally via Composer
  2. Run conduit spotify:play or any other command
  3. Verify no NullLogger errors occur

Summary by CodeRabbit

  • New Features

    • Introduced a new logging configuration, allowing customization of log channels, log levels, file paths, and retention periods.
    • Added dedicated logging for deprecation warnings.
  • Chores

    • Enhanced environment variable support for flexible logging setup.

Resolves 'Call to undefined method Psr\Log\NullLogger::channel()' error that occurs when Laravel's exception handler tries to log deprecation warnings.

The issue happens because Laravel expects a logger with channel() method but receives NullLogger when no logging config exists.

This commit adds a proper logging.php configuration with:
- Default single file logging channel
- Null channel for suppressing deprecations
- Daily rotation option
- Emergency logging support
- Proper storage path handling for global installations
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 6, 2025

Walkthrough

A new logging configuration file (config/logging.php) has been introduced. This file defines the application's default logging channel, settings for deprecation warnings, and multiple log channels with their respective parameters. It leverages environment variables for customization and includes dedicated handling for deprecation logs.

Changes

Cohort / File(s) Change Summary
Logging Configuration
config/logging.php
Added a configuration file specifying default log channel, deprecation settings, and multiple log channels with support for environment-based customization.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

In the warren, logs now flow,
With channels set for high and low.
Deprecations get their space,
Each message finds its proper place.
A rabbit’s joy, configuration neat—
Logging made both strong and sweet!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/add-logging-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
config/logging.php (1)

14-25: Hard-coded slash concatenation risks malformed paths
Every channel builds its path with:

env('CONDUIT_STORAGE_PATH', storage_path()) . '/logs/…'

If CONDUIT_STORAGE_PATH is set with a trailing slash (e.g. /var/lib/conduit/), the resulting path contains a double slash (//logs/…). While most filesystems ignore this, it breaks unit tests on Windows and complicates path comparisons.

Tiny utility to normalise:

-$base = env('CONDUIT_STORAGE_PATH', storage_path());
-$path = $base . '/logs/conduit.log';
+$base = rtrim(env('CONDUIT_STORAGE_PATH', storage_path()), DIRECTORY_SEPARATOR);
+$path = $base . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . 'conduit.log';

You could extract this into a local helper to avoid duplication across channels.

Also applies to: 32-38

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 278ec37 and a0d171f.

📒 Files selected for processing (1)
  • config/logging.php (1 hunks)
🔇 Additional comments (1)
config/logging.php (1)

27-30: LGTM – correct use of Monolog’s NullHandler
The "null" channel is properly configured and will discard any messages routed to it without raising further exceptions.

Comment thread config/logging.php
Comment on lines +6 to +9
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Defaulting deprecation logging to “null” silently drops important information
LOG_DEPRECATIONS_CHANNEL falls back to "null", which maps to a NullHandler. This means all deprecation warnings are discarded unless the operator explicitly overrides the env var. Given that deprecations often signal upcoming breaking changes, silently dropping them may hide valuable signals during upgrades.

Consider switching the fallback to your dedicated "deprecations" channel and let users opt-out explicitly if they really want to suppress them.

-        'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
+        'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'deprecations'),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'deprecations'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
🤖 Prompt for AI Agents
In config/logging.php around lines 6 to 9, the default fallback for
LOG_DEPRECATIONS_CHANNEL is set to "null", which causes deprecation warnings to
be discarded silently. Change the default fallback value from "null" to
"deprecations" so that deprecation logs are sent to a dedicated channel by
default, allowing users to explicitly opt out if they want to suppress these
warnings.

@jordanpartridge jordanpartridge merged commit d8ad335 into master Dec 6, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant