I'm starting a java project using slf4j for logging, gradle for building, and intellij for the IDE. How do I have intellij show the logs in the IDE when I run the project?
I've been attempting to find out how to put slf4j-simple in the classpath without declaring it in build.gradle. I would think that outputting logs to System.err would make them show in intellij. Do you think this is on the right track?
If you're familiar with slf4j, you know that the point of slf4j is to avoid declaring compile-time dependencies on logging frameworks.
In order to show output, there needs to be both slf4j-api as well as exactly one slf4j implementation binding (such as slf4j-simple or logback or whatever) in the classpath. This means:
If you're expecting to "see" something when you "run the project", then either:
IntelliJ IDEA will automatically display anything printed to the console. Also, many run configuration types have a "Log" tab that lets one specify log files to scan and also display while an application is being run. So, if you do want a testing logging configuration that has logging to multiple files and the like, you can generally configure IDEA to be able to let you see those as well while your application is running.
My experience is much more with Maven than with Gradle, but I believe the concept of dependency scope of compile, runtime, and test translate fairly straightforwardly to Gradle. Please ask if you need more specific clarification.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.