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

net/http: logging support #3344

Closed
wvh opened this issue Mar 18, 2012 · 14 comments
Closed

net/http: logging support #3344

wvh opened this issue Mar 18, 2012 · 14 comments

Comments

@wvh
Copy link

wvh commented Mar 18, 2012

This is a feature request.

I'm trying to implement Apache-style logging in my program, using camlistore's
logging.go as an example:

http://camlistore.org/code/?p=camlistore.git;a=blob;f=website/logging.go;hb=HEAD

While the code looks good, it hooks quite deeply into the http package's internals and
requires too much knowledge to be called trivial. Perhaps an easier logging hook should
be provided inside net/http/server.go in the Go standard library itself.

Any thoughts?
@bradfitz
Copy link
Contributor

Comment 1:

Labels changed: added priority-later, featurerequest, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 2:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 3:

Labels changed: added go1.1maybe.

@robpike
Copy link
Contributor

robpike commented Mar 7, 2013

Comment 4:

Labels changed: removed go1.1maybe.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 5:

Brad, any thoughts on a minimal tweak to allow logging in net/http?

Labels changed: added go1.2maybe.

Owner changed to @bradfitz.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 6:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Aug 30, 2013

Comment 7:

Not for 1.2.

Labels changed: removed go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 8:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 9:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 10:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 11:

Labels changed: added repo-main.

@rakyll
Copy link
Contributor

rakyll commented May 20, 2016

Is this issue still in the plans? We can hook a Logger to an http.Client and an http.Server.

@bradfitz bradfitz removed their assignment May 20, 2016
@bradfitz
Copy link
Contributor

Update: Camlistore's logging code is now here: https://github.com/camlistore/camlistore/blob/master/website/logging.go

This bug is about an interface for the HTTP server to report back stats about a handler's activity after it's done, to let another layer serialize it or sent it off to logging somewhere.

This can be done with Handler wrappers (as in Camlistore's code, and done by many others), but the HTTP server knows much more and more efficiently, so it could just be built-in.

There are still no plans, but somebody could work on it. I'd be happy to review.

It would need to work with both HTTP/1 and HTTP/2.

A good place to put the stats records is the new https://tip.golang.org/pkg/net/http/httptrace/ package, to not pollute the main http package godoc.

@tombergan
Copy link
Contributor

This is now a dup of #18997. See the following comment:
#18997 (comment)

@golang golang locked and limited conversation to collaborators Apr 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants