From 6e44710b9b85b0d4e3d390674a7afec6f6cb3ead Mon Sep 17 00:00:00 2001 From: bronti Date: Mon, 20 Mar 2017 22:46:20 +0300 Subject: [PATCH] Logging added --- pom.xml | 10 ++++++++++ src/main/java/ru/spbau/mit/Main.java | 17 +++++++++++++++++ src/main/resources/log4j2.xml | 20 ++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 src/main/java/ru/spbau/mit/Main.java create mode 100644 src/main/resources/log4j2.xml diff --git a/pom.xml b/pom.xml index 2614c9f..9735c7e 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,16 @@ junit-addons 1.4 + + org.apache.logging.log4j + log4j-api + 2.8.1 + + + org.apache.logging.log4j + log4j-core + 2.8.1 + diff --git a/src/main/java/ru/spbau/mit/Main.java b/src/main/java/ru/spbau/mit/Main.java new file mode 100644 index 0000000..ec7d457 --- /dev/null +++ b/src/main/java/ru/spbau/mit/Main.java @@ -0,0 +1,17 @@ +package ru.spbau.mit; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * Created by bronti on 20.03.17. + */ +public class Main { + private static final Logger LOG = LogManager.getLogger(); + + public static void main(String[] args) { + LOG.debug("This should not show up anywhere."); + LOG.info("This should show up in the file."); + LOG.error("This should show up both in the file and in the console."); + } +} diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml new file mode 100644 index 0000000..3edb8f0 --- /dev/null +++ b/src/main/resources/log4j2.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file