Skip to content

net/http: logging support #3344

Closed
Closed
@wvh

Description

@wvh
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?

Activity

bradfitz

bradfitz commented on Mar 18, 2012

@bradfitz
Contributor

Comment 1:

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

rsc

rsc commented on Sep 12, 2012

@rsc
Contributor

Comment 2:

Status changed to Accepted.

rsc

rsc commented on Sep 12, 2012

@rsc
Contributor

Comment 3:

Labels changed: added go1.1maybe.

robpike

robpike commented on Mar 7, 2013

@robpike
Contributor

Comment 4:

Labels changed: removed go1.1maybe.

rsc

rsc commented on Jul 30, 2013

@rsc
Contributor

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

rsc commented on Jul 30, 2013

@rsc
Contributor

Comment 6:

Labels changed: added feature.

robpike

robpike commented on Aug 30, 2013

@robpike
Contributor

Comment 7:

Not for 1.2.

Labels changed: removed go1.2maybe.

rsc

rsc commented on Nov 27, 2013

@rsc
Contributor

Comment 8:

Labels changed: added go1.3maybe.

rsc

rsc commented on Nov 27, 2013

@rsc
Contributor

Comment 9:

Labels changed: removed feature.

rsc

rsc commented on Dec 4, 2013

@rsc
Contributor

Comment 10:

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

rsc

rsc commented on Dec 4, 2013

@rsc
Contributor

Comment 11:

Labels changed: added repo-main.

9 remaining items

rakyll

rakyll commented on May 20, 2016

@rakyll
Contributor

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

added
FeatureRequestIssues asking for a new feature that does not need a proposal.
on May 20, 2016
removed their assignment
on May 20, 2016
bradfitz

bradfitz commented on May 20, 2016

@bradfitz
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

tombergan commented on Apr 24, 2017

@tombergan
Contributor

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

locked and limited conversation to collaborators on Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bradfitz@rsc@rakyll@wvh@robpike

        Issue actions

          net/http: logging support · Issue #3344 · golang/go