Codebase list libslf4j-java / 9119821
Imported Upstream version 1.7.14 Emmanuel Bourg 8 years ago
47 changed file(s) with 510 addition(s) and 83 deletion(s). Raw diff Collapse all Expand all
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>integration</artifactId>
44 <parent>
55 <groupId>org.slf4j</groupId>
66 <artifactId>slf4j-parent</artifactId>
7 <version>1.7.13</version>
7 <version>1.7.14</version>
88 </parent>
99
1010 <modelVersion>4.0.0</modelVersion>
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>jul-to-slf4j</artifactId>
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212
1616 package org.apache.log4j;
1717
1818 import org.apache.log4j.spi.LoggerFactory;
19 import org.slf4j.helpers.Util;
2019
2120 import java.util.concurrent.ConcurrentHashMap;
2221 import java.util.concurrent.ConcurrentMap;
3433
3534 // String, Logger
3635 private static ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<String, Logger>();
37
38 private static final String LOG4J_DELEGATION_LOOP_URL = "http://www.slf4j.org/codes.html#log4jDelegationLoop";
39
40 // check for delegation loops
41 static {
42 try {
43 Class.forName("org.slf4j.impl.Log4jLoggerFactory");
44 String part1 = "Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError. ";
45 String part2 = "See also " + LOG4J_DELEGATION_LOOP_URL + " for more details.";
46
47 Util.report(part1);
48 Util.report(part2);
49 throw new IllegalStateException(part1 + part2);
50 } catch (ClassNotFoundException e) {
51 // this is the good case
52 }
53 }
5436
5537 public static Logger getLogger(String name) {
5638 org.apache.log4j.Logger instance = log4jLoggers.get(name);
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>osgi-over-slf4j</artifactId>
1313
14 <packaging>bundle</packaging>
14 <packaging>jar</packaging>
1515 <name>OSGi LogService implemented over SLF4J</name>
1616
1717 <url>http://www.slf4j.org</url>
4040 <scope>provided</scope>
4141 </dependency>
4242 </dependencies>
43 <build>
44 <plugins>
45 <plugin>
46 <groupId>org.apache.felix</groupId>
47 <artifactId>maven-bundle-plugin</artifactId>
48 <version>2.3.7</version>
49 <extensions>true</extensions>
50 <configuration>
51 <instructions>
52 <Export-Package>org.osgi.service.log</Export-Package>
53 <Bundle-Activator>org.slf4j.osgi.logservice.impl.Activator</Bundle-Activator>
54 </instructions>
55 </configuration>
56 </plugin>
57 </plugins>
58 </build>
5943 </project>
0 Implementation-Title: osgi-over-slf4j
1 Bundle-ManifestVersion: 2
2 Bundle-SymbolicName: org.slf4j.osgi-over-slf4j
3 Bundle-Name: OSGi LogService implemented over SLF4J
4 Bundle-RequiredExecutionEnvironment: J2SE-1.5
5 Bundle-Activator: org.slf4j.osgi.logservice.impl.Activator
6 Bundle-Category: osgi
7 Import-Package: org.osgi.framework;version="[1.5,2)",org.osgi.service.log;version="[1.3,2)",org.slf4j;version=${parsedVersion.osgiVersion}
55
66 <groupId>org.slf4j</groupId>
77 <artifactId>slf4j-parent</artifactId>
8 <version>1.7.13</version>
8 <version>1.7.14</version>
99
1010 <packaging>pom</packaging>
1111 <name>SLF4J</name>
406406
407407 <distributionManagement>
408408 <site>
409 <id>pixie</id>
410 <url>scp://pixie.qos.ch/var/www/www.slf4j.org/htdocs/</url>
409 <id>tao</id>
410 <url>scp://tao.qos.ch/var/www/www.slf4j.org/htdocs/</url>
411411 </site>
412412
413413 <repository>
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-android</artifactId>
5151 }
5252
5353 /**
54 * Declare the version of the SLF4J API this implementation is compiled against.
55 * The value of this field is usually modified with each release.
54 * Declare the version of the SLF4J API this implementation is compiled against.
55 * The value of this field is modified with each major release.
5656 */
5757 // to avoid constant folding by the compiler, this field must *not* be final
58 public static String REQUESTED_API_VERSION = "1.6.99"; // !final
58 public static String REQUESTED_API_VERSION = "1.6.99"; // !final
59
5960
6061
6162 private static final String loggerFactoryClassStr = AndroidLoggerFactory.class.getName();
4444 }
4545
4646 /**
47 * Return the singleton of this class.
48 *
49 * @return the StaticMDCBinder singleton
50 * @since 1.7.14
51 */
52 public static final StaticMDCBinder getSingleton() {
53 return SINGLETON;
54 }
55 /**
4756 * Currently this method always returns an instance of
4857 * {@link NOPMDCAdapter}.
4958 */
4949 }
5050
5151 /**
52 * Return the singleton of this class.
53 *
54 * @return the StaticMarkerBinder singleton
55 * @since 1.7.14
56 */
57 public static StaticMarkerBinder getSingleton() {
58 return SINGLETON;
59 }
60
61 /**
5262 * Currently this method always returns an instance of
5363 * {@link BasicMarkerFactory}.
5464 */
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-api</artifactId>
8383
8484 // Support for detecting mismatched logger names.
8585 static final String DETECT_LOGGER_NAME_MISMATCH_PROPERTY = "slf4j.detectLoggerNameMismatch";
86 static final String JAVA_VENDOR_PROPERTY = "java.vendor.url";
87
8688 static boolean DETECT_LOGGER_NAME_MISMATCH = Util.safeGetBooleanSystemProperty(DETECT_LOGGER_NAME_MISMATCH_PROPERTY);
8789
8890 /**
221223 // the class itself.
222224 private static String STATIC_LOGGER_BINDER_PATH = "org/slf4j/impl/StaticLoggerBinder.class";
223225
224 private static Set<URL> findPossibleStaticLoggerBinderPathSet() {
226 static Set<URL> findPossibleStaticLoggerBinderPathSet() {
225227 // use Set instead of list in order to deal with bug #138
226228 // LinkedHashSet appropriate here because it preserves insertion order during iteration
227229 Set<URL> staticLoggerBinderPathSet = new LinkedHashSet<URL>();
253255 *
254256 */
255257 private static void reportMultipleBindingAmbiguity(Set<URL> staticLoggerBinderPathSet) {
258 if(isAndroid()) {
259 // skip check under android, see also http://jira.qos.ch/browse/SLF4J-328
260 return;
261 }
262
256263 if (isAmbiguousStaticLoggerBinderPathSet(staticLoggerBinderPathSet)) {
257264 Util.report("Class path contains multiple SLF4J bindings.");
258265 for (URL path : staticLoggerBinderPathSet) {
260267 }
261268 Util.report("See " + MULTIPLE_BINDINGS_URL + " for an explanation.");
262269 }
270 }
271
272 private static boolean isAndroid() {
273 String vendor = Util.safeGetSystemProperty(JAVA_VENDOR_PROPERTY);
274 if(vendor == null)
275 return false;
276 return vendor.toLowerCase().contains("android");
263277 }
264278
265279 private static void reportActualBinding(Set<URL> staticLoggerBinderPathSet) {
323337 */
324338 public static ILoggerFactory getILoggerFactory() {
325339 if (INITIALIZATION_STATE == UNINITIALIZED) {
326 INITIALIZATION_STATE = ONGOING_INITIALIZATION;
327 performInitialization();
340 synchronized (LoggerFactory.class) {
341 if (INITIALIZATION_STATE == UNINITIALIZED) {
342 INITIALIZATION_STATE = ONGOING_INITIALIZATION;
343 performInitialization();
344 }
345 }
328346 }
329347 switch (INITIALIZATION_STATE) {
330348 case SUCCESSFUL_INITIALIZATION:
8484 private MDC() {
8585 }
8686
87 /**
88 * As of SLF4J version 1.7.14, StaticMDCBinder classes shipping in various bindings
89 * come with a getSingleton() method. Previously only a public field called SINGLETON
90 * was available.
91 *
92 * @return MDCAdapter
93 * @throws NoClassDefFoundError in case no binding is available
94 * @since 1.7.14
95 */
96 private static MDCAdapter bwCompatibleGetMDCAdapterFromBinder() throws NoClassDefFoundError {
97 try {
98 return StaticMDCBinder.getSingleton().getMDCA();
99 } catch (NoSuchMethodError nsme) {
100 // binding is probably a version of SLF4J older than 1.7.14
101 return StaticMDCBinder.SINGLETON.getMDCA();
102 }
103 }
104
87105 static {
88106 try {
89 mdcAdapter = StaticMDCBinder.SINGLETON.getMDCA();
107 mdcAdapter = bwCompatibleGetMDCAdapterFromBinder();
90108 } catch (NoClassDefFoundError ncde) {
91109 mdcAdapter = new NOPMDCAdapter();
92110 String msg = ncde.getMessage();
4141 * @author Ceki G&uuml;lc&uuml;
4242 */
4343 public class MarkerFactory {
44 static IMarkerFactory markerFactory;
44 static IMarkerFactory MARKER_FACTORY;
4545
4646 private MarkerFactory() {
4747 }
4848
49 /**
50 * As of SLF4J version 1.7.14, StaticMarkerBinder classes shipping in various bindings
51 * come with a getSingleton() method. Previously only a public field called SINGLETON
52 * was available.
53 *
54 * @return IMarkerFactory
55 * @throws NoClassDefFoundError in case no binding is available
56 * @since 1.7.14
57 */
58 private static IMarkerFactory bwCompatibleGetMarkerFactoryFromBinder() throws NoClassDefFoundError {
59 try {
60 return StaticMarkerBinder.getSingleton().getMarkerFactory();
61 } catch (NoSuchMethodError nsme) {
62 // binding is probably a version of SLF4J older than 1.7.14
63 return StaticMarkerBinder.SINGLETON.getMarkerFactory();
64 }
65 }
66
67 // this is where the binding happens
4968 static {
5069 try {
51 markerFactory = StaticMarkerBinder.SINGLETON.getMarkerFactory();
70 MARKER_FACTORY = bwCompatibleGetMarkerFactoryFromBinder();
5271 } catch (NoClassDefFoundError e) {
53 markerFactory = new BasicMarkerFactory();
54
72 MARKER_FACTORY = new BasicMarkerFactory();
5573 } catch (Exception e) {
5674 // we should never get here
5775 Util.report("Unexpected failure while binding MarkerFactory", e);
6785 * @return marker
6886 */
6987 public static Marker getMarker(String name) {
70 return markerFactory.getMarker(name);
88 return MARKER_FACTORY.getMarker(name);
7189 }
7290
7391 /**
7896 * @since 1.5.1
7997 */
8098 public static Marker getDetachedMarker(String name) {
81 return markerFactory.getDetachedMarker(name);
99 return MARKER_FACTORY.getDetachedMarker(name);
82100 }
83101
84102 /**
90108 * @return the IMarkerFactory instance in use
91109 */
92110 public static IMarkerFactory getIMarkerFactory() {
93 return markerFactory;
111 return MARKER_FACTORY;
94112 }
95113 }
5353
5454 /**
5555 * Declare the version of the SLF4J API this implementation is compiled against.
56 * The value of this field is usually modified with each release.
56 * The value of this field is modified with each major release.
5757 */
5858 // to avoid constant folding by the compiler, this field must *not* be final
5959 public static String REQUESTED_API_VERSION = "1.6.99"; // !final
4141 private StaticMDCBinder() {
4242 throw new UnsupportedOperationException("This code should never make it into the jar");
4343 }
44
45 /**
46 * Return the singleton of this class.
47 *
48 * @return the StaticMDCBinder singleton
49 * @since 1.7.14
50 */
51 public static final StaticMDCBinder getSingleton() {
52 return SINGLETON;
53 }
4454
4555 /**
4656 * Currently this method always returns an instance of
5151 }
5252
5353 /**
54 * Return the singleton of this class.
55 *
56 * @return the StaticMarkerBinder singleton
57 * @since 1.7.14
58 */
59 public static StaticMarkerBinder getSingleton() {
60 return SINGLETON;
61 }
62
63 /**
5464 * Currently this method always returns an instance of
5565 * {@link BasicMarkerFactory}.
5666 */
0 package org.slf4j;
1
2 import java.util.concurrent.BrokenBarrierException;
3 import java.util.concurrent.CyclicBarrier;
4
5 /**
6 * This class demonstrates that threads accessing the STATE variable always see a consistent value.
7 *
8 * During ongoing initialization the observed value is either ONGOING_INITIALIZATION
9 * or one of {SUCCESS, FAILURE}.
10 *
11 * Post initialization the observed value is always one of {SUCCESS, FAILURE}.
12 *
13 * See also http://jira.qos.ch/browse/SLF4J-167
14 *
15 * @author ceki
16 *
17 */
18 public class DoubleCheckedInt {
19
20 final static int THREAD_COUNT = 10 + Runtime.getRuntime().availableProcessors() * 2;
21 final static int UNINITIALIZED_STATE = 0;
22 final static int ONGOING_INITIALIZATION = 1;
23 final static int SUCCESS = 2;
24 final static int FAILURE = 3;
25 final static int NUMBER_OF_STATES = FAILURE + 1;
26
27 private static int STATE = UNINITIALIZED_STATE;
28
29 public static int getState() {
30 if (STATE == 0) {
31 synchronized (DoubleCheckedInt.class) {
32 if (STATE == UNINITIALIZED_STATE) {
33 STATE = ONGOING_INITIALIZATION;
34 long r = System.nanoTime();
35 try {
36 Thread.sleep(10);
37 } catch (InterruptedException e) {
38 }
39 if (r % 2 == 0) {
40 STATE = SUCCESS;
41 } else {
42 STATE = FAILURE;
43 }
44 }
45 }
46 }
47 return STATE;
48 }
49
50 static public void main(String[] args) throws InterruptedException, BrokenBarrierException {
51 StateAccessingThread[] preInitializationThreads = harness();
52 check(preInitializationThreads, false);
53
54 System.out.println("============");
55 StateAccessingThread[] postInitializationThreads = harness();
56 check(postInitializationThreads, true);
57 }
58
59 private static StateAccessingThread[] harness() throws InterruptedException, BrokenBarrierException {
60 StateAccessingThread[] threads = new StateAccessingThread[THREAD_COUNT];
61 final CyclicBarrier barrier = new CyclicBarrier(THREAD_COUNT + 1);
62 for (int i = 0; i < THREAD_COUNT; i++) {
63 threads[i] = new StateAccessingThread(barrier);
64 threads[i].start();
65 }
66
67 barrier.await();
68 for (int i = 0; i < THREAD_COUNT; i++) {
69 threads[i].join();
70 }
71 return threads;
72 }
73
74 private static void check(StateAccessingThread[] threads, boolean postInit) {
75
76 int[] stateCount = getStateCount(threads);
77 printStateCount(stateCount);
78
79 if (stateCount[UNINITIALIZED_STATE] != 0) {
80 throw new IllegalStateException("getState() should never return a zero value");
81 }
82
83 if (stateCount[SUCCESS] != 0 && stateCount[FAILURE] != 0) {
84 throw new IllegalStateException("getState() should return consistent values");
85 }
86
87 if (postInit) {
88 if (stateCount[SUCCESS] != THREAD_COUNT && stateCount[FAILURE] != THREAD_COUNT) {
89 throw new IllegalStateException("getState() should return consistent values");
90 }
91 }
92
93 }
94
95 private static void printStateCount(int[] stateCount) {
96 for (int i = 0; i < NUMBER_OF_STATES; i++) {
97 switch (i) {
98 case UNINITIALIZED_STATE:
99 System.out.println("UNINITIALIZED_STATE count: " + stateCount[i]);
100 break;
101 case ONGOING_INITIALIZATION:
102 System.out.println("ONGOING_INITIALIZATION count: " + stateCount[i]);
103 break;
104 case SUCCESS:
105 System.out.println("SUCCESS count: " + stateCount[i]);
106 break;
107 case FAILURE:
108 System.out.println("FAILURE count: " + stateCount[i]);
109 break;
110 }
111 }
112 }
113
114 private static int[] getStateCount(StateAccessingThread[] threads) {
115 int[] valCount = new int[NUMBER_OF_STATES];
116 for (int i = 0; i < threads.length; i++) {
117 int val = threads[i].state;
118 valCount[val] = valCount[val] + 1;
119 }
120 return valCount;
121 }
122
123 static class StateAccessingThread extends Thread {
124 public int state = -1;
125 final CyclicBarrier barrier;
126
127 StateAccessingThread(CyclicBarrier barrier) {
128 this.barrier = barrier;
129 }
130
131 public void run() {
132 try {
133 barrier.await();
134 } catch (Exception e) {
135 e.printStackTrace();
136 }
137 state = DoubleCheckedInt.getState();
138 }
139 };
140 }
0 package org.slf4j;
1
2 import org.junit.Ignore;
3 import org.junit.Test;
4
5 public class FindStaticLoggerBinderPathsPerfTest {
6
7 @Test
8 @Ignore
9 public void test() {
10 long duration = timeFindBindingSetCall();
11 System.out.println(duration / (1000) + " microseconds");
12
13 int count = 10;
14 long sum = 0;
15 for (int i = 0; i < count; i++) {
16 sum += timeFindBindingSetCall();
17 }
18 System.out.println(sum / (count * 1000) + " microseconds in average");
19 }
20
21 @Test
22 public void testAsync() throws InterruptedException {
23 long start = System.nanoTime();
24 FindPathSetThread thread = new FindPathSetThread();
25 thread.start();
26 long end = System.nanoTime();
27
28 long duration = end - start;
29 System.out.println(duration / (1000) + " microseconds");
30
31 thread.join();
32 }
33
34 long timeFindBindingSetCall() {
35 long start = System.nanoTime();
36
37 LoggerFactory.findPossibleStaticLoggerBinderPathSet();
38 long end = System.nanoTime();
39 return end - start;
40
41 }
42
43 static class FindPathSetThread extends Thread {
44
45 public void run() {
46 long start = System.nanoTime();
47 LoggerFactory.findPossibleStaticLoggerBinderPathSet();
48 long end = System.nanoTime();
49
50 System.out.println("Found set in " + (end - start)/1000 + " microseconds");
51
52 }
53 }
54 }
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-ext</artifactId>
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-jcl</artifactId>
4545 static {
4646 try {
4747 Class.forName("org.apache.commons.logging.impl.SLF4JLogFactory");
48 String part1 = "Detected both jcl-over-slf4j.jar AND slf4j-jcl.jar on the class path, preempting StackOverflowError. ";
48 String part1 = "Detected both jcl-over-slf4j.jar AND bound slf4j-jcl.jar on the class path, preempting StackOverflowError. ";
4949 String part2 = "See also " + JCL_DELEGATION_LOOP_URL + " for more details.";
5050
5151 Util.report(part1);
5757 }
5858
5959 // key: name (String), value: a JCLLoggerAdapter;
60 ConcurrentMap<String, Logger> loggerMap;
60 final ConcurrentMap<String, Logger> loggerMap;
6161
6262 public JCLLoggerFactory() {
6363 loggerMap = new ConcurrentHashMap<String, Logger>();
5050 }
5151
5252 /**
53 * Version tag used to check compatibility. The value of this field is
54 * modified with each release.
53 * Declare the version of the SLF4J API this implementation is compiled against.
54 * The value of this field is modified with each major release.
5555 */
56 // to avoid constant folding by the compiler, this field must *not* be final
57 public static String REQUESTED_API_VERSION = "1.6.99"; // !final
5658
57 // to avoid constant folding by the compiler, this field must *not* be final
58 public static String REQUESTED_API_VERSION = "1.6.99";
59
59
6060 // Binding specific code:
6161 private static final String loggerFactoryClassStr = JCLLoggerFactory.class.getName();
6262
4242 }
4343
4444 /**
45 * Return the singleton of this class.
46 *
47 * @return the StaticMDCBinder singleton
48 * @since 1.7.14
49 */
50 public static final StaticMDCBinder getSingleton() {
51 return SINGLETON;
52 }
53
54 /**
4555 * Currently this method always returns an instance of
4656 * {@link NOPMDCAdapter}.
4757 *
4858 * @return instance of NOPMDCAdapter
59 * @since 1.7.14
4960 */
5061 public MDCAdapter getMDCA() {
5162 return new NOPMDCAdapter();
4848 }
4949
5050 /**
51 * Return the singleton of this class.
52 *
53 * @return the StaticMarkerBinder singleton
54 * @since 1.7.14
55 */
56 public static StaticMarkerBinder getSingleton() {
57 return SINGLETON;
58 }
59
60 /**
5161 * Currently this method always returns an instance of
5262 * {@link BasicMarkerFactory}.
5363 */
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-jdk14</artifactId>
5252
5353 /**
5454 * Declare the version of the SLF4J API this implementation is compiled against.
55 * The value of this field is usually modified with each release.
55 * The value of this field is modified with each major release.
5656 */
5757 // to avoid constant folding by the compiler, this field must *not* be final
5858 public static String REQUESTED_API_VERSION = "1.6.99"; // !final
4040
4141 private StaticMDCBinder() {
4242 }
43
43
44 /**
45 * Return the singleton of this class.
46 *
47 * @return the StaticMDCBinder singleton
48 * @since 1.7.14
49 */
50 public static final StaticMDCBinder getSingleton() {
51 return SINGLETON;
52 }
53
4454 /**
4555 * Currently this method always returns an instance of
4656 * {@link BasicMDCAdapter}.
4848 }
4949
5050 /**
51 * Return the singleton of this class.
52 *
53 * @return the StaticMarkerBinder singleton
54 * @since 1.7.14
55 */
56 public static StaticMarkerBinder getSingleton() {
57 return SINGLETON;
58 }
59
60 /**
5161 * Currently this method always returns an instance of
5262 * {@link BasicMarkerFactory}.
5363 */
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-log4j12</artifactId>
2727 import java.util.concurrent.ConcurrentMap;
2828
2929 import org.apache.log4j.LogManager;
30 import org.slf4j.helpers.Util;
3031 import org.slf4j.ILoggerFactory;
3132 import org.slf4j.Logger;
3233
3738 * @author Ceki G&uuml;lc&uuml;
3839 */
3940 public class Log4jLoggerFactory implements ILoggerFactory {
41
42 private static final String LOG4J_DELEGATION_LOOP_URL = "http://www.slf4j.org/codes.html#log4jDelegationLoop";
43
44 // check for delegation loops
45 static {
46 try {
47 Class.forName("org.apache.log4j.Log4jLoggerFactory");
48 String part1 = "Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. ";
49 String part2 = "See also " + LOG4J_DELEGATION_LOOP_URL + " for more details.";
50
51 Util.report(part1);
52 Util.report(part2);
53 throw new IllegalStateException(part1 + part2);
54 } catch (ClassNotFoundException e) {
55 // this is the good case
56 }
57 }
4058
4159 // key: name (String), value: a Log4jLoggerAdapter;
4260 ConcurrentMap<String, Logger> loggerMap;
5353 }
5454
5555 /**
56 * Declare the version of the SLF4J API this implementation is compiled
57 * against. The value of this field is usually modified with each release.
56 * Declare the version of the SLF4J API this implementation is compiled against.
57 * The value of this field is modified with each major release.
5858 */
5959 // to avoid constant folding by the compiler, this field must *not* be final
6060 public static String REQUESTED_API_VERSION = "1.6.99"; // !final
3939
4040 private StaticMDCBinder() {
4141 }
42
42
43 /**
44 * Return the singleton of this class.
45 *
46 * @return the StaticMDCBinder singleton
47 * @since 1.7.14
48 */
49 public static final StaticMDCBinder getSingleton() {
50 return SINGLETON;
51 }
52
4353 /**
4454 * Currently this method always returns an instance of
4555 * {@link StaticMDCBinder}.
4848 }
4949
5050 /**
51 * Return the singleton of this class.
52 *
53 * @return the StaticMarkerBinder singleton
54 * @since 1.7.14
55 */
56 public static StaticMarkerBinder getSingleton() {
57 return SINGLETON;
58 }
59
60 /**
5161 * Currently this method always returns an instance of
5262 * {@link BasicMarkerFactory}.
5363 */
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-migrator</artifactId>
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-nop</artifactId>
5353
5454 /**
5555 * Declare the version of the SLF4J API this implementation is compiled against.
56 * The value of this field is usually modified with each release.
56 * The value of this field is modified with each major release.
5757 */
5858 // to avoid constant folding by the compiler, this field must *not* be final
5959 public static String REQUESTED_API_VERSION = "1.6.99"; // !final
4242 }
4343
4444 /**
45 * Return the singleton of this class.
46 *
47 * @return the StaticMDCBinder singleton
48 * @since 1.7.14
49 */
50 public static final StaticMDCBinder getSingleton() {
51 return SINGLETON;
52 }
53
54 /**
4555 * Currently this method always returns an instance of
4656 * {@link StaticMDCBinder}.
4757 */
4848 }
4949
5050 /**
51 * Return the singleton of this class.
52 *
53 * @return the StaticMarkerBinder singleton
54 * @since 1.7.14
55 */
56 public static StaticMarkerBinder getSingleton() {
57 return SINGLETON;
58 }
59
60 /**
5161 * Currently this method always returns an instance of
5262 * {@link BasicMarkerFactory}.
5363 */
66 <parent>
77 <groupId>org.slf4j</groupId>
88 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.13</version>
9 <version>1.7.14</version>
1010 </parent>
1111
1212 <artifactId>slf4j-simple</artifactId>
5252 }
5353
5454 /**
55 * Declare the version of the SLF4J API this implementation is compiled
56 * against. The value of this field is usually modified with each release.
55 * Declare the version of the SLF4J API this implementation is compiled against.
56 * The value of this field is modified with each major release.
5757 */
5858 // to avoid constant folding by the compiler, this field must *not* be final
5959 public static String REQUESTED_API_VERSION = "1.6.99"; // !final
4242 }
4343
4444 /**
45 * Return the singleton of this class.
46 *
47 * @return the StaticMDCBinder singleton
48 * @since 1.7.14
49 */
50 public static final StaticMDCBinder getSingleton() {
51 return SINGLETON;
52 }
53
54 /**
4555 * Currently this method always returns an instance of
4656 * {@link StaticMDCBinder}.
4757 */
4747
4848 private StaticMarkerBinder() {
4949 }
50
50
51 /**
52 * Return the singleton of this class.
53 *
54 * @return the StaticMarkerBinder singleton
55 * @since 1.7.14
56 */
57 public static StaticMarkerBinder getSingleton() {
58 return SINGLETON;
59 }
60
5161 /**
5262 * Currently this method always returns an instance of
5363 * {@link BasicMarkerFactory}.
0 <?xml version="1.0" encoding="UTF-8"?>
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
4 <modelVersion>4.0.0</modelVersion>
5
6 <parent>
7 <groupId>org.slf4j</groupId>
8 <artifactId>slf4j-parent</artifactId>
9 <version>1.7.14</version>
10 </parent>
11
12 <artifactId>slf4j-site</artifactId>
13
14 <packaging>jar</packaging>
15 <name>SLF4J Site</name>
16 <description>SLF4J Site</description>
17 <url>http://www.slf4j.org</url>
18
19 <build>
20 <resources>
21 <resource>
22 <directory>${project.basedir}/src/site/pages</directory>
23 <!-- The {project.basedir}/.. form breaks the eclipse plugin -->
24 <targetPath>../../../target/site</targetPath>
25 <filtering>true</filtering>
26 </resource>
27 <resource>
28 <directory>${project.basedir}/src/main/resources</directory>
29 </resource>
30 </resources>
31 <plugins>
32 <plugin>
33 <groupId>org.apache.maven.plugins</groupId>
34 <artifactId>maven-site-plugin</artifactId>
35 <version>${maven-site-plugin.version}</version>
36 <configuration>
37 <outputDirectory>${project.parent.basedir}/target/site</outputDirectory>
38 </configuration>
39 </plugin>
40 </plugins>
41 </build>
42
43 </project>