Is there some support for considering https://github.com/outr/scribe or another pure Scala logger as a candidate for the Scala Platform?
Logging has been a mess on the JVM ever since the java.util.Logging non-standard as a replacement for log4j and since then it has gotten worse common-logging and a bit better with slf4j.
The Scala community do better as long as current Java code can log through the Scala logger as with the slf4j adapter for the JVM provided by Scribe.
Lots of references to using macros. Are these whitebox? Does this have a future in Scala 3.0?
Java API – some would prefer a Log4j2 api entry point rather than a slf4j one as it is slightly more feature rich. Does it support line number / class extraction via this entry point, since macros aren’t available?
There are comparisons to log4j2 performance, but no note about whether the logging is non-blocking (log4j2 has an async LMAX disruptor based logger option to prevent app threads from ever blocking).
For those working outside the JVM, I’m sure a pure Scala logger would be appreciated. For those of us working only in the JVM with mixed Scala/Java/other languages its going to be a harder sell.
There are comparisons to log4j2 performance, but no note about whether the logging is non-blocking (log4j2 has an async LMAX disruptor based logger option to prevent app threads from ever blocking).
The Readme states among the features:
Asynchronous logging support. Scribe’s logger is very fast, but if real-time performance is critical, the asynchronous logging support completely removes logging impact from your application’s thread impact.
Java API – some would prefer a Log4j2 api entry point rather than a slf4j one as it is slightly more feature rich. Does it support line number / class extraction via this entry point, since macros aren’t available?
Yes, although it’s done at runtime with an expensive call to get the stack trace. Use %l in your log layout. Log4j – Log4j 2 Layouts
I’m open to considering changes in Scribe if it would benefit the more general use. However, not much effort to support SLF4J or Log4J has been defined because of the design flaws of their API. We are stuck with runtime stack investigation for trace detail without Macros.
Is it not possible to add compile-time trace details to Scala 3? I think it is a very reasonable request (or yet we risk leaving more projects behind when jumping from 2.14 to 3).
@scoronpo, it can be done via Macros already and is done in Scribe. In fact, Scribe includes not only line numbers but column numbers for more functional code as well.
we need macros, scala has no future without macros
All the logging needs can be satisfied with whitebox macros
I would vote against a standard logger for scala. Logging is a big subject and at the moment scala allows you to do a lot, like this library (disclaimer: I’m the author) allows you to implement zero-cost structural loggers. At the same time it wouldn’t be wise to include a very advanced macro-based logging machinery into standard library and it would be dumb to include a trivial API just to have it.
A logger cannot be unopinonated. And I think that it’s better to give people freedom of choice than to push an opinionated way of doing things. It already happened many times before.
I agree, the ability to make high level extension is a killer feature of scala.
But I disagree that whitebox macros is a killer feature, because it is too complicated, it allows to change scala syntax. I personally don’t need that kind of power. I prefer better idea integration and more stable work.(I still need the ability to inject custom type)
What killer feature cannot you make with black box macros in logging?
Eh, sorry. I’ve been typing in hurry, it’s just a typo. We need and use blackbox macros. Everything Scribe does can be done with bb macros as well. At the same time dotty must have a macro mechanism so there is no point in saying
Lots of references to using macros. Are these whitebox? Does this have a future in Scala 3.0?
Scala itself has no future without macros, IMO.
Regarding killer feature: we extract structure. For free. And turn it into json/events/whatever. For free.
While Scala 3 will have some form of blackbox macros, I don’t think what is currently implemented in dotty provides access to things like line numbers.