kotlindnslogbackslf4jdnsjava

Why does dnsjava requires slf4j and logback?


So I'm (trying) developing a kotlin console application, where the user can sign up with an email, and in order to validate this email I use dnsjava library, but that requires me to use the slf4j and a log api such as logback, but my question is, is there a better way of checking if the email is a real one or not? and why do we have to use loggers??

observation:I'm just a student and this is my very first time trying to code something like that, if I'm doing anything wrong, or if there is a better way, please let me know, because i'm finding it hard to get this info, and to get this feature done, just by searching. thank you!

I'm expecting to check if the email is in the dns server or something like that, and return rather or not the domain matches the email provided by the user, but I'm having to use slf4j and logback witch I never used, I'm kind of lost on this.


Solution

  • It is quite common for libraries to use a logger for debug/info messages which some users might find useful. If you don't care about them, instead of logback you can bind a no-op logger to the slf4j api and be done with it. Just add the following dependencies to your Gradle build and you won't have to worry about it ever again (unless, of course, you encounter a problem with the library and you want to look at the logs to investigate):

    implementation("org.slf4j:slf4j-api:2.0.16")
    implementation("org.slf4j:slf4j-nop:2.0.16")