Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/org/dive4elements/artifactdatabase/App.java @ 568:5cd1c627cda9 3.2.x
Rely on log4j's default initialization procedure
This should make upgrading to Log4j 2.x easier.
In passing, use latest Log4j 1.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 25 Feb 2022 15:01:23 +0100 |
parents | 3b1e48d22ce0 |
children |
comparison
equal
deleted
inserted
replaced
567:48d14cf857db | 568:5cd1c627cda9 |
---|---|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. | 6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.artifactdatabase; | 9 package org.dive4elements.artifactdatabase; |
10 | 10 |
11 import org.dive4elements.artifacts.common.utils.Config; | |
12 | |
13 import org.dive4elements.artifactdatabase.rest.HTTPServer; | 11 import org.dive4elements.artifactdatabase.rest.HTTPServer; |
14 | 12 |
15 import java.io.File; | |
16 | |
17 import java.net.MalformedURLException; | |
18 | |
19 import org.apache.log4j.PropertyConfigurator; | |
20 | |
21 import org.slf4j.bridge.SLF4JBridgeHandler; | |
22 | 13 |
23 /** | 14 /** |
24 * Starting point of the artifact database. | 15 * Starting point of the artifact database. |
25 * | 16 * |
26 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> | 17 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
27 */ | 18 */ |
28 public class App | 19 public class App |
29 { | 20 { |
30 /** | 21 /** |
31 * The logging is done via Log4j. To configure the logging | |
32 * a file 'log4j.properties' is search in the configuration directory. | |
33 */ | |
34 public static final String LOG4J_PROPERTIES = | |
35 "log4j.properties"; | |
36 | |
37 /** | |
38 * Trys to load the Log4j configuration from ${config.dir}/log4j.properties. | |
39 */ | |
40 public static final void configureLogging() { | |
41 File configDir = Config.getConfigDirectory(); | |
42 File propFile = new File(configDir, LOG4J_PROPERTIES); | |
43 | |
44 if (propFile.isFile() && propFile.canRead()) { | |
45 try { | |
46 PropertyConfigurator.configure(propFile.toURI().toURL()); | |
47 SLF4JBridgeHandler.install(); | |
48 } | |
49 catch (MalformedURLException mue) { | |
50 mue.printStackTrace(System.err); | |
51 } | |
52 } | |
53 } | |
54 | |
55 /** | |
56 * Starts the artifact database. | 22 * Starts the artifact database. |
57 * @param args The commandline arguments. Unused. | 23 * @param args The commandline arguments. Unused. |
58 */ | 24 */ |
59 public static void main(String[] args) { | 25 public static void main(String[] args) { |
60 | |
61 configureLogging(); | |
62 | 26 |
63 FactoryBootstrap bootstrap = new FactoryBootstrap(); | 27 FactoryBootstrap bootstrap = new FactoryBootstrap(); |
64 | 28 |
65 bootstrap.boot(); | 29 bootstrap.boot(); |
66 | 30 |