Fourth milestone of tinylog 2.0 is out

You can edit this post on GitHub

tinylog 2.0.0-M4 brings dedicated logging APIs for Scala and Kotlin. If you use one of both languages, you can add the matching artifact to your project and use the new logger object. This avoids unnecessary casts, which was required in Scala and Kotlin using the ’normal’ logger class, and brings native support for lambdas and higher-ordered functions. Lazy interpolation of strings with embedded variables is quite easy now.

Lazy message passed as lambda in Kotlin:

Logger.info { "Hello $name!" }

Lazy message in Scala thanks to the use of macros:

Logger.info(s"Hello $name!")

Until now, it was impossible to use pipes in format patterns. The reason is that the pipe is reserved as separator between placeholders and style options. Thus, tinylog 2.0.0-M4 introduces {pipe} as placeholder for pipes.

For example:

writer        = console
writer.format = {level|min-size=5} {pipe} {thread|min-size=8} {pipe} {message}

Possible output:

DEBUG | main     | Hello World!
INFO  | thread-1 | Goodbye

The new milestone of tinylog 2 contains also several bugfixes. Now it is possible to use tinylog 2 in a Java Web Start application. In the previous milestones, tinylog 2 used a wrong class loader for loading services. Under some rare conditions, the rolling file writer could find files as log files that doesn’t match the defined log file pattern. This is fixed in the new milestone. Also, nested format patterns with style options do work again. Many thanks to gabrielnasser, adolgiy, and scott-rc for reporting the issues and supporting the analyses.