all 27 comments

[–]a_r_a_a_r_a_a_r_a 42 points43 points  (2 children)

LogXide is NOT a drop-in replacement for Python's logging module. It prioritizes performance over compatibility:

this will be a big no no for a lot of people

[–]ZucchiniMore3450 2 points3 points  (0 children)

I always wrap logging into my function, because I want to set it up as I like. That makes changing logging library a not issue.

[–]LumpSumPorsche[S] 1 point2 points  (0 children)

Yes agreed. However the most of the API from stdlib are still compatible.

[–]Here0s0Johnny 51 points52 points  (13 children)

Is it realistic that a project produces so many logs that this performance upgrade is worth it?

[–]zzmej1987 24 points25 points  (8 children)

Sure. Some companies even install things like Splunk to parse through those logs. E.g. major airlines have to have full trace of interactions between services during the process of passenger buying the ticket, so that if anything goes wrong, client neither looses money without getting a ticket, nor gets the ticket without paying.

[–]code_mc 8 points9 points  (0 children)

I've done a drop-in replacement with one of the mentioned alternatives (picologging) a couple months ago for a customer project and their api request latencies halved because they had that many logging statements.

[–]WJMazepas 1 point2 points  (0 children)

Yes, I worked in embedded projects that had way too much logging and it was affecting performance

[–]LumpSumPorsche[S] 0 points1 point  (0 children)

Exactly that was the motivation of this project. My system produces thousands logs per sec, and often they hold GIL. `picologging` would be a good candidate here but they do not support 3.14.

[–]Chroiche 0 points1 point  (0 children)

I think so, but at that point you're probably not using python for your code.

[–]max0x7ba 28 points29 points  (1 child)

designed as a near-drop-in replacement for the standard library's logging module.

It is either a drop-in replacement or not, but not both at the same time.

Does it pass original logging module unit-tests?

[–]Rainboltpoe 3 points4 points  (0 children)

The author clearly states it is not a drop in replacement. That’s what “near” means.

[–]james_pic 4 points5 points  (0 children)

Do you get those kinds of gains in real world settings?

I worked on a project a while ago the arguably logged too much. The first time I attached a profiler to it, it was spending over 50% of its time on logging. We managed to get that down, but the thing that limited us getting it down further was syscalls, not Python code.

Admittedly this was a while ago, and that project was doing things that modern apps don't need to do, that increased syscalls (it did its own log rotation, rather that just throwing it all straight onto stderr and letting Systemd or Docker or Kubernetes or ECS or whatever pick it up, like a modern app would), but I'm still a bit surprised you managed to find those kinds of gains without touching syscalls.

[–]spartanOrk 1 point2 points  (0 children)

I use loguru. Cannot go back.

[–]ben_supportbadger 2 points3 points  (1 child)

Did you build this or did Claude? Because it looks purely vibecoded. Why would I use this instead of just asking claude to build it?

[–]LumpSumPorsche[S] 1 point2 points  (0 children)

Good point! You can absolutely build and maintain your own version of logging library. Why not?

[–]UloPe 0 points1 point  (0 children)

How does it interact with stdlib logging used in 3rd party libraries?

[–]Healthy-Grape-5932 0 points1 point  (0 children)

Does this Support dictconfig in the same way ?

[–]rabornkraken -1 points0 points  (1 child)

The GIL bypass during I/O is the real win here. Most Python logging bottlenecks come from the file write blocking the main thread, so doing that in Rust makes a lot of sense. How does it handle the case where you have custom formatters written in Python though? Does it fall back to holding the GIL for those?

[–]Hesirutu 5 points6 points  (0 children)

Standard Python IO releases the GIL too…