An extension to log through standard logging module

Augie Fackler raf at durin42.com
Thu Jul 18 14:16:47 EDT 2019



> On Jul 16, 2019, at 13:27, Georges Racinet <georges.racinet at octobus.net> wrote:
> 
> Hi there,
> 
> for the needs of Heptapod [1], I ended up writing a small extension to
> divert all possible console output to the standard logging module, with
> the option to send the logs to a Sentry application.
> 
> The source is at https://dev.heptapod.net/heptapod/hgext-loggingmod and
> its README provides a fairly complete documentation.
> 
> I think this extension would be useful in many more general server
> settings, and should therefore probably be versioned with hg-core. Some
> polishing would have to be made to bring it up to standard, and I'd be
> happy to do that if people are interested.
> 
> A short rationale:
> 
> - blackbox only registers to `ui.log`, which itself doesn't have much,
> unless `ui.debug` is True [2]. Also, it insists on outputting the logs
> into the `.hg` directory, and that's pretty much useless for a multi
> repo server
> 
> - logtoprocess also registers to `ui.log`.
> 
> - I wanted to make it easy to use Sentry, especially since GitLab has an
> option to send its logs to Sentry by default, unsurprisingly covering
> everything but Mercurial
> 
> - I wanted to make it easily configurable, and to provide repository
> information to use in the format. Together with the PID, that makes it
> possible to extract only log lines pertaining to a given request.
> 
> What do you think ?

I think it makes sense. Kyle, I think we might want this for some of our hg API servers too? Having it in core seems sensible to me.

> 
> Cheers,
> 
> [1] That is, our modified GitLab CE that supports Mercurial
> 
> [2] with `ui.debug` set to True, some of that debugging info actually
> spills into the HTTP responses, making them incorrect.
> 
> 
> -- 
> Georges Racinet
> https://octobus.net
> GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics
> 
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list