From eea88e5f236638862c94ce3e8cc958309a8a7d8b Mon Sep 17 00:00:00 2001 From: mavlonerkinboev Date: Thu, 26 Aug 2021 10:32:29 +0500 Subject: Change path --- src/main/java/com/mavlushechka/animarfo/App.java | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/main/java/com/mavlushechka/animarfo/App.java (limited to 'src/main/java/com/mavlushechka/animarfo/App.java') diff --git a/src/main/java/com/mavlushechka/animarfo/App.java b/src/main/java/com/mavlushechka/animarfo/App.java new file mode 100644 index 0000000..27f9bff --- /dev/null +++ b/src/main/java/com/mavlushechka/animarfo/App.java @@ -0,0 +1,41 @@ +package com.mavlushechka.animarfo; + +import com.mavlushechka.animarfo.telegram.bot.Bot; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.LogManager; +import java.util.logging.Logger; + +public class App { + public final static Properties PROPERTIES = loadProperties(new File("src/main/resources/app.properties")); + private static final Logger LOGGER = Logger.getLogger(App.class.getName()); + + static { + try { + FileInputStream ins = new FileInputStream("log.config"); + LogManager.getLogManager().readConfiguration(ins); + LOGGER.setLevel(Level.ALL); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + LOGGER.info("Trying to start bot"); + Bot.start(); + } + + public static Properties loadProperties(File file) { + Properties properties = new Properties(); + try (FileInputStream fis = new FileInputStream(file)) { + properties.load(fis); + } catch (IOException e) { + e.printStackTrace(); + } + return properties; + } +} -- cgit v1.2.3