blob: acc89b8cf6a5c7fc062696d11fa3eec5814160de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package com.mavlushechka.animarfo;
import com.mavlushechka.animarfo.telegram.bot.Bot;
import org.jetbrains.annotations.NotNull;
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 static final Properties PROPERTIES = loadProperties(new File("src/main/resources/app.properties"));
private static final Logger LOGGER = Logger.getLogger(App.class.getName());
static {
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream("log.config");
LogManager.getLogManager().readConfiguration(fileInputStream);
} catch (IOException ioException) {
ioException.printStackTrace();
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}
LOGGER.setLevel(Level.ALL);
}
public static void main(String[] args) {
LOGGER.info("Trying to start bot");
Bot.start();
}
@NotNull
private static Properties loadProperties(File file) {
Properties properties = new Properties();
try (FileInputStream fis = new FileInputStream(file)) {
properties.load(fis);
} catch (IOException ioException) {
ioException.printStackTrace();
}
return properties;
}
}
|