r/java
•
u/agentoutlier
•
19d ago
•
1
Rainbow Gum logging released v1.0.0 and why you should switch Now!
After 3 years and an embarrassing amount of personal and business time spent I finally am releasing Rainbow Gum 1.0.0.
I spent an enormous amount of time on Rainbow Gum because I know how important getting logging right is despite on the surface appearing very easy.
While I may be critical of the existing logging frameworks Rainbow Gum stands on the shoulders of these giants and why it is largely better is because of them.
Rainbow Gum is:
- Is very secure. I can't say its more secure than the others because that would get me in trouble but if you were to put a gun to my head and ask me pick between Rainbow Gum, Logback, or Log4J2 not to have a security issue I would pick my library.
- Faster than Log4J2 - Log4J2's claims of speed are very dated when zero GC options were vogue. Log4J2 is actually often slower than logback.
- Smaller than Tinylog - Tinylog may have a small code footprint but it actually requires several dependencies like
java.sql. - Loads of modern features - Scoped Values, colored themes, JSONL, LTSV built into core etc.
There really only 4-5 logging libraries (implementations) in the Java ecosystem so if your knee jerk reaction is not another one just know that there are way more JSON serializers, ORMs, web frameworks and build systems. All of these require tremendous effort to switch or even try.
With a couple changes of your POM you can switch to Rainbow Gum.
Please try it!
Rainbow Gum was coded by me entirely up to 0.10.0 I think. It is now heavily code assisted. I had to to make sure it was as secure as possible but have reviewed every change. I am exhausted! I have made it transparent by letting the agents coauthor the commits.
https://github.com/jstachio/rainbowgum
And if you don't think Rainbow Gum is as good as what I say it is you can always have several agents do a blind test on all the logging frameworks. Just tell them to remove authors and rename etc. You can and should always benchmark as well.
Special thanks to the JDK team and JSpecify team.
I will add more links later but if I add too many I will be automod.
20
u/agentoutlier 18d ago edited 18d ago
Now I know there will be people rather upset that I used some AI tools (the mods informed me that any form of AI usage is not allowed but let this post) to help check and write Rainbow Gum. I have historically not used any of these tools. Rainbow Gum was not vibe coded but I used these tools to help setup testing and do testing as well as fill in the rest of boiler plate. I am approaching 50 and my fingers have a fair amount of arthritis. For proof you can see my other major project: https://github.com/jstachio/jstachio that I do not vibe code.
The decision to use those tools did not come lightly.
Understand that logging and lots of boring libraries like this are already pretty "soulless" and the creative aspects of API design as well the logo were done by me well before the tools became so powerful. I hand wrote the SVG.By the way that is why the documentation is rather ugly look wise precisely because I did not vibe up a theme.
Those are creative things.
What is not creative is implementing another facade or setting up benchmarks for the 100th time or a bot finding another CVE.
And unlike a lot of other projects including mainstream ones that have folks just checking code with only their name when clearly likely used assistance I have tried to make it is transparent as possible.
And Log4J2 is doing this as well. So is Spring Boot. I don't know how the mods are really going to enforce zero AI usage.
If someone really wants a hand crafted logging implementation I can try to fork where I started using them but realize it will not be as secure and I will have to reduce scope greatly.
9
u/imagei 18d ago
For me, before I even look beyond the surface of another logging framework, I ask two questions: How is SLF4J compatibility? If 100%, then: is it a drop-in replacement for Logback ( beyond its private APIs and its config file, of course )?
How is Rainbow Gum faring on those two fronts?
5
u/davidalayachew 18d ago
Ok, I have been keeping my eye on this, waiting for it to go live before seriously considering adding it to my actual production system.
So, several things I need to know.
What is the rainbow gum equivalent to slf4j-simple?
What is the rainbow gun equivalent of logback-classic?
2
u/Jolly_Resolution_222 18d ago
I think / \ and .. should be rejected in the prefix and suffix otherwise could that lead to path traversal. rainbowgum-file/src/main/java/io/jstach/rainbowgum/rolling/RollingPolicy.java
2
u/idontlikegudeg 14d ago edited 14d ago
EDIT: Fixed it. The correct pattern is:
Plus it seems you need to manually configure that location information is needed using a ´LogPropertiesBuilder´.
---------
How would I configure the RainbowGm equivalent of this pattern?
I tried this and it does not work:
I get no errors, but the rainbow gum output is like this:
The expected format is this:
I used Rainbow Gum V 1.0.1 anf the appender is configured like:
1
u/burl-21 18d ago
Currently, with spring-boot, we are using logback with opentelemetry-logback-appender-1.0 (logback.xml mdc attributes). Is there any guide available for migrating to rainbow gum? I'd like to try it out.
1
u/Drawhoe 16d ago
I use logback classic. How would I try your logger out?
1
u/ducki666 18d ago
Why should I use it instead of logback?
7
u/CptGia 18d ago
More secure than others... Based on what? Vibes?
2
u/Kango_V 18d ago
I am using Rainbowgum in my current project and it's working very well. I've used JStachio (same author) in a few previous projects along with Micronaut, PicoCLI and GraalVM. JStachio is great as you don't need it at runtime.
1
u/MinimallyLoquacious 17d ago
> I can't say its more secure than the others because that would get me in trouble but if you were to put a gun to my head and ask me pick between Rainbow Gum, Logback, or Log4J2 not to have a security issue I would pick my library.
Sounds more like feelings than logic.
I'll stick with Logback since I do not see enough justification to cause new churn in my projects, not when logging can be so critical.