qos-ch / logback

The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
Other
2.98k stars 1.28k forks source link

no-janino conditions #757

Open guai opened 8 months ago

guai commented 8 months ago

Feature request: pls make possible to write conditions without janino. it should allow to use conditions with native image for example.

I suggest something like a predicate-like interface that user would implement and use like so:

<if predicateClass="org.example.MyCondition">

or it could be a static method

danparisi commented 5 months ago

I'd also be very happy to get this feature. Without it, running spring boot native images force you to remove if conditions from spring-logback file. More info here

DarkAtra commented 4 days ago

Hey @ceki, i'm reaching out to you because you initally recommended filing an issue for this feature in this comment. We're currently in the process of migrating a few of our apps to native images and stumbled upon this issue. We're currently using Janino conditions to enable different types of sinks for our logs (kafka, tcp, file, console, ...) and also their format (JSON lines vs. formatted log lines). As you know, Janino is not compatible with GraalVM which makes this a blocker for our migration.

What do you think of the solution that guai proposed? Is this something that you would accept PRs for?

ceki commented 3 days ago

@DarkAtra I have responded in the original issue. Please let me know what you think.

Also, the next version of logback-tyler will support PropertiesConfigurator (new in logback 1,5,8) which allows setting logger levels from a properties file.

DarkAtra commented 3 days ago

@DarkAtra I have responded in the original issue. Please let me know what you think.

Also, the next version of logback-tyler will support PropertiesConfigurator (new in logback 1,5,8) which allows setting logger levels from a properties file.

This looks very promising, i'll try with one of our projects. Ty for the quick response!