An extension to log through standard logging module

Georges Racinet georges.racinet at
Tue Jul 16 13:27:54 EDT 2019

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


[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
GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Mercurial-devel mailing list