diff --git a/build.gradle b/build.gradle index 4e81683..007a845 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,23 @@ plugins { id 'java' + id 'application' } group 'xyz.vallat.louis' version '0.1-SNAPSHOT' +apply plugin : 'java' +ext { + javaMainClass = 'xyz.vallat.louis.MovieQuoteBot' +} + +application { + mainClassName = javaMainClass +} + jar { manifest { - attributes 'Main-Class': 'xyz.vallat.louis.MovieQuoteBot' + attributes 'Main-Class': javaMainClass } duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -21,4 +31,5 @@ repositories { } dependencies { + implementation 'ch.qos.logback:logback-classic:1.2.3' } \ No newline at end of file diff --git a/src/main/java/xyz/vallat/louis/MovieQuoteBot.java b/src/main/java/xyz/vallat/louis/MovieQuoteBot.java index 1015a37..7e27662 100644 --- a/src/main/java/xyz/vallat/louis/MovieQuoteBot.java +++ b/src/main/java/xyz/vallat/louis/MovieQuoteBot.java @@ -1,9 +1,13 @@ package xyz.vallat.louis; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class MovieQuoteBot { public static void main(String[] args) { - System.out.println("Hello World!"); + Logger logger = LoggerFactory.getLogger(MovieQuoteBot.class.getCanonicalName()); + logger.debug("Hello World!"); } } diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..160c928 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + logs/d4j.%d{yyyy-MM-dd}.%i.log + 100MB + 90 + + + UTF-8 + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-40.40logger{39} : %msg%n + + true + + + + + 512 + + + + + + + + + + \ No newline at end of file