[PR #191] fix: resolve duplicate logging #194

Open
opened 2026-02-16 09:19:48 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-sandbox/pull/191
Author: @xAI-Infra
Created: 11/17/2025
Status: 🔄 Open

Base: mainHead: logfix


📝 Commits (2)

📊 Changes

1 file changed (+2 additions, -6 deletions)

View changed files

📝 internal/server/server.go (+2 -6)

📄 Description

  1. Duplicate Log Entries: Each request is logged twice
    • gin.Default() already includes the Logger middleware
    • In Debug mode, gin.Logger() was added again, causing duplicate logs

Reproduction

app:
  port: 8194
  debug: True
  key: dify-sandbox
max_workers: 4
max_requests: 50
worker_timeout: 5
python_path: /usr/local/bin/python3
enable_network: True # please make sure there is no network risk in your environment
enable_preload: False # please keep it as False for security purposes
allowed_syscalls: # please leave it empty if you have no idea how seccomp works
proxy:
  socks5: ''
  http: ''
  https: ''
curl -s -X POST http://localhost:8194/v1/sandbox/run \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: dify-sandbox" \
  -d '{
    "language": "python3",
    "code": "print(\"Hello from Dify Sandbox!\")\nprint(1 + 1)",
    "enable_network": false
  }'

[GIN] 2025/11/17 - 03:42:24 | 200 | 110.582µs | 172.17.0.1 | POST "/v1/sandbox/run"
[GIN] 2025/11/17 - 03:42:24 | 200 | 133.045µs | 172.17.0.1 | POST "/v1/sandbox/run"


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-sandbox/pull/191 **Author:** [@xAI-Infra](https://github.com/xAI-Infra) **Created:** 11/17/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `logfix` --- ### 📝 Commits (2) - [`76d283f`](https://github.com/langgenius/dify-sandbox/commit/76d283f9b850907a7ca0ff836f55b7d66be0ec38) fix logger - [`54edd88`](https://github.com/langgenius/dify-sandbox/commit/54edd8803e031958cf3788dac7f664100402cf66) fix logger ### 📊 Changes **1 file changed** (+2 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `internal/server/server.go` (+2 -6) </details> ### 📄 Description 1. **Duplicate Log Entries**: Each request is logged twice - `gin.Default()` already includes the `Logger` middleware - In Debug mode, `gin.Logger()` was added again, causing duplicate logs ## Reproduction ```yaml app: port: 8194 debug: True key: dify-sandbox max_workers: 4 max_requests: 50 worker_timeout: 5 python_path: /usr/local/bin/python3 enable_network: True # please make sure there is no network risk in your environment enable_preload: False # please keep it as False for security purposes allowed_syscalls: # please leave it empty if you have no idea how seccomp works proxy: socks5: '' http: '' https: '' ``` ```bash curl -s -X POST http://localhost:8194/v1/sandbox/run \ -H "Content-Type: application/json" \ -H "X-Api-Key: dify-sandbox" \ -d '{ "language": "python3", "code": "print(\"Hello from Dify Sandbox!\")\nprint(1 + 1)", "enable_network": false }' ``` [GIN] 2025/11/17 - 03:42:24 | 200 | 110.582µs | 172.17.0.1 | POST "/v1/sandbox/run" [GIN] 2025/11/17 - 03:42:24 | 200 | 133.045µs | 172.17.0.1 | POST "/v1/sandbox/run" --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 09:19:48 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-sandbox#194