Skip to content

Conversation

@goatwu1993
Copy link
Contributor

@goatwu1993 goatwu1993 commented Nov 21, 2025

fix #2682


Summary by cubic

Stop Chainlit from changing global logging when imported as a library. Move logging.basicConfig to the CLI entrypoint and remove it from chainlit.logger, while keeping socketio/engineio loggers at ERROR.

Written for commit aff41d1. Summary will update automatically on new commits.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. backend Pertains to the Python backend. bug Something isn't working labels Nov 21, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="backend/chainlit/cli/__init__.py">

<violation number="1" location="backend/chainlit/cli/__init__.py:34">
The new logging format drops the log level and logger name, so CLI logs no longer show whether a line is INFO, WARNING, or ERROR, making diagnosing issues significantly harder.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@asvishnyakov
Copy link
Member

asvishnyakov commented Nov 21, 2025

@goatwu1993 While this PR fixes issue, I don't thin that's right solution, as it will change how logging is working for existing users. To make logging.basicConfig working in you app, you just run it before chainlit, in __init__.py, for example or call it with force=True parameter

@goatwu1993
Copy link
Contributor Author

logging.basicConfig working in you app, you just run it before chainlit, in init.py, for example

Tried it no luck. Also library package should almost NEVER config logging themself, making importer have to configure logging before/after chainlit import.

@nzjrs
Copy link

nzjrs commented Nov 26, 2025

Thanks @goatwu1993 - I also recently noticed that chainlit was doing this. You are correct, libraries should never configure global logging.

@hayescode hayescode added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@hayescode hayescode added this pull request to the merge queue Dec 4, 2025
Merged via the queue into Chainlit:main with commit 4312b18 Dec 4, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Pertains to the Python backend. bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chainlit sets logging format before application code

4 participants