annotate src/goodjava/logging/LoggerFactory.java @ 1828:09e90d94b7b5

add DomainFilter
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 15 Sep 2024 19:51:16 -0600
parents 219f2b937f2b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1402
27efb1fcbcb5 move luan.lib to goodjava
Franklin Schmidt <fschmidt@gmail.com>
parents: 1338
diff changeset
1 package goodjava.logging;
1337
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3
1448
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
4 public final class LoggerFactory {
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
5 public static final ILoggerFactory implementation;
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
6 static {
1454
219f2b937f2b remove log4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 1448
diff changeset
7 String s = System.getProperty("goodjava.logger","goodjava.logger.LoggingFactory");
1448
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
8 try {
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
9 implementation = (ILoggerFactory)Class.forName(s).newInstance();
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
10 } catch(ClassNotFoundException e) {
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
11 throw new RuntimeException(e);
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
12 } catch(InstantiationException e) {
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
13 throw new RuntimeException(e);
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
14 } catch(IllegalAccessException e) {
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
15 throw new RuntimeException(e);
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
16 }
1337
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 public static Logger getLogger(String name) {
1448
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
20 return implementation.getLogger(name);
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
21 }
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
22
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
23 public static Logger getLogger(Class cls) {
6fc083e1d08c start logger
Franklin Schmidt <fschmidt@gmail.com>
parents: 1402
diff changeset
24 return getLogger(cls.getName());
1337
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 }
8b61c8c4e07a remove slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 }