Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log line accumulation JSON logging #78

Closed
odise opened this issue Jan 18, 2024 · 2 comments
Closed

log line accumulation JSON logging #78

odise opened this issue Jan 18, 2024 · 2 comments

Comments

@odise
Copy link

odise commented Jan 18, 2024

I just noticed that the /json endpoint seems to accumulating log messages in a strange (non-compliant JSON) way since version 0.3.0. Here is an example based on the code in the _example directory. In a nutshell log lines will grow with each request.

go run main.go
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /pong                     --> main.main.func1 (2 handlers)
[GIN-debug] GET    /ping                     --> main.main.func2 (2 handlers)
[GIN-debug] GET    /skip                     --> main.main.func3 (2 handlers)
[GIN-debug] GET    /regexp1                  --> main.main.func4 (2 handlers)
[GIN-debug] GET    /regexp2                  --> main.main.func5 (2 handlers)
[GIN-debug] GET    /id                       --> main.main.func8 (3 handlers)
[GIN-debug] GET    /json                     --> main.main.func10 (2 handlers)
[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Listening and serving HTTP on :8080
{"level":"info","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.013785,"user_agent":"curl/8.4.0","time":"2024-01-18T10:45:20+01:00","message":"Request"}
{"level":"info","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.013785,"user_agent":"curl/8.4.0","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.00572,"user_agent":"curl/8.4.0","time":"2024-01-18T10:45:22+01:00","message":"Request"}
{"level":"info","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.013785,"user_agent":"curl/8.4.0","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.00572,"user_agent":"curl/8.4.0","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.009236,"user_agent":"curl/8.4.0","time":"2024-01-18T10:45:24+01:00","message":"Request"}
{"level":"info","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.013785,"user_agent":"curl/8.4.0","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.00572,"user_agent":"curl/8.4.0","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.009236,"user_agent":"curl/8.4.0","status":200,"method":"GET","path":"/json","ip":"::1","latency":0.014365,"user_agent":"curl/8.4.0","time":"2024-01-18T10:45:27+01:00","message":"Request"}

Any idea whats wrong here?

@mgabeler-lee-6rs
Copy link
Contributor

This is #68, to be fixed by #69

@mgabeler-lee-6rs
Copy link
Contributor

This should be fixed in v1.1.0: #69 (comment)

@appleboy appleboy closed this as completed May 1, 2024
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

No branches or pull requests

3 participants