Skip to content

Commit

Permalink
minor tweaks transparent to users
Browse files Browse the repository at this point in the history
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
  • Loading branch information
ceki committed Aug 11, 2021
1 parent cc8e690 commit e0448ad
Show file tree
Hide file tree
Showing 16 changed files with 304 additions and 158 deletions.
8 changes: 8 additions & 0 deletions pom.xml
Expand Up @@ -109,6 +109,14 @@
<version>${project.version}</version>
</dependency>


<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${project.version}</version>
</dependency>


<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion slf4j-api/src/main/java/org/slf4j/Logger.java
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2004-2011 QOS.ch
* Copyright (c) 2004-2021 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
Expand Down
24 changes: 24 additions & 0 deletions slf4j-api/src/main/java/org/slf4j/LoggerFactoryFriend.java
@@ -1,3 +1,27 @@
/**
* Copyright (c) 2004-2021 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package org.slf4j;

/**
Expand Down
24 changes: 24 additions & 0 deletions slf4j-api/src/main/java/org/slf4j/spi/LoggingEventBuilder.java
@@ -1,3 +1,27 @@
/**
* Copyright (c) 2004-2021 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package org.slf4j.spi;

import java.util.function.Supplier;
Expand Down
Expand Up @@ -29,7 +29,7 @@
import java.util.concurrent.atomic.AtomicLong;

public class LoggerAccessingThread extends Thread {
private static int LOOP_LEN = 64;
private static int LOOP_LEN = 32;

final CyclicBarrier barrier;
final int count;
Expand Down
67 changes: 67 additions & 0 deletions slf4j-api/src/test/java/org/slf4j/helpers/StringPrintStream.java
@@ -0,0 +1,67 @@
/**
* Copyright (c) 2004-2021 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package org.slf4j.helpers;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class StringPrintStream extends PrintStream {

public static final String LINE_SEP = System.getProperty("line.separator");
PrintStream other;
boolean duplicate = false;

public List<String> stringList = Collections.synchronizedList(new ArrayList<String>());

public StringPrintStream(PrintStream ps, boolean duplicate) {
super(ps);
other = ps;
this.duplicate = duplicate;
}

public StringPrintStream(PrintStream ps) {
this(ps, false);
}

public void print(String s) {
if (duplicate)
other.print(s);
stringList.add(s);
}

public void println(String s) {
if (duplicate)
other.println(s);
stringList.add(s);
}

public void println(Object o) {
if (duplicate)
other.println(o);
stringList.add(o.toString());
}
}
12 changes: 3 additions & 9 deletions slf4j-jdk-platform-logging/pom.xml
Expand Up @@ -27,15 +27,9 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand All @@ -58,9 +52,9 @@
</configuration>
</execution>
<execution>
<id>default-test-compile</id>
<id>default-testCompile</id>
<goals>
<goal>testCompile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<source>9</source>
Expand Down
24 changes: 24 additions & 0 deletions slf4j-jdk-platform-logging/src/main/java/module-info.java
@@ -1,3 +1,27 @@
/**
* Copyright (c) 2004-2021 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
module org.slf4j.jdk {
requires org.slf4j;
provides java.lang.System.LoggerFinder with org.slf4j.jdk.SLF4JSystemLoggerFinder;
Expand Down

0 comments on commit e0448ad

Please sign in to comment.