Skip to content

Add detail log for debug.#1226

Merged
hiworldwzj merged 3 commits intomainfrom
add_log
Mar 11, 2026
Merged

Add detail log for debug.#1226
hiworldwzj merged 3 commits intomainfrom
add_log

Conversation

@hiworldwzj
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the debugging capabilities of the LightLLM server by introducing a new --detail_log flag. This flag enables more granular logging of request inputs, shared memory management, and batch processing, providing developers with deeper insights into the system's behavior during request handling and resource allocation. The changes are focused on improving observability for troubleshooting without altering core functionality.

Highlights

  • New Debug Logging Flag: A new command-line argument --detail_log has been introduced to enable more verbose debugging output for requests.
  • Detailed Request Input Logging: When --detail_log is enabled, the system will now log the full prompt, sampling parameters, and token IDs for each request, aiding in debugging input processing.
  • Enhanced Request Lifecycle Logging: Debug logs have been added to track the allocation and release of shared memory requests within the HTTP server and router components, including request IDs and shared memory indices.
  • Improved Batch Information: The simple_log method for request batches now includes shared memory index details, providing more context for batch processing.
  • Aborted Request Debugging: Debug logs were added across various request queue implementations to specifically log details of aborted requests, including their request ID and shared memory index.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • lightllm/server/api_cli.py
    • Added --detail_log command-line argument.
  • lightllm/server/core/objs/start_args_type.py
    • Added detail_log boolean field to StartArgs.
  • lightllm/server/httpserver/manager.py
    • Added debug log for shared memory request allocation details.
    • Implemented conditional debug logging for prompt, sampling parameters, and token IDs when detail_log is enabled.
    • Added debug log for shared memory request release details.
  • lightllm/server/router/batch.py
    • Modified simple_log to include shared memory index alongside request IDs.
  • lightllm/server/router/manager.py
    • Added an informational log when a new batch is generated.
  • lightllm/server/router/req_queue/chunked_prefill/beam_impl.py
    • Imported and initialized logger.
    • Added debug log for aborted requests including request ID and shared memory index.
  • lightllm/server/router/req_queue/chunked_prefill/impl.py
    • Imported and initialized logger.
    • Added debug log for aborted requests including request ID and shared memory index.
  • lightllm/server/router/req_queue/chunked_prefill/impl_for_nixl_pd.py
    • Imported and initialized logger.
    • Added debug log for aborted requests including request ID and shared memory index.
  • lightllm/server/router/req_queue/chunked_prefill/impl_for_pd_decode.py
    • Imported and initialized logger.
    • Added debug log for aborted requests including request ID and shared memory index.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a --detail_log flag to enable more verbose logging for debugging purposes. While this is a useful addition for development and troubleshooting, logging full user prompts poses a significant security and privacy risk as they may contain sensitive information or PII. The implementation also includes several other debug and info logs to improve observability, and my review includes minor suggestions to fix a typo in a log message and remove some redundant code for better clarity and maintainability.

Comment on lines +447 to +452
if self.args.detail_log:
logger.debug(
f"req_id: {sampling_params.group_request_id} prompt: {prompt},\n"
f"samplingparmas: {sampling_params.to_dict()}\n"
f"token_ids: {prompt_ids}"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

When the --detail_log flag is enabled, the server logs the full content of the user-provided prompt and its corresponding token IDs at the DEBUG level. LLM prompts frequently contain sensitive information, including Personally Identifiable Information (PII), proprietary data, or even secrets. Logging this information to persistent storage poses a significant privacy and security risk, as it could lead to unauthorized exposure of sensitive user data if log files are compromised or improperly handled. Additionally, there's a typo in the log message: samplingparmas should be samplingparams.

                    f"samplingparams: {sampling_params.to_dict()}\n"

Comment on lines +125 to +126
req: Req = req
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The line req: Req = req is a redundant type hint. The type of req is already inferred from the abort_req_list iterable, so this line can be removed for better code clarity. This redundant pattern appears in a few other files in this pull request.

Suggested change
req: Req = req
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")

Comment on lines +102 to +103
req: Req = req
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The line req: Req = req is a redundant type hint. The type of req is already inferred from the abort_req_list iterable, so this line can be removed for better code clarity.

Suggested change
req: Req = req
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")

Comment on lines +93 to +94
req: Req = req
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The line req: Req = req is a redundant type hint. The type of req is already inferred from the abort_req_list iterable, so this line can be removed for better code clarity.

Suggested change
req: Req = req
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")

Comment on lines +58 to +59
req: Req = req
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The line req: Req = req is a redundant type hint. The type of req is already inferred from the abort_req_list iterable, so this line can be removed for better code clarity.

Suggested change
req: Req = req
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")
logger.debug(f"router abort req id {req.request_id} shm_index: {req.index_in_shm_mem}")

@hiworldwzj hiworldwzj merged commit 6392e10 into main Mar 11, 2026
1 check passed
@hiworldwzj hiworldwzj deleted the add_log branch March 11, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant