├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── main.yml │ └── toolchains.xml ├── .gitignore ├── .idea └── codeStyleSettings.xml ├── .travis.yml ├── FUNDING.yml ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── codeStyle.xml ├── integration ├── build.xml ├── lib │ ├── junit-3.8.1.jar │ ├── slf4j-api-1.5.11.jar │ ├── slf4j-api-1.6.6.jar │ ├── slf4j-api-1.6.99.jar │ ├── slf4j-api-2.0.99.jar │ ├── slf4j-nop-1.5.6.jar │ ├── slf4j-simple-1.4.2.jar │ ├── slf4j-simple-1.5.0.jar │ ├── slf4j-simple-1.5.11.jar │ ├── slf4j-simple-1.6.6.jar │ └── slf4j-simple-1.6.99.jar ├── osgi-build.xml ├── pom.xml └── src │ ├── IBUNDLE-META-INF │ └── MANIFEST.MF │ ├── policy │ ├── java-eclipse.policy │ └── java-under-ant.policy │ └── test │ └── java │ ├── integrator │ └── Activator.java │ └── org │ └── slf4j │ ├── CompatibilityAssertionTest.java │ ├── IncompatibleMultiBindingAssertionTest.java │ ├── MultiBindingAssertionTest.java │ ├── NoProviderAssertionTest.java │ ├── OldAPIVersionMismatchAssertionTest.java │ ├── OutputVerifier.java │ ├── StringPrintStream.java │ ├── issues │ └── Issue324Test.java │ └── test_osgi │ ├── BundleTest.java │ ├── CheckingBundleListener.java │ ├── FelixHost.java │ └── FrameworkErrorListener.java ├── jcl-over-slf4j ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── logging │ │ │ ├── Log.java │ │ │ ├── LogConfigurationException.java │ │ │ ├── LogFactory.java │ │ │ ├── impl │ │ │ ├── NoOpLog.java │ │ │ ├── SLF4JLocationAwareLog.java │ │ │ ├── SLF4JLog.java │ │ │ ├── SLF4JLogFactory.java │ │ │ ├── SimpleLog.java │ │ │ └── package.html │ │ │ └── package.html │ ├── java9 │ │ └── module-info.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.apache.commons.logging.LogFactory │ └── test │ └── java │ └── org │ └── apache │ └── commons │ └── logging │ └── test │ ├── InvokeJCLTest.java │ └── SerializationTest.java ├── jul-to-slf4j ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── slf4j │ │ │ └── bridge │ │ │ ├── SLF4JBridgeHandler.java │ │ │ └── package.html │ └── java9 │ │ └── module-info.java │ └── test │ ├── java │ └── org │ │ └── slf4j │ │ └── bridge │ │ ├── ListAppender.java │ │ ├── SLF4JBridgeHandlerPerfTest.java │ │ └── SLF4JBridgeHandlerTest.java │ └── resources │ └── org │ └── slf4j │ └── bridge │ └── testLogStrings.properties ├── log4j-over-slf4j ├── LICENSE.txt ├── compatibility │ ├── build.xml │ ├── lib │ │ ├── junit-3.8.1.jar │ │ ├── log4j-1.2.14.jar │ │ ├── log4j-1.3alpha-8.jar │ │ ├── log4j-over-slf4j-1.4.2.jar │ │ ├── logback-classic-0.9.8-SNAPSHOT.jar │ │ ├── logback-core-0.9.8-SNAPSHOT.jar │ │ └── slf4j-api-1.4.2.jar │ ├── readme.txt │ └── src │ │ └── main │ │ └── java │ │ └── test │ │ ├── DummyObject.java │ │ ├── Log4j12Calls.java │ │ ├── Log4j13Calls.java │ │ └── LoggerTest.java ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── log4j │ │ │ ├── Appender.java │ │ │ ├── AppenderSkeleton.java │ │ │ ├── BasicConfigurator.java │ │ │ ├── Category.java │ │ │ ├── ConsoleAppender.java │ │ │ ├── FileAppender.java │ │ │ ├── Layout.java │ │ │ ├── Level.java │ │ │ ├── Log4jLoggerFactory.java │ │ │ ├── LogManager.java │ │ │ ├── Logger.java │ │ │ ├── MDC.java │ │ │ ├── NDC.java │ │ │ ├── PatternLayout.java │ │ │ ├── Priority.java │ │ │ ├── PropertyConfigurator.java │ │ │ ├── RollingFileAppender.java │ │ │ ├── SimpleLayout.java │ │ │ ├── WriterAppender.java │ │ │ ├── helpers │ │ │ ├── LogLog.java │ │ │ └── NullEnumeration.java │ │ │ ├── package.html │ │ │ ├── spi │ │ │ ├── Configurator.java │ │ │ ├── ErrorHandler.java │ │ │ ├── Filter.java │ │ │ ├── HierarchyEventListener.java │ │ │ ├── LoggerFactory.java │ │ │ ├── LoggerRepository.java │ │ │ ├── LoggingEvent.java │ │ │ └── OptionHandler.java │ │ │ └── xml │ │ │ └── DOMConfigurator.java │ └── java9 │ │ └── module-info.java │ └── test │ └── java │ └── org │ ├── apache │ └── log4j │ │ └── test │ │ ├── NDCTest.java │ │ └── Trivial.java │ └── dummy │ ├── Bug131.java │ ├── Bug139.java │ └── ListHandler.java ├── osgi-over-slf4j ├── LICENSE.txt ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── slf4j │ └── osgi │ └── logservice │ └── impl │ ├── Activator.java │ ├── LogServiceFactory.java │ └── LogServiceImpl.java ├── parent └── pom.xml ├── pom.xml ├── release.sh ├── slf4j-api ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── slf4j │ │ │ ├── ILoggerFactory.java │ │ │ ├── IMarkerFactory.java │ │ │ ├── Logger.java │ │ │ ├── LoggerFactory.java │ │ │ ├── LoggerFactoryFriend.java │ │ │ ├── MDC.java │ │ │ ├── Marker.java │ │ │ ├── MarkerFactory.java │ │ │ ├── event │ │ │ ├── DefaultLoggingEvent.java │ │ │ ├── EventConstants.java │ │ │ ├── EventRecordingLogger.java │ │ │ ├── KeyValuePair.java │ │ │ ├── Level.java │ │ │ ├── LoggingEvent.java │ │ │ └── SubstituteLoggingEvent.java │ │ │ ├── helpers │ │ │ ├── AbstractLogger.java │ │ │ ├── BasicMDCAdapter.java │ │ │ ├── BasicMarker.java │ │ │ ├── BasicMarkerFactory.java │ │ │ ├── CheckReturnValue.java │ │ │ ├── FormattingTuple.java │ │ │ ├── LegacyAbstractLogger.java │ │ │ ├── MarkerIgnoringBase.java │ │ │ ├── MessageFormatter.java │ │ │ ├── NOPLogger.java │ │ │ ├── NOPLoggerFactory.java │ │ │ ├── NOPMDCAdapter.java │ │ │ ├── NOP_FallbackServiceProvider.java │ │ │ ├── NamedLoggerBase.java │ │ │ ├── NormalizedParameters.java │ │ │ ├── Reporter.java │ │ │ ├── Slf4jEnvUtil.java │ │ │ ├── SubstituteLogger.java │ │ │ ├── SubstituteLoggerFactory.java │ │ │ ├── SubstituteServiceProvider.java │ │ │ ├── ThreadLocalMapOfStacks.java │ │ │ ├── Util.java │ │ │ └── package.html │ │ │ ├── package.html │ │ │ └── spi │ │ │ ├── CallerBoundaryAware.java │ │ │ ├── DefaultLoggingEventBuilder.java │ │ │ ├── LocationAwareLogger.java │ │ │ ├── LoggerFactoryBinder.java │ │ │ ├── LoggingEventAware.java │ │ │ ├── LoggingEventBuilder.java │ │ │ ├── MDCAdapter.java │ │ │ ├── MarkerFactoryBinder.java │ │ │ ├── NOPLoggingEventBuilder.java │ │ │ ├── SLF4JServiceProvider.java │ │ │ └── package.html │ └── java9 │ │ └── module-info.java │ └── test │ └── java │ └── org │ └── slf4j │ ├── LoggerAccessingThread.java │ ├── LoggerFactoryTest.java │ ├── basicTests │ ├── BasicMarkerTest.java │ ├── Differentiator.java │ ├── DoubleCheckedInt.java │ ├── FluentAPIUsage.java │ ├── NoBindingMultithreadedInitializationTest.java │ └── NoBindingTest.java │ ├── eventTest │ └── EventRecordingLoggerTest.java │ ├── helpers │ ├── BasicMDCAdapterTest.java │ ├── MDCAdapterTestBase.java │ ├── MessageFormatterTest.java │ ├── StringPrintStream.java │ ├── SubstitutableLoggerTest.java │ └── SubstituteLoggerFactoryTest.java │ ├── rule │ ├── BlaTest.java │ ├── RunInNewThread.java │ ├── RunInNewThreadRule.java │ └── RunInNewThreadStatement.java │ └── testHarness │ └── MultithreadedInitializationTest.java ├── slf4j-ext ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── slf4j │ │ ├── NDC.java │ │ ├── agent │ │ ├── AgentOptions.java │ │ ├── AgentPremain.java │ │ └── package.html │ │ ├── cal10n │ │ ├── LocLogger.java │ │ ├── LocLoggerFactory.java │ │ └── package.html │ │ ├── ext │ │ ├── LoggerWrapper.java │ │ ├── XLogger.java │ │ ├── XLoggerFactory.java │ │ └── package.html │ │ ├── instrumentation │ │ ├── JavassistHelper.java │ │ ├── LogTransformer.java │ │ ├── ToStringHelper.java │ │ └── package.html │ │ └── profiler │ │ ├── DurationUnit.java │ │ ├── Profiler.java │ │ ├── ProfilerRegistry.java │ │ ├── SpacePadder.java │ │ ├── StopWatch.java │ │ ├── TimeInstrument.java │ │ ├── TimeInstrumentStatus.java │ │ ├── Util.java │ │ └── package.html │ └── test │ ├── java │ └── org │ │ └── slf4j │ │ ├── NDCTest.java │ │ ├── cal10n_dummy │ │ ├── LocLoggerTest.java │ │ ├── Months.java │ │ ├── MyApplication.java │ │ ├── PackageTest.java │ │ └── Production.java │ │ ├── dummyExt │ │ ├── ListAppender.java │ │ ├── PackageTest.java │ │ ├── XLoggerTest.java │ │ └── package.html │ │ ├── instrumentation │ │ └── ToStringHelperTest.java │ │ └── profiler │ │ ├── BasicProfilerDemo.java │ │ ├── NestedProfilerDemo.java │ │ ├── NestedProfilerDemo2.java │ │ ├── PackageTest.java │ │ ├── ProfilerTest.java │ │ ├── RandomIntegerArrayGenerator.java │ │ ├── SortAndPruneComposites.java │ │ └── UtilTest.java │ └── resources │ ├── log4j.properties │ ├── months_en.properties │ ├── production_en_UK.properties │ └── production_fr.properties ├── slf4j-jdk-platform-logging ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ ├── module-info.java │ │ └── org │ │ │ └── slf4j │ │ │ └── jdk │ │ │ └── platform │ │ │ └── logging │ │ │ ├── SLF4JPlatformLogger.java │ │ │ ├── SLF4JPlatformLoggerFactory.java │ │ │ └── SLF4JSystemLoggerFinder.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── java.lang.System$LoggerFinder │ └── test │ └── java │ └── org │ └── slf4j │ └── jdk │ └── platform │ └── logging │ └── test │ ├── SLF4JPlatformLoggingTest.java │ └── StringPrintStream.java ├── slf4j-jdk14 ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── slf4j │ │ │ └── jul │ │ │ ├── JDK14LoggerAdapter.java │ │ │ ├── JDK14LoggerFactory.java │ │ │ └── JULServiceProvider.java │ ├── java9 │ │ └── module-info.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.slf4j.spi.SLF4JServiceProvider │ └── test │ └── java │ └── org │ └── slf4j │ ├── issue │ ├── CallerInfoTest.java │ └── LoggerSerializationTest.java │ └── jul │ ├── CountingHandler.java │ ├── FluentApiInvocationTest.java │ ├── InvocationTest.java │ ├── JDK14AdapterLoggerNameTest.java │ ├── JDK14MultithreadedInitializationTest.java │ └── ListHandler.java ├── slf4j-log4j12 ├── LICENSE.txt └── pom.xml ├── slf4j-migrator ├── LICENSE.txt ├── LIMITATIONS.txt ├── jcl │ └── jclcontent.java ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── slf4j │ │ └── migrator │ │ ├── Constant.java │ │ ├── ConversionException.java │ │ ├── FileSelector.java │ │ ├── InplaceFileConverter.java │ │ ├── Main.java │ │ ├── ProjectConverter.java │ │ ├── RuleSetFactory.java │ │ ├── helper │ │ ├── Abbreviator.java │ │ └── SpringLayoutHelper.java │ │ ├── internal │ │ ├── ConversionTask.java │ │ ├── MigratorFrame.java │ │ ├── ProgressListener.java │ │ └── ProgressListenerImpl.java │ │ └── line │ │ ├── ConversionRule.java │ │ ├── EmptyRuleSet.java │ │ ├── JCLRuleSet.java │ │ ├── JULRuleSet.java │ │ ├── LineConverter.java │ │ ├── Log4jRuleSet.java │ │ ├── MultiGroupConversionRule.java │ │ ├── RuleSet.java │ │ └── SingleConversionRule.java │ └── test │ └── java │ └── org │ └── slf4j │ └── migrator │ ├── AllTest.java │ ├── AternativeApproach.java │ ├── FileConverterTest.java │ ├── PackageTest.java │ ├── ProjectConverterTest.java │ ├── helper │ ├── AbbreviatorTest.java │ ├── PackageTest.java │ └── RandomHelper.java │ ├── internal │ └── NopProgressListener.java │ └── line │ ├── JCLRuleSetTest.java │ ├── Log4jRuleSetTest.java │ ├── NoConversionTest.java │ ├── PackageTest.java │ ├── TrivialMatcher.java │ └── TrivialMatcherTest.java ├── slf4j-nop ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── slf4j │ │ │ └── nop │ │ │ └── NOPServiceProvider.java │ ├── java9 │ │ └── module-info.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.slf4j.spi.SLF4JServiceProvider │ └── test │ └── java │ └── org │ └── slf4j │ └── nop │ ├── InvocationTest.java │ └── MultithreadedInitializationTest.java ├── slf4j-reload4j ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── slf4j │ │ │ └── reload4j │ │ │ ├── Reload4jLoggerAdapter.java │ │ │ ├── Reload4jLoggerFactory.java │ │ │ ├── Reload4jMDCAdapter.java │ │ │ └── Reload4jServiceProvider.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.slf4j.spi.SLF4JServiceProvider │ └── test │ ├── java │ └── org │ │ └── slf4j │ │ └── reload4j │ │ ├── EventFieldsTest.java │ │ ├── InvocationTest.java │ │ ├── ListAppender.java │ │ ├── RecursiveInitializationTest.java │ │ ├── Reload4jMDCAdapterTest.java │ │ ├── Reload4jMultithreadedInitializationTest.java │ │ └── testHarness │ │ └── RecursiveAppender.java │ └── resources │ ├── eventFields.properties │ ├── recursiveInit.properties │ └── recursiveInitWithActivationDelay.properties ├── slf4j-simple ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── slf4j │ │ │ └── simple │ │ │ ├── OutputChoice.java │ │ │ ├── SimpleLogger.java │ │ │ ├── SimpleLoggerConfiguration.java │ │ │ ├── SimpleLoggerFactory.java │ │ │ └── SimpleServiceProvider.java │ ├── java9 │ │ └── module-info.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.slf4j.spi.SLF4JServiceProvider │ └── test │ ├── java │ └── org │ │ └── slf4j │ │ └── simple │ │ ├── AcceptanceTest.java │ │ ├── DetectLoggerNameMismatchTest.java │ │ ├── DoubleInitializationPitfallTest.java │ │ ├── InvocationTest.java │ │ ├── LoggerTestSuite.java │ │ ├── SilentPrintStream.java │ │ ├── SimpleLoggerMultithreadedInitializationTest.java │ │ ├── SimpleLoggerTest.java │ │ ├── Slf4jVersionTest.java │ │ └── multiThreadedExecution │ │ ├── MultithereadedExecutionTest.java │ │ └── StateCheckingPrintStream.java │ └── resources │ └── simplelogger.properties └── src └── main ├── javadocHeaders.xml └── licenseHeader.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | tidelift: maven/org.slf4j:slf4j-api 2 | github: qos-ch -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | pull_request: 8 | branches: 9 | - '*' 10 | 11 | # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners 12 | 13 | concurrency: 14 | # On master/release, we don't want any jobs cancelled so the sha is used to name the group 15 | # On PR branches, we cancel the job if new commits are pushed 16 | # More info: https://stackoverflow.com/a/68422069/253468 17 | group: ${{ (github.ref == 'refs/heads/branch_1.2.18' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release' ) && format('ci-main-{0}', github.sha) || format('ci-main-{0}', github.ref) }} 18 | cancel-in-progress: true 19 | 20 | permissions: 21 | contents: read 22 | 23 | jobs: 24 | Test: 25 | name: JDK ${{ matrix.jdk }}, ${{ matrix.os }} 26 | runs-on: ${{ matrix.os }} 27 | strategy: 28 | matrix: 29 | jdk: [11, 17, 19] 30 | os: [ubuntu-latest, windows-latest, macos-latest] 31 | fail-fast: true 32 | max-parallel: 4 33 | steps: 34 | - uses: actions/checkout@v3 35 | with: 36 | fetch-depth: 50 37 | - name: Set up Java ${{ matrix.jdk }} 38 | if: ${{ matrix.jdk != '8' }} 39 | uses: actions/setup-java@v3 40 | with: 41 | distribution: 'temurin' 42 | java-version: ${{ matrix.jdk }} 43 | - name: Install 44 | # download dependencies, etc, so test log looks better 45 | run: mvn -B install 46 | 47 | 48 | -------------------------------------------------------------------------------- /.github/workflows/toolchains.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jdk 5 | 6 | 1.8 7 | 8 | 9 | ${env.JAVA_HOME_8} 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | target 3 | .classpath 4 | .project 5 | *~ 6 | *.tmproj 7 | *.iml 8 | .idea 9 | .scala_dependencies 10 | integration/bundle/ 11 | integration/felix-cache/ 12 | runner 13 | .DS_Store 14 | -------------------------------------------------------------------------------- /.idea/codeStyleSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 46 | 48 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | 3 | language: java 4 | 5 | jdk: 6 | - oraclejdk11 7 | 8 | notifications: 9 | email: 10 | - notification@qos.ch 11 | 12 | install: /bin/true 13 | 14 | script: 15 | - mvn clean 16 | - mvn install 17 | 18 | cache: 19 | directories: 20 | - $HOME/.m2 21 | -------------------------------------------------------------------------------- /FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: qos-ch -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland) 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | ## Reporting security issues 3 | 4 | Please report security issues related to the SLF4J project to the 5 | following email address: 6 | 7 | support(at)qos.ch 8 | 9 | 10 | 11 | 12 | ## Verifying contents 13 | 14 | All SLF4J project artifacts published on Maven central are signed. For 15 | each artifact, there is an associated signature file with the .asc 16 | suffix. 17 | 18 | ### After 2022-08-08 19 | 20 | To verify the signature use [this public key](https://www.slf4j.org/public-keys/60200AC4AE761F1614D6C46766D68DAA073BE985.gpg). Here is its fingerprint: 21 | ``` 22 | pub nistp521 2022-08-08 [SC] 23 | 60200AC4AE761F1614D6C46766D68DAA073BE985 24 | uid Ceki Gulcu 25 | sub nistp521 2022-08-08 [E] 26 | ``` 27 | 28 | A copy of this key is stored on the 29 | [keys.openpgp.org](https://keys.openpgp.org) keyserver. To add it to 30 | your public key ring use the following command: 31 | 32 | ``` 33 | > FINGER_PRINT=60200AC4AE761F1614D6C46766D68DAA073BE985 34 | > gpg --keyserver hkps://keys.openpgp.org --recv-keys $FINGER_PRINT 35 | ``` 36 | 37 | ### Before 2022-08-08 38 | 39 | To verify the signature use [this public key](https://www.slf4j.org/public-keys/ceki-public-key.pgp). Here is its fingerprint: 40 | 41 | ``` 42 | pub 2048R/A511E325 2012-04-26 43 | Key fingerprint = 475F 3B8E 59E6 E63A A780 6748 2C7B 12F2 A511 E325 44 | uid Ceki Gulcu 45 | sub 2048R/7FBFA159 2012-04-26 46 | ``` 47 | 48 | A copy of this key is stored on the 49 | [keys.openpgp.org](https://keys.openpgp.org) keyserver. To add it to 50 | your public key ring use the following command: 51 | 52 | ``` 53 | > FINGER_PRINT=475F3B8E59E6E63AA78067482C7B12F2A511E325 54 | > gpg --keyserver hkps://keys.openpgp.org --recv-keys $FINGER_PRINT 55 | ``` 56 | 57 | 58 | ## Preventing commit history overwrite 59 | 60 | In order to prevent loss of commit history, developers of the project 61 | are highly encouraged to deny branch deletions or history overwrites 62 | by invoking the following two commands on their local copy of the 63 | repository. 64 | 65 | 66 | ``` 67 | git config receive.denyDelete true 68 | git config receive.denyNonFastForwards true 69 | ``` -------------------------------------------------------------------------------- /integration/lib/junit-3.8.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/junit-3.8.1.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-api-1.5.11.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-api-1.5.11.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-api-1.6.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-api-1.6.6.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-api-1.6.99.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-api-1.6.99.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-api-2.0.99.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-api-2.0.99.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-nop-1.5.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-nop-1.5.6.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-simple-1.4.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-simple-1.4.2.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-simple-1.5.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-simple-1.5.0.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-simple-1.5.11.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-simple-1.5.11.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-simple-1.6.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-simple-1.6.6.jar -------------------------------------------------------------------------------- /integration/lib/slf4j-simple-1.6.99.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/integration/lib/slf4j-simple-1.6.99.jar -------------------------------------------------------------------------------- /integration/src/IBUNDLE-META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Archiver-Version: Plexus Archiver 3 | Created-By: Apache Maven 4 | Built-By: ceki 5 | Build-Jdk: 1.6.0_16 6 | Bundle-Description: iBundle 7 | Bundle-Version: 0.1 8 | Bundle-Activator: integrator.Activator 9 | Implementation-Title: iBundle 10 | Bundle-ManifestVersion: 2 11 | Bundle-SymbolicName: iBundle 12 | Bundle-Name: abundle 13 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 14 | Export-Package: apack 15 | Import-Package: org.osgi.framework, org.slf4j;version=1.5 -------------------------------------------------------------------------------- /integration/src/policy/java-eclipse.policy: -------------------------------------------------------------------------------- 1 | 2 | grant { 3 | 4 | // note that java.lang.RuntimePermission createSecurityManager is NOT granted 5 | 6 | permission java.util.PropertyPermission "user.dir", "read"; 7 | permission java.util.PropertyPermission "*", "read"; 8 | 9 | permission java.net.SocketPermission "*", "connect,resolve"; 10 | }; -------------------------------------------------------------------------------- /integration/src/policy/java-under-ant.policy: -------------------------------------------------------------------------------- 1 | 2 | grant { 3 | 4 | // note that java.lang.RuntimePermission createSecurityManager is NOT granted 5 | 6 | permission java.util.PropertyPermission "user.dir", "read"; 7 | 8 | // permissions required for Ant's Junit runner 9 | permission java.util.PropertyPermission "*", "read, write"; 10 | permission java.io.FilePermission "./-", "read"; 11 | permission java.io.FilePermission "./-", "write"; 12 | permission java.lang.RuntimePermission "setIO"; 13 | }; -------------------------------------------------------------------------------- /integration/src/test/java/integrator/Activator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package integrator; 26 | 27 | import org.osgi.framework.Bundle; 28 | import org.osgi.framework.BundleActivator; 29 | import org.osgi.framework.BundleContext; 30 | import org.slf4j.Logger; 31 | import org.slf4j.LoggerFactory; 32 | 33 | /** 34 | * A BundleActivator which invokes slf4j loggers 35 | * @author Ceki Gülcü 36 | * 37 | */ 38 | public class Activator implements BundleActivator { 39 | 40 | private BundleContext m_context = null; 41 | 42 | public void start(BundleContext context) { 43 | Logger logger = LoggerFactory.getLogger(this.getClass()); 44 | logger.info("Activator.start()"); 45 | m_context = context; 46 | } 47 | 48 | public void stop(BundleContext context) { 49 | m_context = null; 50 | Logger logger = LoggerFactory.getLogger(this.getClass()); 51 | logger.info("Activator.stop"); 52 | } 53 | 54 | public Bundle[] getBundles() { 55 | if (m_context != null) { 56 | return m_context.getBundles(); 57 | } 58 | return null; 59 | } 60 | } -------------------------------------------------------------------------------- /integration/src/test/java/org/slf4j/NoProviderAssertionTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2016 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j; 26 | 27 | import java.io.PrintStream; 28 | import java.util.Random; 29 | 30 | import org.junit.After; 31 | import org.junit.Before; 32 | import org.junit.Test; 33 | 34 | public class NoProviderAssertionTest { 35 | 36 | StringPrintStream sps = new StringPrintStream(System.err); 37 | PrintStream old = System.err; 38 | int diff = 1024 + new Random().nextInt(10000); 39 | 40 | @Before 41 | public void setUp() throws Exception { 42 | System.setErr(sps); 43 | } 44 | 45 | @After 46 | public void tearDown() throws Exception { 47 | System.setErr(old); 48 | } 49 | 50 | @Test 51 | public void test() throws Exception { 52 | Logger logger = LoggerFactory.getLogger(this.getClass()); 53 | String msg = "hello world " + diff; 54 | logger.info(msg); 55 | OutputVerifier.noProvider(sps); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /integration/src/test/java/org/slf4j/OutputVerifier.java: -------------------------------------------------------------------------------- 1 | package org.slf4j; 2 | 3 | import static junit.framework.Assert.assertTrue; 4 | 5 | public class OutputVerifier { 6 | 7 | static void noProvider(StringPrintStream sps) { 8 | dump(sps); 9 | int lineCount = sps.stringList.size(); 10 | assertTrue("number of lines should be 6 but was " + lineCount, lineCount == 6); 11 | 12 | // expected output: (version 1.8) 13 | // SLF4J: No SLF4J providers were found. 14 | // SLF4J: Defaulting to no-operation (NOP) logger implementation 15 | // SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details. 16 | // SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8. 17 | // SLF4J: Ignoring binding found at 18 | // [jar:file:..../slf4j-simple-1.4.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] 19 | // SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation. 20 | 21 | { 22 | String s = (String) sps.stringList.get(0); 23 | assertTrue(s.contains("No SLF4J providers were found.")); 24 | } 25 | { 26 | String s = (String) sps.stringList.get(1); 27 | assertTrue(s.contains("Defaulting to no-operation (NOP) logger implementation")); 28 | } 29 | { 30 | String s = (String) sps.stringList.get(2); 31 | assertTrue(s.contains("See https://www.slf4j.org/codes.html#noProviders for further details.")); 32 | } 33 | 34 | { 35 | String s = (String) sps.stringList.get(3); 36 | assertTrue(s.contains("Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.")); 37 | } 38 | 39 | { 40 | String s = (String) sps.stringList.get(4); 41 | assertTrue(s.contains("Ignoring binding found at")); 42 | } 43 | { 44 | String s = (String) sps.stringList.get(5); 45 | assertTrue(s.contains("See https://www.slf4j.org/codes.html#ignoredBindings for an explanation")); 46 | } 47 | } 48 | 49 | public static void dump(StringPrintStream sps) { 50 | for (String s : sps.stringList) { 51 | System.out.println(s); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /integration/src/test/java/org/slf4j/StringPrintStream.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j; 26 | 27 | import java.io.PrintStream; 28 | import java.util.ArrayList; 29 | import java.util.List; 30 | 31 | public class StringPrintStream extends PrintStream { 32 | 33 | public static final String LINE_SEP = System.getProperty("line.separator"); 34 | PrintStream other; 35 | List stringList = new ArrayList<>(); 36 | 37 | public StringPrintStream(PrintStream ps) { 38 | super(ps); 39 | other = ps; 40 | } 41 | 42 | public void print(String s) { 43 | other.print(s); 44 | stringList.add(s); 45 | } 46 | 47 | public void println(String s) { 48 | other.println(s); 49 | stringList.add(s); 50 | } 51 | 52 | public void println(Object o) { 53 | other.println(o); 54 | stringList.add(o.toString()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /integration/src/test/java/org/slf4j/issues/Issue324Test.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.issues; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import junit.framework.TestCase; 7 | 8 | public class Issue324Test extends TestCase { 9 | 10 | public void testLoggerCreationInPresenceOfSecurityManager() { 11 | String currentDir = System.getProperty("user.dir"); 12 | System.out.println("currentDir:" + currentDir); 13 | Logger logger = LoggerFactory.getLogger(Issue324Test.class); 14 | logger.debug("hello"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jcl-over-slf4j/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | org.slf4j 7 | slf4j-parent 8 | 2.0.18-SNAPSHOT 9 | ../parent/pom.xml 10 | 11 | 12 | 4.0.0 13 | 14 | jcl-over-slf4j 15 | jar 16 | JCL 1.2 implemented over SLF4J 17 | JCL 1.2 implemented over SLF4J 18 | http://www.slf4j.org 19 | 20 | 21 | 22 | Apache-2.0 23 | https://www.apache.org/licenses/LICENSE-2.0.txt 24 | repo 25 | 26 | 27 | 28 | 29 | org.apache.commons.logging 30 | 31 | 32 | 33 | 34 | org.slf4j 35 | slf4j-api 36 | 37 | 38 | org.slf4j 39 | slf4j-jdk14 40 | test 41 | 42 | 43 | 44 | 45 | 46 | 47 | org.apache.felix 48 | maven-bundle-plugin 49 | 50 | 51 | <_exportcontents>org.apache.commons.logging*;version=${jcl.version};-noimport:=true 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

SLF4J based implementation of commons-logging wrapper APIs.

4 | 5 | 6 | -------------------------------------------------------------------------------- /jcl-over-slf4j/src/main/java9/module-info.java: -------------------------------------------------------------------------------- 1 | module org.apache.commons.logging { 2 | requires org.slf4j; 3 | exports org.apache.commons.logging; 4 | } 5 | -------------------------------------------------------------------------------- /jcl-over-slf4j/src/main/resources/META-INF/services/org.apache.commons.logging.LogFactory: -------------------------------------------------------------------------------- 1 | org.apache.commons.logging.impl.SLF4JLogFactory 2 | 3 | # Axis gets at JCL through its own mechanism as defined by Commons Discovery, which 4 | # in turn follows the instructions found at: 5 | # http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service Provider 6 | -------------------------------------------------------------------------------- /jul-to-slf4j/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland) 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /jul-to-slf4j/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.slf4j 9 | slf4j-parent 10 | 2.0.18-SNAPSHOT 11 | ../parent/pom.xml 12 | 13 | 14 | jul-to-slf4j 15 | 16 | jar 17 | JUL to SLF4J bridge 18 | JUL to SLF4J bridge 19 | 20 | http://www.slf4j.org 21 | 22 | 23 | 24 | org.slf4j 25 | slf4j-api 26 | 27 | 28 | org.slf4j 29 | slf4j-reload4j 30 | ${project.version} 31 | test 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /jul-to-slf4j/src/main/java/org/slf4j/bridge/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Bridge/route all JUL log records to the SLF4J API.

12 | 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /jul-to-slf4j/src/main/java9/module-info.java: -------------------------------------------------------------------------------- 1 | module jul.to.slf4j { 2 | 3 | requires org.slf4j; 4 | requires java.logging; 5 | 6 | exports org.slf4j.bridge; 7 | } -------------------------------------------------------------------------------- /jul-to-slf4j/src/test/java/org/slf4j/bridge/ListAppender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.bridge; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | import org.apache.log4j.AppenderSkeleton; 31 | import org.apache.log4j.spi.LoggingEvent; 32 | 33 | public class ListAppender extends AppenderSkeleton { 34 | 35 | public List list = new ArrayList<>(); 36 | 37 | public boolean extractLocationInfo = false; 38 | 39 | protected void append(LoggingEvent event) { 40 | list.add(event); 41 | if (extractLocationInfo) { 42 | event.getLocationInformation(); 43 | } 44 | } 45 | 46 | public void close() { 47 | } 48 | 49 | public boolean requiresLayout() { 50 | return false; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /jul-to-slf4j/src/test/resources/org/slf4j/bridge/testLogStrings.properties: -------------------------------------------------------------------------------- 1 | resource_key=msg 2 | resource_key_1=msg 3 | resource_key_2=msg {0} {1} 4 | -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/lib/junit-3.8.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/log4j-over-slf4j/compatibility/lib/junit-3.8.1.jar -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/lib/log4j-1.2.14.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/log4j-over-slf4j/compatibility/lib/log4j-1.2.14.jar -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/lib/log4j-1.3alpha-8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/log4j-over-slf4j/compatibility/lib/log4j-1.3alpha-8.jar -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/lib/log4j-over-slf4j-1.4.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/log4j-over-slf4j/compatibility/lib/log4j-over-slf4j-1.4.2.jar -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/lib/logback-classic-0.9.8-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/log4j-over-slf4j/compatibility/lib/logback-classic-0.9.8-SNAPSHOT.jar -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/lib/logback-core-0.9.8-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/log4j-over-slf4j/compatibility/lib/logback-core-0.9.8-SNAPSHOT.jar -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/lib/slf4j-api-1.4.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qos-ch/slf4j/183aaa507040ce6c61f70762c13e7d11aa4fd54e/log4j-over-slf4j/compatibility/lib/slf4j-api-1.4.2.jar -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is used to test the module against various log4j calls. 3 | Two test cases simulate the typical calls that one can find in an application 4 | that uses either log4j 1.2.x, or log4j 1.3.x. 5 | 6 | In the same directory is a build.xml file that uses ant to 7 | compile the test cases with the corresponding log4j version, 8 | and to run these tests without log4j in the classpath but with 9 | logback jars instead. 10 | 11 | To run the tests, one must have ant installed. Issuing the following command, 12 | once in the compatibility directory will launch the tests: 13 | 14 | ant all 15 | 16 | To obtain more information about the use of the log4j-over-slf4j module, 17 | please visit http://www.slf4j.org/log4j-over-slf4j.html 18 | -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/src/main/java/test/DummyObject.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | public class DummyObject { 4 | 5 | public String toString() { 6 | return "dummy"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/src/main/java/test/Log4j12Calls.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Logback: the reliable, generic, fast and flexible logging framework. 3 | * 4 | * Copyright (C) 1999-2006, QOS.ch 5 | * 6 | * This library is free software, you can redistribute it and/or modify it under 7 | * the terms of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation. 9 | */ 10 | package test; 11 | 12 | import junit.framework.TestCase; 13 | 14 | import org.apache.log4j.Logger; 15 | import org.apache.log4j.MDC; 16 | 17 | /** 18 | * 19 | * A test case that issues the typical calls 20 | * that an application using log4j 1.2 would do. 21 | * 22 | * @author Ceki Gülcü 23 | * @author Sébastien Pennec 24 | */ 25 | public class Log4j12Calls extends TestCase { 26 | public static final Logger logger = Logger.getLogger(Log4j12Calls.class); 27 | 28 | public void testLog() { 29 | MDC.put("key", "value1"); 30 | 31 | logger.trace("Trace level can be noisy"); 32 | logger.debug("Entering application"); 33 | logger.info("Violets are blue"); 34 | logger.warn("Here is a warning"); 35 | logger.error("Exiting application", new Exception("just testing")); 36 | 37 | MDC.remove("key"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /log4j-over-slf4j/compatibility/src/main/java/test/Log4j13Calls.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Logback: the reliable, generic, fast and flexible logging framework. 3 | * 4 | * Copyright (C) 1999-2006, QOS.ch 5 | * 6 | * This library is free software, you can redistribute it and/or modify it under 7 | * the terms of the GNU Lesser General Public License as published by the Free 8 | * Software Foundation. 9 | */ 10 | 11 | package test; 12 | 13 | import junit.framework.TestCase; 14 | 15 | import org.apache.log4j.Logger; 16 | import org.apache.log4j.MDC; 17 | 18 | /** 19 | * 20 | * A test case that issues the typical calls 21 | * that an application using log4j 1.3 would do. 22 | * 23 | * @author Ceki Gülcü 24 | * @author Sébastien Pennec 25 | */ 26 | 27 | public class Log4j13Calls extends TestCase { 28 | public static final Logger logger = Logger.getLogger(Log4j12Calls.class); 29 | 30 | public void testLog() { 31 | MDC.put("key", "value1"); 32 | 33 | logger.trace("Trace level can be noisy"); 34 | logger.debug("Entering application"); 35 | logger.info("Violets are blue"); 36 | logger.warn("Here is a warning"); 37 | logger.info("The answer is {}.", new Integer(42)); 38 | logger.info("Number: {} and another one: {}.", new Integer(42), new Integer(24)); 39 | 40 | logger.error("Exiting application", new Exception("just testing")); 41 | 42 | MDC.remove("key"); 43 | 44 | MDC.clear(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /log4j-over-slf4j/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.slf4j 9 | slf4j-parent 10 | 2.0.18-SNAPSHOT 11 | ../parent/pom.xml 12 | 13 | 14 | 15 | log4j-over-slf4j 16 | jar 17 | Log4j Implemented Over SLF4J 18 | Log4j implemented over SLF4J 19 | 20 | http://www.slf4j.org 21 | 22 | 23 | 24 | Apache-2.0 25 | https://www.apache.org/licenses/LICENSE-2.0.txt 26 | 27 | 28 | 29 | 30 | log4j 31 | 32 | 33 | 34 | 35 | org.slf4j 36 | slf4j-api 37 | 38 | 39 | org.slf4j 40 | slf4j-jdk14 41 | test 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | org.apache.felix 50 | maven-bundle-plugin 51 | 52 | 53 | <_exportcontents>org.apache.log4j*;version=${reload4j.version};-noimport:=true 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/AppenderSkeleton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.log4j; 17 | 18 | import org.apache.log4j.spi.OptionHandler; 19 | 20 | public class AppenderSkeleton implements OptionHandler { 21 | 22 | public void setLayout(Layout layout) { 23 | } 24 | 25 | public void setName(String name) { 26 | } 27 | 28 | public void activateOptions() { 29 | } 30 | 31 | public void setThreshold(Priority threshold) { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/BasicConfigurator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j; 18 | 19 | /** 20 | * A minimal (nop) implementation of BasicConfigurator. 21 | */ 22 | public class BasicConfigurator { 23 | public static void configure() { 24 | } 25 | 26 | public static void configure(Appender appender) { 27 | } 28 | 29 | public static void resetConfiguration() { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/ConsoleAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.log4j; 17 | 18 | /** 19 | * Skeleton implementation of ConsoleAppender 20 | */ 21 | public class ConsoleAppender extends WriterAppender { 22 | 23 | public ConsoleAppender() { 24 | } 25 | 26 | public ConsoleAppender(Layout layout) { 27 | } 28 | 29 | public ConsoleAppender(Layout layout, String target) { 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/FileAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.log4j; 17 | 18 | public class FileAppender extends WriterAppender { 19 | 20 | public FileAppender() { 21 | } 22 | 23 | public FileAppender(Layout layout, String filename) { 24 | } 25 | 26 | public FileAppender(Layout layout, String filename, boolean append) { 27 | } 28 | 29 | public FileAppender(Layout layout, String filename, boolean append, boolean bufferedIO, int bufferSize) { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/Layout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Contributors: Christian Trutz 18 | package org.apache.log4j; 19 | 20 | /** 21 | * This class is a minimal implementation of the original Log4J class. 22 | * 23 | * @author Christian Trutz 24 | * */ 25 | public class Layout { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j; 18 | 19 | import java.util.Hashtable; 20 | import java.util.Map; 21 | 22 | public class MDC { 23 | 24 | public static void put(String key, String value) { 25 | org.slf4j.MDC.put(key, value); 26 | } 27 | 28 | public static void put(String key, Object value) { 29 | if (value != null) { 30 | put(key, value.toString()); 31 | } else { 32 | put(key, null); 33 | } 34 | } 35 | 36 | public static Object get(String key) { 37 | return org.slf4j.MDC.get(key); 38 | } 39 | 40 | public static void remove(String key) { 41 | org.slf4j.MDC.remove(key); 42 | } 43 | 44 | public static void clear() { 45 | org.slf4j.MDC.clear(); 46 | } 47 | 48 | /** 49 | * This method is not part of the Log4J public API. However it 50 | * has been called by other projects. This method is here temporarily 51 | * until projects who are depending on this method release fixes. 52 | * 53 | * @return a copy of the underlying map returned as a Hashtable 54 | */ 55 | @SuppressWarnings({ "rawtypes", "unchecked" }) 56 | @Deprecated 57 | public static Hashtable getContext() { 58 | Map map = org.slf4j.MDC.getCopyOfContextMap(); 59 | 60 | if (map != null) { 61 | return new Hashtable(map); 62 | } else { 63 | return new Hashtable(); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/PatternLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Contributors: Christian Trutz 18 | package org.apache.log4j; 19 | 20 | /** 21 | * This class is a minimal implementation of the original Log4J class. 22 | * 23 | * @author Christian Trutz 24 | * */ 25 | public class PatternLayout extends Layout { 26 | 27 | public PatternLayout() { 28 | super(); 29 | } 30 | 31 | public PatternLayout(String pattern) { 32 | super(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/PropertyConfigurator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j; 18 | 19 | import java.net.URL; 20 | import java.util.Properties; 21 | 22 | import org.apache.log4j.spi.Configurator; 23 | import org.apache.log4j.spi.LoggerRepository; 24 | 25 | /** 26 | * A no-op implementation of PropertyConfigurator. 27 | */ 28 | public class PropertyConfigurator implements Configurator { 29 | public static void configure(Properties properties) { 30 | } 31 | 32 | public static void configure(String configFilename) { 33 | } 34 | 35 | public static void configure(java.net.URL configURL) { 36 | } 37 | 38 | public static void configureAndWatch(String configFilename) { 39 | } 40 | 41 | public static void configureAndWatch(String configFilename, long delay) { 42 | } 43 | 44 | public void doConfigure(Properties properties, LoggerRepository hierarchy) { 45 | } 46 | 47 | public void doConfigure(String configFileName, LoggerRepository hierarchy) { 48 | } 49 | 50 | public void doConfigure(URL configURL, LoggerRepository hierarchy) { 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/RollingFileAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Contributors: Christian Trutz 18 | package org.apache.log4j; 19 | 20 | import java.io.IOException; 21 | 22 | /** 23 | * This class is a minimal implementation of the original Log4J class. 24 | * 25 | * @author Christian Trutz 26 | * */ 27 | public class RollingFileAppender { 28 | 29 | public RollingFileAppender() { 30 | super(); 31 | } 32 | 33 | public RollingFileAppender(Layout layout, String filename) throws IOException { 34 | super(); 35 | } 36 | 37 | public RollingFileAppender(Layout layout, String filename, boolean append) throws IOException { 38 | super(); 39 | } 40 | 41 | public void setMaxBackupIndex(int maxBackups) { 42 | // nothing to do 43 | } 44 | 45 | public void setMaximumFileSize(long maxFileSize) { 46 | // nothing to do 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/SimpleLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.log4j; 17 | 18 | public class SimpleLayout extends Layout { 19 | } 20 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/WriterAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.log4j; 17 | 18 | public class WriterAppender extends AppenderSkeleton { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/helpers/NullEnumeration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.apache.log4j.helpers; 19 | 20 | import java.util.Enumeration; 21 | import java.util.NoSuchElementException; 22 | 23 | /** 24 | * An always-empty Enumerator. 25 | * 26 | * @author Anders Kristensen 27 | * @since version 1.0 28 | */ 29 | @SuppressWarnings("rawtypes") 30 | public class NullEnumeration implements Enumeration { 31 | private static final NullEnumeration instance = new NullEnumeration(); 32 | 33 | private NullEnumeration() { 34 | } 35 | 36 | public static NullEnumeration getInstance() { 37 | return instance; 38 | } 39 | 40 | public boolean hasMoreElements() { 41 | return false; 42 | } 43 | 44 | public Object nextElement() { 45 | throw new NoSuchElementException(); 46 | } 47 | } -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

An rather minimal but sufficient implementation redirecting all 13 | calls to a log4j logger to a logback logger.

14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Configurator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j.spi; 18 | 19 | import java.net.URL; 20 | 21 | /** 22 | Implemented by classes capable of configuring log4j using a URL. 23 | 24 | @since 1.0 25 | @author Anders Kristensen 26 | */ 27 | public interface Configurator { 28 | 29 | /** 30 | Special level value signifying inherited behaviour. The current 31 | value of this string constant is inherited. {@link #NULL} 32 | is a synonym. */ 33 | public static final String INHERITED = "inherited"; 34 | 35 | /** 36 | Special level signifying inherited behaviour, same as {@link 37 | #INHERITED}. The current value of this string constant is 38 | null. */ 39 | public static final String NULL = "null"; 40 | 41 | /** 42 | Interpret a resource pointed by a URL and set up log4j accordingly. 43 | 44 | The configuration is done relative to the hierarchy 45 | parameter. 46 | 47 | @param url The URL to parse 48 | @param repository The hierarchy to operation upon. 49 | */ 50 | void doConfigure(URL url, LoggerRepository repository); 51 | } 52 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/spi/ErrorHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j.spi; 18 | 19 | /** 20 | * Created by IntelliJ IDEA. 21 | * User: ceki 22 | * Date: 19 oct. 2010 23 | * Time: 11:46:24 24 | * To change this template use File | Settings | File Templates. 25 | */ 26 | public class ErrorHandler { 27 | } 28 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/spi/Filter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j.spi; 18 | 19 | public class Filter { 20 | } 21 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/spi/HierarchyEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j.spi; 18 | 19 | import org.apache.log4j.*; 20 | 21 | /** 22 | Listen to events occurring within a {@link 23 | org.apache.log4j.Hierarchy Hierarchy}. 24 | 25 | @author Ceki Gülcü 26 | @since 1.2 27 | 28 | */ 29 | public interface HierarchyEventListener { 30 | 31 | // public 32 | // void categoryCreationEvent(Category cat); 33 | 34 | public void addAppenderEvent(Category cat, Appender appender); 35 | 36 | public void removeAppenderEvent(Category cat, Appender appender); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j.spi; 18 | 19 | import org.apache.log4j.Logger; 20 | 21 | /** 22 | 23 | Implement this interface to create new instances of Logger or 24 | a subclass of Logger. 25 | 26 |

See examples/subclass/MyLogger.java for an example. 27 | 28 | @author Ceki Gülcü 29 | @since version 0.8.5 30 | 31 | */ 32 | public interface LoggerFactory { 33 | 34 | public Logger makeNewLoggerInstance(String name); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/spi/LoggingEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j.spi; 18 | 19 | public class LoggingEvent { 20 | } 21 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/spi/OptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.log4j.spi; 17 | 18 | public interface OptionHandler { 19 | 20 | void activateOptions(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java/org/apache/log4j/xml/DOMConfigurator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2001-2004 The Apache Software Foundation. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.apache.log4j.xml; 18 | 19 | import org.apache.log4j.spi.Configurator; 20 | import org.apache.log4j.spi.LoggerRepository; 21 | 22 | import javax.xml.parsers.FactoryConfigurationError; 23 | import java.io.InputStream; 24 | import java.io.Reader; 25 | import java.net.URL; 26 | import java.util.Properties; 27 | 28 | import org.w3c.dom.Element; 29 | 30 | public class DOMConfigurator implements Configurator { 31 | 32 | public static void configure(Element element) { 33 | } 34 | 35 | public static void configure(String filename) throws FactoryConfigurationError { 36 | } 37 | 38 | static public void configure(URL url) throws FactoryConfigurationError { 39 | } 40 | 41 | static public void configureAndWatch(String configFilename) { 42 | } 43 | 44 | public static void configureAndWatch(String configFilename, long delay) { 45 | } 46 | 47 | public void doConfigure(Element element, LoggerRepository repository) { 48 | } 49 | 50 | public void doConfigure(InputStream inputStream, LoggerRepository repository) throws FactoryConfigurationError { 51 | } 52 | 53 | public void doConfigure(Reader reader, LoggerRepository repository) throws FactoryConfigurationError { 54 | } 55 | 56 | public void doConfigure(String filename, LoggerRepository repository) { 57 | } 58 | 59 | public void doConfigure(URL url, LoggerRepository repository) { 60 | } 61 | 62 | public static String subst(String value, Properties props) { 63 | return value; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/main/java9/module-info.java: -------------------------------------------------------------------------------- 1 | module log4j { 2 | requires org.slf4j; 3 | requires java.xml; 4 | exports org.apache.log4j; 5 | exports org.apache.log4j.helpers; 6 | exports org.apache.log4j.spi; 7 | exports org.apache.log4j.xml; 8 | } -------------------------------------------------------------------------------- /log4j-over-slf4j/src/test/java/org/apache/log4j/test/NDCTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.apache.log4j.test; 26 | 27 | import static org.junit.Assert.assertEquals; 28 | 29 | import org.junit.After; 30 | import org.junit.Before; 31 | import org.junit.Test; 32 | 33 | import org.apache.log4j.NDC; 34 | 35 | /** 36 | * @author Ceki Gülcü 37 | */ 38 | public class NDCTest { 39 | 40 | @Before 41 | public void setUp() { 42 | assertEquals(0, NDC.getDepth()); 43 | } 44 | 45 | @After 46 | public void tearDown() { 47 | NDC.clear(); 48 | } 49 | 50 | @Test 51 | public void testSmoke() { 52 | NDC.push("a"); 53 | String back = NDC.pop(); 54 | assertEquals("a", back); 55 | } 56 | 57 | @Test 58 | public void testPop() { 59 | NDC.push("peek"); 60 | String back = NDC.peek(); 61 | assertEquals("peek", back); 62 | } 63 | 64 | @Test 65 | public void testClear() { 66 | NDC.push("clear"); 67 | NDC.clear(); 68 | assertEquals(0, NDC.getDepth()); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/test/java/org/apache/log4j/test/Trivial.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.apache.log4j.test; 26 | 27 | import org.apache.log4j.Logger; 28 | 29 | import junit.framework.TestCase; 30 | 31 | public class Trivial extends TestCase { 32 | 33 | public void testSmoke() { 34 | Logger l = Logger.getLogger("a"); 35 | l.trace("t"); 36 | l.debug("d"); 37 | l.info("i"); 38 | l.warn("w"); 39 | l.error("e"); 40 | l.fatal("f"); 41 | 42 | Exception e = new Exception("testing"); 43 | l.trace("t", e); 44 | l.debug("d", e); 45 | l.info("i", e); 46 | l.warn("w", e); 47 | l.error("e", e); 48 | l.fatal("f", e); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /log4j-over-slf4j/src/test/java/org/dummy/ListHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.dummy; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | import java.util.logging.Handler; 30 | import java.util.logging.LogRecord; 31 | 32 | public class ListHandler extends Handler { 33 | 34 | List list = new ArrayList<>(); 35 | 36 | public void close() throws SecurityException { 37 | 38 | } 39 | 40 | public void flush() { 41 | 42 | } 43 | 44 | public void publish(LogRecord logRecord) { 45 | logRecord.getSourceClassName(); 46 | list.add(logRecord); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /osgi-over-slf4j/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland) 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /osgi-over-slf4j/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.slf4j 9 | slf4j-parent 10 | 2.0.18-SNAPSHOT 11 | ../parent/pom.xml 12 | 13 | 14 | osgi-over-slf4j 15 | 16 | jar 17 | OSGi LogService implemented over SLF4J 18 | 19 | http://www.slf4j.org 20 | 21 | OSGi LogService implementation over SLF4J 22 | 23 | 24 | 25 | 26 | org.osgi 27 | org.osgi.core 28 | 4.2.0 29 | provided 30 | 31 | 32 | org.osgi 33 | org.osgi.enterprise 34 | 4.2.0 35 | provided 36 | 37 | 38 | 39 | org.slf4j 40 | slf4j-simple 41 | provided 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | org.apache.felix 50 | maven-bundle-plugin 51 | 52 | 53 | org.slf4j.osgi-over-slf4j 54 | org.slf4j.osgi.logservice.impl.Activator 55 | osgi 56 | <_exportcontents combine.self="override" /> 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | 2 | # Javadoc 3 | 4 | #JDK8 - mvn site:site 5 | #rscpSLF4J apidocs/ 6 | 7 | # JDK 11+ 8 | # adding the following 9 | #mvn -Ddoclint=none -Dadditionalparam=-Xdoclint:none javadoc:aggregate 10 | 11 | 12 | #mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION_NUMBER} 13 | 14 | MVN='/java/maven-3.5.2//bin/mvn' 15 | 16 | function checkExit(){ 17 | if test "$?" != "0"; then 18 | echo Command $1 exited with abnormal status 19 | exit 1; 20 | else echo $? 21 | fi 22 | } 23 | 24 | function echoRunAndCheck () { # echo and then run the command 25 | echo $1 26 | $1 27 | ret=$? 28 | if test "$ret" != "0"; 29 | then 30 | echo Failed command: $1 31 | exit 1; 32 | else echo Successful run: $1 33 | fi 34 | } 35 | 36 | echoRunAndCheck "$MVN clean" 37 | 38 | echoRunAndCheck "$MVN install" 39 | 40 | #echoRunAndCheck "$MVN site:site" 41 | 42 | #echoRunAndCheck "$MVN javadoc:aggregate" 43 | 44 | #echoRunAndCheck "$MVN jxr:aggregate" 45 | 46 | 47 | if [ ! -z "$PASS" ] 48 | then 49 | # WARNING deploying without cleaning may leave stale MANIFEST files 50 | export GPG_TTY=$(tty) 51 | echoRunAndCheck "$MVN deploy -P javadocjar,sign-artifacts" 52 | fi 53 | 54 | 55 | git tag -m "tagging" -a v_${VERSION_NUMBER} 56 | git push --tags 57 | 58 | #Update release version and add next version on jira 59 | 60 | 61 | 62 | echo Full Success 63 | -------------------------------------------------------------------------------- /slf4j-api/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2023 QOS.ch 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/LoggerFactoryFriend.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2021 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j; 26 | 27 | /** 28 | * All methods in this class are reserved for internal use, for testing purposes. 29 | * 30 | *

They can be modified, renamed or removed at any time without notice. 31 | * 32 | *

You are strongly discouraged calling any of the methods of this class. 33 | * 34 | * @since 1.8.0 35 | * 36 | * @author Ceki Gülcü 37 | */ 38 | public class LoggerFactoryFriend { 39 | 40 | /* 41 | * Force LoggerFactory to consider itself uninitialized. 42 | */ 43 | static public void reset() { 44 | LoggerFactory.reset(); 45 | } 46 | 47 | /** 48 | * Set LoggerFactory.DETECT_LOGGER_NAME_MISMATCH variable. 49 | * 50 | * @param enabled a boolean 51 | */ 52 | public static void setDetectLoggerNameMismatch(boolean enabled) { 53 | LoggerFactory.DETECT_LOGGER_NAME_MISMATCH = enabled; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/event/EventConstants.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.event; 2 | 3 | import org.slf4j.spi.LocationAwareLogger; 4 | 5 | public class EventConstants { 6 | public static final int ERROR_INT = LocationAwareLogger.ERROR_INT; 7 | public static final int WARN_INT = LocationAwareLogger.WARN_INT; 8 | public static final int INFO_INT = LocationAwareLogger.INFO_INT; 9 | public static final int DEBUG_INT = LocationAwareLogger.DEBUG_INT; 10 | public static final int TRACE_INT = LocationAwareLogger.TRACE_INT; 11 | public static final String NA_SUBST = "NA/SubstituteLogger"; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/event/KeyValuePair.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.event; 2 | 3 | import java.util.Objects; 4 | 5 | public class KeyValuePair { 6 | 7 | public final String key; 8 | public final Object value; 9 | 10 | public KeyValuePair(String key, Object value) { 11 | this.key = key; 12 | this.value = value; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return String.valueOf(key) + "=\"" + String.valueOf(value) +"\""; 18 | } 19 | 20 | @Override 21 | public boolean equals(Object o) { 22 | if(this == o) return true; 23 | if(o == null || getClass() != o.getClass()) return false; 24 | KeyValuePair that = (KeyValuePair) o; 25 | return Objects.equals(key, that.key) && Objects.equals(value, that.value); 26 | } 27 | 28 | @Override 29 | public int hashCode() { 30 | return Objects.hash(key, value); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/event/Level.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.event; 2 | 3 | import static org.slf4j.event.EventConstants.DEBUG_INT; 4 | import static org.slf4j.event.EventConstants.ERROR_INT; 5 | import static org.slf4j.event.EventConstants.INFO_INT; 6 | import static org.slf4j.event.EventConstants.TRACE_INT; 7 | import static org.slf4j.event.EventConstants.WARN_INT; 8 | 9 | /** 10 | * SLF4J's internal representation of Level. 11 | * 12 | * 13 | * @author Ceki Gülcü 14 | * @since 1.7.15 15 | */ 16 | public enum Level { 17 | 18 | ERROR(ERROR_INT, "ERROR"), WARN(WARN_INT, "WARN"), INFO(INFO_INT, "INFO"), DEBUG(DEBUG_INT, "DEBUG"), TRACE(TRACE_INT, "TRACE"); 19 | 20 | private final int levelInt; 21 | private final String levelStr; 22 | 23 | Level(int i, String s) { 24 | levelInt = i; 25 | levelStr = s; 26 | } 27 | 28 | public int toInt() { 29 | return levelInt; 30 | } 31 | 32 | public static Level intToLevel(int levelInt) { 33 | switch (levelInt) { 34 | case (TRACE_INT): 35 | return TRACE; 36 | case (DEBUG_INT): 37 | return DEBUG; 38 | case (INFO_INT): 39 | return INFO; 40 | case (WARN_INT): 41 | return WARN; 42 | case (ERROR_INT): 43 | return ERROR; 44 | default: 45 | throw new IllegalArgumentException("Level integer [" + levelInt + "] not recognized."); 46 | } 47 | } 48 | 49 | /** 50 | * Returns the string representation of this Level. 51 | */ 52 | public String toString() { 53 | return levelStr; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/event/LoggingEvent.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.event; 2 | 3 | import java.util.List; 4 | 5 | import org.slf4j.Marker; 6 | 7 | /** 8 | * The minimal interface sufficient for the restitution of data passed 9 | * by the user to the SLF4J API. 10 | * 11 | * @author Ceki Gülcü 12 | * @since 1.7.15 13 | */ 14 | public interface LoggingEvent { 15 | 16 | Level getLevel(); 17 | 18 | String getLoggerName(); 19 | 20 | String getMessage(); 21 | 22 | List getArguments(); 23 | 24 | Object[] getArgumentArray(); 25 | 26 | /** 27 | * List of markers in the event, might be null. 28 | * @return markers in the event, might be null. 29 | */ 30 | List getMarkers(); 31 | 32 | List getKeyValuePairs(); 33 | 34 | Throwable getThrowable(); 35 | 36 | long getTimeStamp(); 37 | 38 | String getThreadName(); 39 | 40 | /** 41 | * Returns the presumed caller boundary provided by the logging library (not the user of the library). 42 | * Null by default. 43 | * 44 | * @return presumed caller, null by default. 45 | */ 46 | default String getCallerBoundary() { 47 | return null; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/helpers/CheckReturnValue.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.helpers; 2 | 3 | 4 | import org.slf4j.Marker; 5 | 6 | import java.lang.annotation.*; 7 | 8 | /** 9 | *

Used to annotate methods in the {@link org.slf4j.spi.LoggingEventBuilder} interface 10 | * which return an instance of LoggingEventBuilder (usually as this). Such 11 | * methods should be followed by one of the terminating log() methods returning 12 | * void.

13 | *

14 | *

IntelliJ IDEA supports a check for annotations named as CheckReturnValue 15 | * regardless of the containing package. For more information on this feature in IntelliJ IDEA, 16 | * select File → Setting → Editor → Inspections and then Java → Probable Bugs → 17 | * Result of method call ignored.

18 | *

19 | * 20 | *

As for Eclipse, this feature has been requested in 21 | * bug 572496

22 | * 23 | * @author Ceki Gülcü 24 | * @since 2.0.0-beta1 25 | */ 26 | @Documented 27 | @Target( { ElementType.METHOD }) 28 | @Retention(RetentionPolicy.RUNTIME) 29 | public @interface CheckReturnValue { 30 | } 31 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/helpers/FormattingTuple.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.helpers; 26 | 27 | /** 28 | * Holds the results of formatting done by {@link MessageFormatter}. 29 | * 30 | * @author Joern Huxhorn 31 | */ 32 | public class FormattingTuple { 33 | 34 | static public FormattingTuple NULL = new FormattingTuple(null); 35 | 36 | private final String message; 37 | private final Throwable throwable; 38 | private final Object[] argArray; 39 | 40 | public FormattingTuple(String message) { 41 | this(message, null, null); 42 | } 43 | 44 | public FormattingTuple(String message, Object[] argArray, Throwable throwable) { 45 | this.message = message; 46 | this.throwable = throwable; 47 | this.argArray = argArray; 48 | } 49 | 50 | public String getMessage() { 51 | return message; 52 | } 53 | 54 | public Object[] getArgArray() { 55 | return argArray; 56 | } 57 | 58 | public Throwable getThrowable() { 59 | return throwable; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/helpers/LegacyAbstractLogger.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.helpers; 2 | 3 | import org.slf4j.Marker; 4 | 5 | /** 6 | * Provides minimal default implementations for {@link #isTraceEnabled(Marker)}, {@link #isDebugEnabled(Marker)} and other similar methods. 7 | * 8 | * @since 2.0 9 | */ 10 | abstract public class LegacyAbstractLogger extends AbstractLogger { 11 | 12 | private static final long serialVersionUID = -7041884104854048950L; 13 | 14 | @Override 15 | public boolean isTraceEnabled(Marker marker) { 16 | return isTraceEnabled(); 17 | } 18 | 19 | @Override 20 | public boolean isDebugEnabled(Marker marker) { 21 | return isDebugEnabled(); 22 | } 23 | 24 | @Override 25 | public boolean isInfoEnabled(Marker marker) { 26 | return isInfoEnabled(); 27 | } 28 | 29 | @Override 30 | public boolean isWarnEnabled(Marker marker) { 31 | return isWarnEnabled(); 32 | } 33 | 34 | @Override 35 | public boolean isErrorEnabled(Marker marker) { 36 | return isErrorEnabled(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/helpers/NOPLoggerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.helpers; 26 | 27 | import org.slf4j.ILoggerFactory; 28 | import org.slf4j.Logger; 29 | 30 | /** 31 | * NOPLoggerFactory is a trivial implementation of {@link 32 | * ILoggerFactory} which always returns the unique instance of 33 | * NOPLogger. 34 | * 35 | * @author Ceki Gülcü 36 | */ 37 | public class NOPLoggerFactory implements ILoggerFactory { 38 | 39 | public NOPLoggerFactory() { 40 | // nothing to do 41 | } 42 | 43 | public Logger getLogger(String name) { 44 | return NOPLogger.NOP_LOGGER; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/helpers/NOP_FallbackServiceProvider.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.helpers; 2 | 3 | import org.slf4j.ILoggerFactory; 4 | import org.slf4j.IMarkerFactory; 5 | import org.slf4j.spi.MDCAdapter; 6 | import org.slf4j.spi.SLF4JServiceProvider; 7 | 8 | public class NOP_FallbackServiceProvider implements SLF4JServiceProvider { 9 | 10 | /** 11 | * Declare the version of the SLF4J API this implementation is compiled 12 | * against. The value of this field is modified with each major release. 13 | */ 14 | // to avoid constant folding by the compiler, this field must *not* be final 15 | public static String REQUESTED_API_VERSION = "2.0.99"; // !final 16 | 17 | private final ILoggerFactory loggerFactory = new NOPLoggerFactory(); 18 | private final IMarkerFactory markerFactory = new BasicMarkerFactory(); 19 | private final MDCAdapter mdcAdapter = new NOPMDCAdapter(); 20 | 21 | 22 | @Override 23 | public ILoggerFactory getLoggerFactory() { 24 | return loggerFactory; 25 | } 26 | 27 | @Override 28 | public IMarkerFactory getMarkerFactory() { 29 | return markerFactory; 30 | } 31 | 32 | 33 | @Override 34 | public MDCAdapter getMDCAdapter() { 35 | return mdcAdapter; 36 | } 37 | 38 | @Override 39 | public String getRequestedApiVersion() { 40 | return REQUESTED_API_VERSION; 41 | } 42 | 43 | @Override 44 | public void initialize() { 45 | // already initialized 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/helpers/SubstituteServiceProvider.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.helpers; 2 | 3 | import org.slf4j.ILoggerFactory; 4 | import org.slf4j.IMarkerFactory; 5 | import org.slf4j.spi.MDCAdapter; 6 | import org.slf4j.spi.SLF4JServiceProvider; 7 | 8 | public class SubstituteServiceProvider implements SLF4JServiceProvider { 9 | private final SubstituteLoggerFactory loggerFactory = new SubstituteLoggerFactory(); 10 | 11 | // LoggerFactory expects providers to initialize markerFactory as early as possible. 12 | private final IMarkerFactory markerFactory; 13 | 14 | // LoggerFactory expects providers to initialize their MDCAdapter field 15 | // as early as possible, preferably at construction time. 16 | private final MDCAdapter mdcAdapter; 17 | 18 | public SubstituteServiceProvider() { 19 | markerFactory = new BasicMarkerFactory(); 20 | mdcAdapter = new BasicMDCAdapter(); 21 | } 22 | 23 | @Override 24 | public ILoggerFactory getLoggerFactory() { 25 | return loggerFactory; 26 | } 27 | 28 | public SubstituteLoggerFactory getSubstituteLoggerFactory() { 29 | return loggerFactory; 30 | } 31 | 32 | @Override 33 | public IMarkerFactory getMarkerFactory() { 34 | return markerFactory; 35 | } 36 | 37 | @Override 38 | public MDCAdapter getMDCAdapter() { 39 | return mdcAdapter; 40 | } 41 | 42 | @Override 43 | public String getRequestedApiVersion() { 44 | throw new UnsupportedOperationException(); 45 | } 46 | 47 | @Override 48 | public void initialize() { 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/helpers/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Helper classes.

13 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Core logging interfaces.

13 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/spi/CallerBoundaryAware.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.spi; 2 | 3 | import org.slf4j.event.LoggingEvent; 4 | 5 | /** 6 | * Additional interface to {@link LoggingEventBuilder} and 7 | * {@link org.slf4j.event.LoggingEvent LoggingEvent}. 8 | * 9 | * Implementations of {@link LoggingEventBuilder} and {@link LoggingEvent} may optionally 10 | * implement {@link CallerBoundaryAware} in order to support caller info extraction. 11 | * 12 | * This interface is intended for use by logging backends or logging bridges. 13 | * 14 | * @author Ceki Gulcu 15 | * 16 | */ 17 | public interface CallerBoundaryAware { 18 | 19 | /** 20 | * Add a fqcn (fully qualified class name) to this event, presumed to be the caller boundary. 21 | * 22 | * @param fqcn 23 | */ 24 | void setCallerBoundary(String fqcn); 25 | } 26 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/spi/LoggingEventAware.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.spi; 2 | 3 | import org.slf4j.event.LoggingEvent; 4 | 5 | /** 6 | * A logger capable of logging from org.slf4j.event.LoggingEvent implements this interface. 7 | * 8 | *

Please note that when the {@link #log(LoggingEvent)} method assumes that 9 | * the event was filtered beforehand and no further filtering needs to occur by the method itself. 10 | *

11 | * 12 | *

Implementations of this interface may apply further filtering but they are not 13 | * required to do so. In other words, {@link #log(LoggingEvent)} method is free to assume that 14 | * the event was filtered beforehand and no further filtering needs to occur in the method itself.

15 | * 16 | * See also https://jira.qos.ch/browse/SLF4J-575 17 | * 18 | * @author Ceki Gulcu 19 | * @since 2.0.0 20 | */ 21 | public interface LoggingEventAware { 22 | void log(LoggingEvent event); 23 | } 24 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/spi/SLF4JServiceProvider.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.spi; 2 | 3 | import org.slf4j.ILoggerFactory; 4 | import org.slf4j.IMarkerFactory; 5 | import org.slf4j.LoggerFactory; 6 | import org.slf4j.MDC; 7 | 8 | /** 9 | * This interface based on {@link java.util.ServiceLoader} paradigm. 10 | * 11 | *

It replaces the old static-binding mechanism used in SLF4J versions 1.0.x to 1.7.x. 12 | * 13 | * @author Ceki G¨lc¨ 14 | * @since 1.8 15 | */ 16 | public interface SLF4JServiceProvider { 17 | 18 | /** 19 | * Return the instance of {@link ILoggerFactory} that 20 | * {@link org.slf4j.LoggerFactory} class should bind to. 21 | * 22 | * @return instance of {@link ILoggerFactory} 23 | */ 24 | public ILoggerFactory getLoggerFactory(); 25 | 26 | /** 27 | * Return the instance of {@link IMarkerFactory} that 28 | * {@link org.slf4j.MarkerFactory} class should bind to. 29 | * 30 | * @return instance of {@link IMarkerFactory} 31 | */ 32 | public IMarkerFactory getMarkerFactory(); 33 | 34 | /** 35 | * Return the instance of {@link MDCAdapter} that 36 | * {@link MDC} should bind to. 37 | * 38 | * @return instance of {@link MDCAdapter} 39 | */ 40 | public MDCAdapter getMDCAdapter(); 41 | 42 | /** 43 | * Return the maximum API version for SLF4J that the logging 44 | * implementation supports. 45 | * 46 | *

For example: {@code "2.0.1"}. 47 | * 48 | * @return the string API version. 49 | */ 50 | public String getRequestedApiVersion(); 51 | 52 | /** 53 | * Initialize the logging back-end. 54 | * 55 | *

WARNING: This method is intended to be called once by 56 | * {@link LoggerFactory} class and from nowhere else. 57 | * 58 | */ 59 | public void initialize(); 60 | } 61 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java/org/slf4j/spi/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Classes and interfaces which are internal to SLF4J. Under most 6 | circumstances SLF4J users should be oblivious even to the existence of 7 | this package. 8 | -------------------------------------------------------------------------------- /slf4j-api/src/main/java9/module-info.java: -------------------------------------------------------------------------------- 1 | module org.slf4j { 2 | exports org.slf4j; 3 | exports org.slf4j.spi; 4 | exports org.slf4j.event; 5 | exports org.slf4j.helpers; 6 | uses org.slf4j.spi.SLF4JServiceProvider; 7 | requires java.base; 8 | } 9 | -------------------------------------------------------------------------------- /slf4j-api/src/test/java/org/slf4j/basicTests/Differentiator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | package org.slf4j.basicTests; 27 | 28 | import java.util.Random; 29 | 30 | public class Differentiator { 31 | 32 | static Random random = new Random(System.currentTimeMillis()); 33 | 34 | static public short getDiffentiator() { 35 | return (short) random.nextInt(Short.MAX_VALUE); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /slf4j-api/src/test/java/org/slf4j/basicTests/FluentAPIUsage.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.basicTests; 2 | 3 | import static org.junit.Assert.assertFalse; 4 | 5 | import org.junit.Test; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.slf4j.event.Level; 9 | 10 | public class FluentAPIUsage { 11 | 12 | @Test 13 | public void smoke() { 14 | String name = "smoke"; 15 | Logger logger = LoggerFactory.getLogger(name); 16 | logger.atTrace().addKeyValue("a", "n").setCause(new Throwable()).log("hello"); 17 | } 18 | 19 | 20 | @Test 21 | public void smokxce() { 22 | String name = "smoke"; 23 | Logger logger = LoggerFactory.getLogger(name); 24 | assertFalse(logger.isEnabledForLevel(Level.DEBUG)); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /slf4j-api/src/test/java/org/slf4j/basicTests/NoBindingMultithreadedInitializationTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2016 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.basicTests; 26 | 27 | import org.junit.After; 28 | import org.junit.Before; 29 | import org.slf4j.LoggerFactoryFriend; 30 | import org.slf4j.testHarness.MultithreadedInitializationTest; 31 | 32 | /** 33 | * Checks that when no binding is present, proper clean up is performed by LoggerFactory. 34 | * 35 | * See SLF4J-469 36 | * 37 | * @author David Harsha 38 | */ 39 | public class NoBindingMultithreadedInitializationTest extends MultithreadedInitializationTest { 40 | final String loggerName = this.getClass().getName(); 41 | 42 | @Before 43 | public void setup() { 44 | LoggerFactoryFriend.reset(); 45 | } 46 | 47 | @After 48 | public void tearDown() throws Exception { 49 | LoggerFactoryFriend.reset(); 50 | } 51 | 52 | @Override 53 | protected long getRecordedEventCount() { 54 | return eventCount.get(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /slf4j-api/src/test/java/org/slf4j/helpers/BasicMDCAdapterTest.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.helpers; 2 | 3 | import static org.junit.Assert.assertFalse; 4 | import static org.junit.Assert.assertNull; 5 | 6 | import org.junit.Test; 7 | 8 | public class BasicMDCAdapterTest extends MDCAdapterTestBase { 9 | 10 | @Test 11 | public void testClearingMDC() { 12 | mdc.put("testKey", "testValue"); 13 | assertFalse(mdc.getCopyOfContextMap().isEmpty()); 14 | mdc.clear(); 15 | assertNull(mdc.getCopyOfContextMap()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /slf4j-api/src/test/java/org/slf4j/rule/BlaTest.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.rule; 2 | 3 | import static org.junit.Assert.fail; 4 | 5 | import org.junit.Ignore; 6 | import org.junit.Rule; 7 | import org.junit.Test; 8 | 9 | @Ignore // this test has intentional fails 10 | public class BlaTest { 11 | 12 | @Rule 13 | public RunInNewThreadRule runInThread = new RunInNewThreadRule(); 14 | 15 | @Test 16 | public void aTest() { 17 | System.out.println("running aTest in "+ Thread.currentThread().getName()); 18 | } 19 | 20 | @RunInNewThread 21 | @Test 22 | public void bTest() { 23 | System.out.println("running bTest in "+ Thread.currentThread().getName()); 24 | } 25 | 26 | @RunInNewThread(timeout = 2000L) 27 | @Test 28 | public void cTest() { 29 | System.out.println("running cTest in "+ Thread.currentThread().getName()); 30 | } 31 | @RunInNewThread() 32 | @Test 33 | public void dTest() { 34 | System.out.println("running dTest in "+ Thread.currentThread().getName()); 35 | fail(); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /slf4j-api/src/test/java/org/slf4j/rule/RunInNewThread.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | package org.slf4j.rule; 27 | 28 | import java.lang.annotation.ElementType; 29 | import java.lang.annotation.Retention; 30 | import java.lang.annotation.RetentionPolicy; 31 | import java.lang.annotation.Target; 32 | 33 | 34 | @Retention(RetentionPolicy.RUNTIME) 35 | @Target({ElementType.METHOD}) 36 | public @interface RunInNewThread { 37 | static final long DEFAULT_TIMEOUT = 1000L; 38 | public long timeout() default DEFAULT_TIMEOUT; 39 | } 40 | -------------------------------------------------------------------------------- /slf4j-ext/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland) 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-ext/src/main/java/org/slf4j/NDC.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j; 26 | 27 | public class NDC { 28 | public final static String PREFIX = "NDC"; 29 | 30 | private static int size() { 31 | int i = 0; 32 | while (true) { 33 | String val = MDC.get(PREFIX + i); 34 | if (val != null) { 35 | i++; 36 | } else { 37 | break; 38 | } 39 | } 40 | return i; 41 | } 42 | 43 | public static void push(String val) { 44 | int next = size(); 45 | MDC.put(PREFIX + next, val); 46 | } 47 | 48 | public static String pop() { 49 | int next = size(); 50 | if (next == 0) { 51 | return ""; 52 | } 53 | int last = next - 1; 54 | String key = PREFIX + last; 55 | String val = MDC.get(key); 56 | MDC.remove(key); 57 | return val; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /slf4j-ext/src/main/java/org/slf4j/agent/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

"-javaagent" routines for SLF4J.

11 |

The "-javaagent" flag provided in Java 5+ allows for writing 12 | agents in Java, which previously was possible in native code only. The 13 | full details are available at http://java.sun.com/javase/6/docs/api/java/lang/instrument/package-summary.html. 15 | 16 | 17 | Please notice that code made available to the java agent is also 18 | available to the actual program executed.

19 |

The slf4j-ext-X.Y.Z.jar file provides such a java agent, which is 20 | implemented in AgentPremain.java. It is used by adding a -javaagent flag to the Java command line: 21 | 22 | E.g. 23 |

java HelloWorld
24 | is changed to 25 |
java -javaagent:/path/to/slf4j-ext-X.Y.Z.jar=OPTIONS HelloWorld
26 | 27 |

What is actually done, depends on the OPTIONS passed to the agent. These are listed in AgentOptions.java. 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /slf4j-ext/src/main/java/org/slf4j/cal10n/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

SLF4J API extensions

11 | 12 | 13 | -------------------------------------------------------------------------------- /slf4j-ext/src/main/java/org/slf4j/ext/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Localized logging using the CAL10N API.

11 | 12 | 13 | -------------------------------------------------------------------------------- /slf4j-ext/src/main/java/org/slf4j/instrumentation/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Java instrumentation routines for SLF4J.

11 | 12 |

Byte code instrumentation is a way to change behaviour of java 13 | classes at load time. This is done in-between the original byte 14 | codes are retrieved and the class object is constructed by the class 15 | loader. Currently this depends on the javassist library from JBoss 16 | (which in turn uses it extensively in their application server).

17 | 18 | 19 | -------------------------------------------------------------------------------- /slf4j-ext/src/main/java/org/slf4j/profiler/DurationUnit.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.profiler; 26 | 27 | /** 28 | * An enum of supported time units. 29 | * 30 | * @author Ceki 31 | * 32 | */ 33 | public enum DurationUnit { 34 | NANOSECOND, MICROSECOND, MILLISSECOND, SECOND; 35 | } -------------------------------------------------------------------------------- /slf4j-ext/src/main/java/org/slf4j/profiler/TimeInstrumentStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | /** 27 | * A StopWatch can be in two states: STARTED or STOPPED. 28 | */ 29 | 30 | package org.slf4j.profiler; 31 | 32 | /** 33 | * A time instrument can be in STARTED or STOPPED status. 34 | * 35 | * @author Ceki Gülcü 36 | * 37 | */ 38 | enum TimeInstrumentStatus { 39 | STARTED, STOPPED; 40 | } -------------------------------------------------------------------------------- /slf4j-ext/src/main/java/org/slf4j/profiler/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Poor man's profiler API

12 | 13 | 14 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/NDCTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j; 26 | 27 | import static org.junit.Assert.assertEquals; 28 | 29 | import org.junit.Before; 30 | import org.junit.Test; 31 | 32 | public class NDCTest { 33 | 34 | @Before 35 | public void setUp() throws Exception { 36 | MDC.clear(); 37 | } 38 | 39 | @Test 40 | public void testEmpty() { 41 | assertEquals("", NDC.pop()); 42 | } 43 | 44 | @Test 45 | public void testSmoke() { 46 | NDC.push("a"); 47 | String result = NDC.pop(); 48 | assertEquals("a", result); 49 | } 50 | 51 | @Test 52 | public void testSmoke2() { 53 | NDC.push("a"); 54 | NDC.push("b"); 55 | String result1 = NDC.pop(); 56 | String result0 = NDC.pop(); 57 | assertEquals("b", result1); 58 | assertEquals("a", result0); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/cal10n_dummy/Months.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.cal10n_dummy; 26 | 27 | import ch.qos.cal10n.BaseName; 28 | import ch.qos.cal10n.Locale; 29 | import ch.qos.cal10n.LocaleData; 30 | 31 | @BaseName("months") 32 | @LocaleData(@Locale("en")) 33 | public enum Months { 34 | JAN, FEB, MAR, APR, MAY, JUN; 35 | } 36 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/cal10n_dummy/MyApplication.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.cal10n_dummy; 26 | 27 | import java.util.Locale; 28 | 29 | import org.slf4j.cal10n.LocLogger; 30 | import org.slf4j.cal10n.LocLoggerFactory; 31 | 32 | import ch.qos.cal10n.IMessageConveyor; 33 | import ch.qos.cal10n.MessageConveyor; 34 | 35 | public class MyApplication { 36 | 37 | // create a message conveyor for a given locale 38 | IMessageConveyor messageConveyor = new MessageConveyor(Locale.JAPAN); 39 | 40 | // create the LogLoggerFactory 41 | LocLoggerFactory llFactory_uk = new LocLoggerFactory(messageConveyor); 42 | 43 | // create a locLogger 44 | LocLogger locLogger = llFactory_uk.getLocLogger(this.getClass()); 45 | 46 | public void applicationStart() { 47 | locLogger.info(Production.APPLICATION_STARTED); 48 | // .. 49 | } 50 | 51 | public void applicationStop() { 52 | locLogger.info(Production.APPLICATION_STOPPED); 53 | // ... 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/cal10n_dummy/PackageTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.cal10n_dummy; 26 | 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.Suite; 29 | import org.junit.runners.Suite.SuiteClasses; 30 | 31 | @RunWith(Suite.class) 32 | @SuiteClasses({ LocLoggerTest.class }) 33 | public class PackageTest { 34 | } 35 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/cal10n_dummy/Production.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.cal10n_dummy; 26 | 27 | import ch.qos.cal10n.LocaleData; 28 | import ch.qos.cal10n.Locale; 29 | import ch.qos.cal10n.BaseName; 30 | 31 | @BaseName("production") 32 | @LocaleData({ @Locale("en_UK"), @Locale("fr") }) 33 | public enum Production { 34 | APPLICATION_STARTED, APPLICATION_STOPPED, DB_CONNECTION, DB_CONNECTION_FAILURE; 35 | } -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/dummyExt/ListAppender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.dummyExt; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | import org.apache.log4j.AppenderSkeleton; 31 | import org.apache.log4j.spi.LoggingEvent; 32 | 33 | public class ListAppender extends AppenderSkeleton { 34 | 35 | public final List list = new ArrayList<>(); 36 | 37 | public boolean extractLocationInfo = false; 38 | 39 | protected void append(LoggingEvent event) { 40 | list.add(event); 41 | if (extractLocationInfo) { 42 | event.getLocationInformation(); 43 | } 44 | } 45 | 46 | public void close() { 47 | } 48 | 49 | public boolean requiresLayout() { 50 | return false; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/dummyExt/PackageTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.dummyExt; 26 | 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.Suite; 29 | import org.junit.runners.Suite.SuiteClasses; 30 | 31 | @RunWith(Suite.class) 32 | @SuiteClasses({ XLoggerTest.class }) 33 | public class PackageTest { 34 | } 35 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/dummyExt/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tests related to the org.slf4j.ext package. However, location information code 4 | required the caller class (XLogger) to have a different prefix than 5 | the test class XLoggerTest. This is ensured by having the test class 6 | placed in a different package. 7 | 8 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/profiler/PackageTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.profiler; 26 | 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.Suite; 29 | import org.junit.runners.Suite.SuiteClasses; 30 | 31 | @RunWith(Suite.class) 32 | @SuiteClasses({ UtilTest.class, ProfilerTest.class }) 33 | public class PackageTest { 34 | 35 | } -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/profiler/RandomIntegerArrayGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.profiler; 26 | 27 | import java.util.Random; 28 | 29 | public class RandomIntegerArrayGenerator { 30 | Random rand = new Random(11); 31 | 32 | int[] generate(int size) { 33 | int[] result = new int[size]; 34 | for (int i = 0; i < size; i++) { 35 | int r = rand.nextInt(); 36 | result[i] = r; 37 | } 38 | return result; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/java/org/slf4j/profiler/UtilTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.profiler; 26 | 27 | import static org.junit.Assert.assertEquals; 28 | 29 | import org.junit.Test; 30 | 31 | public class UtilTest { 32 | 33 | @Test 34 | public void testSelectDurationUnitForDisplay() throws InterruptedException { 35 | assertEquals(DurationUnit.NANOSECOND, Util.selectDurationUnitForDisplay(10)); 36 | assertEquals(DurationUnit.NANOSECOND, Util.selectDurationUnitForDisplay(9 * Util.NANOS_IN_ONE_MICROSECOND)); 37 | assertEquals(DurationUnit.MICROSECOND, Util.selectDurationUnitForDisplay(11 * Util.NANOS_IN_ONE_MICROSECOND)); 38 | assertEquals(DurationUnit.MICROSECOND, Util.selectDurationUnitForDisplay(9 * Util.NANOS_IN_ONE_MILLISECOND)); 39 | assertEquals(DurationUnit.MILLISSECOND, Util.selectDurationUnitForDisplay(11 * Util.NANOS_IN_ONE_MILLISECOND)); 40 | assertEquals(DurationUnit.SECOND, Util.selectDurationUnitForDisplay(11 * Util.NANOS_IN_ONE_SECOND)); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | 2 | log4j.rootLogger=DEBUG, CONSOLE 3 | 4 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 5 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 7 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/resources/months_en.properties: -------------------------------------------------------------------------------- 1 | JAN=January 2 | FEB=February 3 | MAR=March 4 | APR=April 5 | MAY=May 6 | JUN=June 7 | -------------------------------------------------------------------------------- /slf4j-ext/src/test/resources/production_en_UK.properties: -------------------------------------------------------------------------------- 1 | APPLICATION_STARTED=APPLICATION_STARTED 2 | APPLICATION_STOPPED=APPLICATION_STOPPED 3 | DB_CONNECTION=DB_CONNECTION 4 | DB_CONNECTION_FAILURE=DB_CONNECTION_FAILURE -------------------------------------------------------------------------------- /slf4j-ext/src/test/resources/production_fr.properties: -------------------------------------------------------------------------------- 1 | APPLICATION_STARTED=APPLICATION_STARTED 2 | APPLICATION_STOPPED=APPLICATION_STOPPED 3 | DB_CONNECTION=DB_CONNECTION 4 | DB_CONNECTION_FAILURE=DB_CONNECTION_FAILURE -------------------------------------------------------------------------------- /slf4j-jdk-platform-logging/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland) 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-jdk-platform-logging/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2021 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | module org.slf4j.jdk.platform.logging { 26 | requires org.slf4j; 27 | provides java.lang.System.LoggerFinder with org.slf4j.jdk.platform.logging.SLF4JSystemLoggerFinder; 28 | } 29 | -------------------------------------------------------------------------------- /slf4j-jdk-platform-logging/src/main/resources/META-INF/services/java.lang.System$LoggerFinder: -------------------------------------------------------------------------------- 1 | org.slf4j.jdk.platform.logging.SLF4JSystemLoggerFinder 2 | -------------------------------------------------------------------------------- /slf4j-jdk14/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2023 QOS.ch 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-jdk14/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.slf4j 9 | slf4j-parent 10 | 2.0.18-SNAPSHOT 11 | ../parent/pom.xml 12 | 13 | 14 | slf4j-jdk14 15 | jar 16 | SLF4J JDK14 Provider 17 | SLF4J JDK14 Provider 18 | http://www.slf4j.org 19 | 20 | 21 | org.slf4j.jul 22 | org.slf4j.jul.JULServiceProvider 23 | jul 24 | 25 | 26 | 27 | 28 | org.slf4j 29 | slf4j-api 30 | 31 | 32 | 33 | org.slf4j 34 | slf4j-api 35 | test-jar 36 | ${project.version} 37 | test 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /slf4j-jdk14/src/main/java/org/slf4j/jul/JULServiceProvider.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.jul; 2 | 3 | import org.slf4j.ILoggerFactory; 4 | import org.slf4j.IMarkerFactory; 5 | import org.slf4j.helpers.BasicMDCAdapter; 6 | import org.slf4j.helpers.BasicMarkerFactory; 7 | import org.slf4j.spi.MDCAdapter; 8 | import org.slf4j.spi.SLF4JServiceProvider; 9 | 10 | public class JULServiceProvider implements SLF4JServiceProvider { 11 | 12 | /** 13 | * Declare the version of the SLF4J API this implementation is compiled 14 | * against. The value of this field is modified with each major release. 15 | */ 16 | // to avoid constant folding by the compiler, this field must *not* be final 17 | public static String REQUESTED_API_VERSION = "2.0.99"; // !final 18 | 19 | private ILoggerFactory loggerFactory; 20 | // LoggerFactory expects providers to initialize markerFactory as early as possible. 21 | private final IMarkerFactory markerFactory; 22 | // LoggerFactory expects providers to initialize their MDCAdapter field 23 | // as early as possible, preferably at construction time. 24 | private final MDCAdapter mdcAdapter; 25 | 26 | public JULServiceProvider() { 27 | markerFactory = new BasicMarkerFactory(); 28 | mdcAdapter = new BasicMDCAdapter(); 29 | } 30 | 31 | @Override 32 | public ILoggerFactory getLoggerFactory() { 33 | return loggerFactory; 34 | } 35 | 36 | @Override 37 | public IMarkerFactory getMarkerFactory() { 38 | return markerFactory; 39 | } 40 | 41 | public MDCAdapter getMDCAdapter() { 42 | return mdcAdapter; 43 | } 44 | 45 | @Override 46 | public String getRequestedApiVersion() { 47 | return REQUESTED_API_VERSION; 48 | } 49 | 50 | @Override 51 | public void initialize() { 52 | loggerFactory = new JDK14LoggerFactory(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /slf4j-jdk14/src/main/java9/module-info.java: -------------------------------------------------------------------------------- 1 | module org.slf4j.jul { 2 | requires org.slf4j; 3 | requires java.logging; 4 | provides org.slf4j.spi.SLF4JServiceProvider with org.slf4j.jul.JULServiceProvider; 5 | 6 | exports org.slf4j.jul; 7 | opens org.slf4j.jul to org.slf4j; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /slf4j-jdk14/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider: -------------------------------------------------------------------------------- 1 | org.slf4j.jul.JULServiceProvider -------------------------------------------------------------------------------- /slf4j-jdk14/src/test/java/org/slf4j/jul/CountingHandler.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.jul; 2 | 3 | import java.util.concurrent.atomic.AtomicLong; 4 | import java.util.logging.Handler; 5 | import java.util.logging.LogRecord; 6 | 7 | public class CountingHandler extends Handler { 8 | 9 | final AtomicLong eventCount = new AtomicLong(0); 10 | 11 | @Override 12 | public void publish(LogRecord record) { 13 | eventCount.getAndIncrement(); 14 | } 15 | 16 | @Override 17 | public void flush() { 18 | } 19 | 20 | @Override 21 | public void close() throws SecurityException { 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /slf4j-jdk14/src/test/java/org/slf4j/jul/ListHandler.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.jul; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.logging.LogRecord; 6 | 7 | public class ListHandler extends java.util.logging.Handler { 8 | 9 | public List recordList = new ArrayList<>(); 10 | 11 | @Override 12 | public void publish(LogRecord record) { 13 | recordList.add(record); 14 | } 15 | 16 | @Override 17 | public void flush() { 18 | } 19 | 20 | @Override 21 | public void close() throws SecurityException { 22 | } 23 | } -------------------------------------------------------------------------------- /slf4j-log4j12/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2023 QOS.ch 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-log4j12/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 4.0.0 7 | 8 | 9 | org.slf4j 10 | slf4j-parent 11 | 2.0.18-SNAPSHOT 12 | ../parent/pom.xml 13 | 14 | 15 | slf4j-log4j12 16 | pom 17 | 18 | SLF4J LOG4J-12 Binding relocated 19 | SLF4J LOG4J-12 relocated to slf4j-reload4j 20 | http://www.slf4j.org 21 | 22 | 23 | 24 | 25 | org.slf4j 26 | slf4j-reload4j 27 | 2.0.17 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /slf4j-migrator/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland) 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-migrator/LIMITATIONS.txt: -------------------------------------------------------------------------------- 1 | 2 | The slf4j-migrator aims to 3 | 4 | General limitations 5 | =================== 6 | 7 | - the FATAL level is not supported. 8 | 9 | This is limitation is not deemed serious because there are usually 10 | very few log statements bearing the FATAL level. 11 | 12 | 13 | - if a method declares multiple loggers on the same line, the conversion will not be complete. Example: 14 | 15 | 16 | public void someMethod(Log l1, Log l2) { 17 | ... 18 | } 19 | 20 | will be converted as 21 | 22 | public void someMethod(Log l1, Logger l2) { 23 | ... 24 | } 25 | 26 | 27 | When migrating from log4j 28 | ========================= 29 | 30 | - Since NDC is not supported by SLF4J, the migrator cannot properly handle 31 | NDC statements. 32 | 33 | - Calls to PropertyConfigurator or DomConfigurator cannot be migrated since 34 | SLF4J the equivalents. 35 | -------------------------------------------------------------------------------- /slf4j-migrator/jcl/jclcontent.java: -------------------------------------------------------------------------------- 1 | /** 2 | *This is not a class, just a sample of some jcl source code to convert 3 | */ 4 | import org.apache.commons.logging.LogFactory; 5 | import org.apache.commons.logging.Log; 6 | 7 | 8 | Log l = LogFactory.getLog(MyClass.class); 9 | Log mylog=LogFactory.getLog(MyClass.class); 10 | Log mylog1 = LogFactory.getLog(MyClass.class); 11 | Log mylog2 = LogFactory.getLog(MyClass.class); 12 | 13 | Log log3=LogFactory.getFactory().getInstance(MyClass.class); 14 | Log mylog4 = LogFactory.getFactory().getInstance(MyClass.class); 15 | Log mylog5 = LogFactory.getLog(MyClass.class); 16 | 17 | Log myLog6; 18 | 19 | log7=LogFactory.getFactory().getInstance(MyClass.class); 20 | log8 =LogFactory.getFactory().getInstance(MyClass.class); 21 | myLog9 = LogFactory.getLog(MyClass.class); 22 | 23 | -------------------------------------------------------------------------------- /slf4j-migrator/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.slf4j 9 | slf4j-parent 10 | 2.0.18-SNAPSHOT 11 | ../parent/pom.xml 12 | 13 | 14 | slf4j-migrator 15 | 16 | jar 17 | SLF4J Migrator 18 | SLF4J Migrator 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-jar-plugin 26 | ${maven-jar-plugin.version} 27 | 28 | 29 | 30 | org.slf4j.migrator.Main 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /slf4j-migrator/src/main/java/org/slf4j/migrator/Constant.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator; 26 | 27 | public class Constant { 28 | 29 | public final static int JCL_TO_SLF4J = 0; 30 | public final static int LOG4J_TO_SLF4J = 1; 31 | public final static int JUL_TO_SLF4J = 2; 32 | public final static int NOP_TO_SLF4J = 3; 33 | 34 | public final static int NB_FILES_MAX = 1; 35 | 36 | } -------------------------------------------------------------------------------- /slf4j-migrator/src/main/java/org/slf4j/migrator/Main.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | package org.slf4j.migrator; 27 | 28 | import javax.swing.SwingUtilities; 29 | 30 | import org.slf4j.migrator.internal.MigratorFrame; 31 | 32 | /** 33 | * Main entry point to the migrator. 34 | * 35 | * @author Ceki Gülcü 36 | */ 37 | public class Main { 38 | 39 | public static void main(String[] args) { 40 | System.out.println("Starting SLF4J Migrator"); 41 | SwingUtilities.invokeLater(() -> { 42 | MigratorFrame inst = new MigratorFrame(); 43 | inst.setLocationRelativeTo(null); 44 | inst.setVisible(true); 45 | }); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /slf4j-migrator/src/main/java/org/slf4j/migrator/internal/ConversionTask.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.internal; 26 | 27 | import java.io.File; 28 | 29 | import org.slf4j.migrator.ProjectConverter; 30 | 31 | public class ConversionTask implements Runnable { 32 | 33 | final File folder; 34 | final MigratorFrame frame; 35 | final int conversionType; 36 | 37 | ConversionTask(File folder, MigratorFrame frame, int conversionType) { 38 | this.folder = folder; 39 | this.frame = frame; 40 | this.conversionType = conversionType; 41 | } 42 | 43 | public void run() { 44 | ProgressListener pl = new ProgressListenerImpl(folder, frame); 45 | pl.onMigrationBegin(); 46 | ProjectConverter converter = new ProjectConverter(conversionType, pl); 47 | converter.convertProject(folder); 48 | } 49 | 50 | public void launch() { 51 | Thread t = new Thread(this); 52 | t.setDaemon(true); 53 | t.start(); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /slf4j-migrator/src/main/java/org/slf4j/migrator/internal/ProgressListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.internal; 26 | 27 | import java.io.File; 28 | 29 | public interface ProgressListener { 30 | 31 | public void onMigrationBegin(); 32 | 33 | public void onDirectory(File file); 34 | 35 | public void onFileAddition(File file); 36 | 37 | public void onFileScanBegin(); 38 | 39 | public void onFileScan(File file); 40 | 41 | public void onInplaceConversion(File file); 42 | 43 | public void onDone(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /slf4j-migrator/src/main/java/org/slf4j/migrator/line/ConversionRule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.line; 26 | 27 | import java.util.regex.Matcher; 28 | import java.util.regex.Pattern; 29 | 30 | public interface ConversionRule { 31 | 32 | public Pattern getPattern(); 33 | 34 | /** 35 | * Given replacement rules, replace each capturing group in matcher's pattern 36 | * 37 | * @param matcher 38 | * @return String 39 | */ 40 | public String replace(Matcher matcher); 41 | 42 | /** 43 | * Returns a non-null value if there should be an additional line 44 | * following a match of this rule. In most cases this method 45 | * returns null. 46 | * 47 | * @return String 48 | */ 49 | public String getAdditionalLine(); 50 | 51 | } -------------------------------------------------------------------------------- /slf4j-migrator/src/main/java/org/slf4j/migrator/line/EmptyRuleSet.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.line; 26 | 27 | import java.util.ArrayList; 28 | import java.util.Iterator; 29 | import java.util.List; 30 | 31 | public class EmptyRuleSet implements RuleSet { 32 | 33 | List list = new ArrayList<>(); 34 | 35 | public Iterator iterator() { 36 | return list.iterator(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /slf4j-migrator/src/main/java/org/slf4j/migrator/line/RuleSet.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.line; 26 | 27 | import java.util.Iterator; 28 | 29 | public interface RuleSet { 30 | 31 | Iterator iterator(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /slf4j-migrator/src/test/java/org/slf4j/migrator/AllTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator; 26 | 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.Suite; 29 | import org.junit.runners.Suite.SuiteClasses; 30 | 31 | @RunWith(Suite.class) 32 | @SuiteClasses({ org.slf4j.migrator.PackageTest.class, org.slf4j.migrator.line.PackageTest.class, org.slf4j.migrator.helper.PackageTest.class }) 33 | public class AllTest { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /slf4j-migrator/src/test/java/org/slf4j/migrator/FileConverterTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator; 26 | 27 | import java.io.File; 28 | import java.io.IOException; 29 | 30 | import org.junit.Ignore; 31 | import org.junit.Test; 32 | import org.slf4j.migrator.internal.NopProgressListener; 33 | import org.slf4j.migrator.line.EmptyRuleSet; 34 | 35 | public class FileConverterTest { 36 | 37 | @Test 38 | @Ignore 39 | public void XtestNOP() throws IOException { 40 | InplaceFileConverter fc = new InplaceFileConverter(new EmptyRuleSet(), new NopProgressListener()); 41 | fc.convert(new File("c:/varargs.txt")); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /slf4j-migrator/src/test/java/org/slf4j/migrator/PackageTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator; 26 | 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.Suite; 29 | import org.junit.runners.Suite.SuiteClasses; 30 | 31 | @RunWith(Suite.class) 32 | @SuiteClasses({ AternativeApproach.class }) 33 | public class PackageTest { 34 | } 35 | -------------------------------------------------------------------------------- /slf4j-migrator/src/test/java/org/slf4j/migrator/ProjectConverterTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator; 26 | 27 | import java.io.File; 28 | 29 | import org.junit.Ignore; 30 | import org.junit.Test; 31 | import org.slf4j.migrator.internal.NopProgressListener; 32 | 33 | public class ProjectConverterTest { 34 | 35 | public void test() { 36 | } 37 | 38 | @Test 39 | @Ignore 40 | public void XtestBarracuda() { 41 | ProjectConverter pc = new ProjectConverter(Constant.LOG4J_TO_SLF4J, new NopProgressListener()); 42 | File projectFolder = new File("c:/home/ceki//Varia/Barracuda"); 43 | pc.convertProject(projectFolder); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /slf4j-migrator/src/test/java/org/slf4j/migrator/helper/PackageTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.helper; 26 | 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.Suite; 29 | import org.junit.runners.Suite.SuiteClasses; 30 | 31 | @RunWith(Suite.class) 32 | @SuiteClasses({ AbbreviatorTest.class }) 33 | public class PackageTest { 34 | } 35 | -------------------------------------------------------------------------------- /slf4j-migrator/src/test/java/org/slf4j/migrator/internal/NopProgressListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.internal; 26 | 27 | import java.io.File; 28 | 29 | import org.slf4j.migrator.internal.ProgressListener; 30 | 31 | public class NopProgressListener implements ProgressListener { 32 | 33 | public void onDirectory(File file) { 34 | } 35 | 36 | public void onDone() { 37 | } 38 | 39 | public void onFileAddition(File file) { 40 | } 41 | 42 | public void onFileScan(File file) { 43 | } 44 | 45 | public void onInplaceConversion(File file) { 46 | } 47 | 48 | public void onFileScanBegin() { 49 | } 50 | 51 | public void onMigrationBegin() { 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /slf4j-migrator/src/test/java/org/slf4j/migrator/line/PackageTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.line; 26 | 27 | import org.junit.runner.RunWith; 28 | import org.junit.runners.Suite; 29 | import org.junit.runners.Suite.SuiteClasses; 30 | 31 | @RunWith(Suite.class) 32 | @SuiteClasses({ TrivialMatcherTest.class, JCLRuleSetTest.class, Log4jRuleSetTest.class, NoConversionTest.class }) 33 | public class PackageTest { 34 | } 35 | -------------------------------------------------------------------------------- /slf4j-migrator/src/test/java/org/slf4j/migrator/line/TrivialMatcherTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.migrator.line; 26 | 27 | import static org.junit.Assert.assertEquals; 28 | 29 | import org.junit.Test; 30 | 31 | public class TrivialMatcherTest { 32 | 33 | @Test 34 | public void testSimpleReplacement() { 35 | LineConverter trivialLC = new LineConverter(new TrivialMatcher()); 36 | 37 | // "import org.slf4j.converter" -- > simple replacement with an unique 38 | // capturing group 39 | assertEquals("simple replacement with an unique capturing group", trivialLC.getOneLineReplacement("import org.slf4j.converter")); 40 | 41 | assertEquals("1st group second group 4th group", trivialLC.getOneLineReplacement("first group second group third group 4th group")); 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /slf4j-nop/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2023 QOS.ch 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-nop/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.slf4j 9 | slf4j-parent 10 | 2.0.18-SNAPSHOT 11 | ../parent/pom.xml 12 | 13 | 14 | slf4j-nop 15 | 16 | jar 17 | SLF4J NOP Provider 18 | SLF4J NOP Provider 19 | http://www.slf4j.org 20 | 21 | 22 | org.slf4j.nop 23 | org.slf4j.nop.NOPServiceProvider 24 | nop 25 | 26 | 27 | 28 | 29 | org.slf4j 30 | slf4j-api 31 | 32 | 33 | 34 | org.slf4j 35 | slf4j-api 36 | test-jar 37 | ${project.version} 38 | test 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /slf4j-nop/src/main/java/org/slf4j/nop/NOPServiceProvider.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.nop; 2 | 3 | import org.slf4j.ILoggerFactory; 4 | import org.slf4j.IMarkerFactory; 5 | import org.slf4j.helpers.BasicMarkerFactory; 6 | import org.slf4j.helpers.NOPLoggerFactory; 7 | import org.slf4j.helpers.NOPMDCAdapter; 8 | import org.slf4j.spi.MDCAdapter; 9 | import org.slf4j.spi.SLF4JServiceProvider; 10 | 11 | public class NOPServiceProvider implements SLF4JServiceProvider { 12 | 13 | /** 14 | * Declare the version of the SLF4J API this implementation is compiled against. 15 | * The value of this field is modified with each major release. 16 | */ 17 | // to avoid constant folding by the compiler, this field must *not* be final 18 | public static String REQUESTED_API_VERSION = "2.0.99"; // !final 19 | 20 | private final ILoggerFactory loggerFactory = new NOPLoggerFactory(); 21 | 22 | // LoggerFactory expects providers to initialize markerFactory as early as possible. 23 | private final IMarkerFactory markerFactory; 24 | 25 | // LoggerFactory expects providers to initialize their MDCAdapter field 26 | // as early as possible, preferably at construction time. 27 | private final MDCAdapter mdcAdapter; 28 | 29 | public NOPServiceProvider() { 30 | markerFactory = new BasicMarkerFactory(); 31 | mdcAdapter = new NOPMDCAdapter(); 32 | } 33 | public ILoggerFactory getLoggerFactory() { 34 | return loggerFactory; 35 | } 36 | 37 | public IMarkerFactory getMarkerFactory() { 38 | return markerFactory; 39 | } 40 | 41 | public MDCAdapter getMDCAdapter() { 42 | return mdcAdapter; 43 | } 44 | 45 | @Override 46 | public String getRequestedApiVersion() { 47 | return REQUESTED_API_VERSION; 48 | } 49 | 50 | public void initialize() { 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /slf4j-nop/src/main/java9/module-info.java: -------------------------------------------------------------------------------- 1 | module org.slf4j.nop { 2 | requires org.slf4j; 3 | provides org.slf4j.spi.SLF4JServiceProvider with org.slf4j.nop.NOPServiceProvider; 4 | 5 | exports org.slf4j.nop; 6 | opens org.slf4j.nop to org.slf4j; 7 | } 8 | -------------------------------------------------------------------------------- /slf4j-nop/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider: -------------------------------------------------------------------------------- 1 | org.slf4j.nop.NOPServiceProvider -------------------------------------------------------------------------------- /slf4j-reload4j/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2023 QOS.ch Sarl (Switzerland) 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/main/java/org/slf4j/reload4j/Reload4jServiceProvider.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.reload4j; 2 | 3 | import org.apache.log4j.Level; 4 | import org.slf4j.ILoggerFactory; 5 | import org.slf4j.IMarkerFactory; 6 | import org.slf4j.helpers.BasicMarkerFactory; 7 | import org.slf4j.helpers.Reporter; 8 | import org.slf4j.helpers.Util; 9 | import org.slf4j.spi.MDCAdapter; 10 | import org.slf4j.spi.SLF4JServiceProvider; 11 | 12 | public class Reload4jServiceProvider implements SLF4JServiceProvider { 13 | 14 | /** 15 | * Declare the version of the SLF4J API this implementation is compiled against. 16 | * The value of this field is modified with each major release. 17 | */ 18 | // to avoid constant folding by the compiler, this field must *not* be final 19 | public static String REQUESTED_API_VERSION = "2.0.99"; // !final 20 | 21 | private ILoggerFactory loggerFactory; 22 | 23 | // LoggerFactory expects providers to initialize markerFactory as early as possible. 24 | private final IMarkerFactory markerFactory; 25 | 26 | // LoggerFactory expects providers to have a valid MDCAdapter field 27 | // as early as possible, preferably at construction time. 28 | private final MDCAdapter mdcAdapter; 29 | 30 | public Reload4jServiceProvider() { 31 | markerFactory = new BasicMarkerFactory(); 32 | mdcAdapter = new Reload4jMDCAdapter(); 33 | try { 34 | @SuppressWarnings("unused") 35 | Level level = Level.TRACE; 36 | } catch (NoSuchFieldError nsfe) { 37 | Reporter.error("This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version"); 38 | } 39 | } 40 | 41 | @Override 42 | public void initialize() { 43 | loggerFactory = new Reload4jLoggerFactory(); 44 | } 45 | 46 | @Override 47 | public ILoggerFactory getLoggerFactory() { 48 | return loggerFactory; 49 | } 50 | 51 | 52 | @Override 53 | public IMarkerFactory getMarkerFactory() { 54 | return markerFactory; 55 | } 56 | 57 | 58 | @Override 59 | public MDCAdapter getMDCAdapter() { 60 | return mdcAdapter; 61 | } 62 | 63 | @Override 64 | public String getRequestedApiVersion() { 65 | return REQUESTED_API_VERSION; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider: -------------------------------------------------------------------------------- 1 | org.slf4j.reload4j.Reload4jServiceProvider 2 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/test/java/org/slf4j/reload4j/EventFieldsTest.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.reload4j; 2 | 3 | import org.apache.log4j.spi.LoggingEvent; 4 | import org.junit.After; 5 | import org.junit.Test; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | import java.util.List; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | public class EventFieldsTest { 14 | 15 | // value of LogManager.DEFAULT_CONFIGURATION_KEY; 16 | static String CONFIG_FILE_KEY = "log4j.configuration"; 17 | 18 | @After 19 | public void tearDown() throws Exception { 20 | System.clearProperty(CONFIG_FILE_KEY); 21 | } 22 | 23 | @Test 24 | public void testWhetherEventsFieldsAreSet() { 25 | System.setProperty(CONFIG_FILE_KEY, "eventFields.properties"); 26 | Logger logger = LoggerFactory.getLogger(this.getClass()); 27 | logger.info("hello"); 28 | logger.atInfo().setMessage("hello").log(); 29 | 30 | org.slf4j.reload4j.Reload4jLoggerAdapter rootReload4j = (org.slf4j.reload4j.Reload4jLoggerAdapter) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); 31 | 32 | 33 | ListAppender listAppender = (ListAppender) rootReload4j.logger.getAppender("LIST"); 34 | 35 | assertNotNull(listAppender); 36 | assertNotNull(listAppender.list); 37 | 38 | List eventList = listAppender.list; 39 | 40 | assertEquals(2, eventList.size()); 41 | 42 | LoggingEvent loggingEvent0 = eventList.get(0); 43 | long timeStamp0 = loggingEvent0.getTimeStamp(); 44 | String threadName0 = loggingEvent0.getThreadName(); 45 | assertTrue(timeStamp0 != 0); 46 | assertNotNull(threadName0); 47 | assertFalse(threadName0.isEmpty()); 48 | 49 | LoggingEvent loggingEvent1 = eventList.get(1); 50 | long timeStamp1 = loggingEvent1.getTimeStamp(); 51 | String threadName1 = loggingEvent1.getThreadName(); 52 | assertTrue(timeStamp1 != 0); 53 | assertTrue(timeStamp1 >= timeStamp0); 54 | assertNotNull(threadName1); 55 | assertFalse(threadName1.isEmpty()); 56 | assertEquals(threadName0, threadName1); 57 | 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/test/java/org/slf4j/reload4j/ListAppender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.reload4j; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | import org.apache.log4j.AppenderSkeleton; 31 | import org.apache.log4j.spi.LoggingEvent; 32 | 33 | public class ListAppender extends AppenderSkeleton { 34 | 35 | public List list = new ArrayList<>(); 36 | 37 | public boolean extractLocationInfo = false; 38 | 39 | protected void append(LoggingEvent event) { 40 | list.add(event); 41 | if (extractLocationInfo) { 42 | event.getLocationInformation(); 43 | } 44 | } 45 | 46 | public void close() { 47 | } 48 | 49 | public boolean requiresLayout() { 50 | return false; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/test/java/org/slf4j/reload4j/RecursiveInitializationTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.reload4j; 26 | 27 | import java.util.Random; 28 | 29 | import org.junit.After; 30 | import org.junit.Test; 31 | import org.slf4j.Logger; 32 | import org.slf4j.LoggerFactory; 33 | 34 | public class RecursiveInitializationTest { 35 | 36 | // value of LogManager.DEFAULT_CONFIGURATION_KEY; 37 | static String CONFIG_FILE_KEY = "log4j.configuration"; 38 | 39 | int diff = new Random().nextInt(10000); 40 | String loggerName = "org.slf4j.impl.RecursiveInitializationTest"; 41 | 42 | @After 43 | public void tearDown() throws Exception { 44 | System.clearProperty(CONFIG_FILE_KEY); 45 | } 46 | 47 | @Test 48 | public void loggingDuringInitialization() { 49 | System.setProperty(CONFIG_FILE_KEY, "recursiveInit.properties"); 50 | Logger logger = LoggerFactory.getLogger(loggerName + ".loggingDuringInitialization-" + diff); 51 | logger.info("hello"); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/test/java/org/slf4j/reload4j/Reload4jMDCAdapterTest.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.reload4j; 2 | 3 | import org.junit.Test; 4 | import org.slf4j.helpers.MDCAdapterTestBase; 5 | import org.slf4j.spi.MDCAdapter; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | public class Reload4jMDCAdapterTest extends MDCAdapterTestBase { 13 | 14 | protected MDCAdapter instantiateMDC() { 15 | return new Reload4jMDCAdapter(); 16 | } 17 | 18 | 19 | @Test 20 | public void testClearingMDC() { 21 | mdc.put("testKey", "testValue"); 22 | assertFalse(mdc.getCopyOfContextMap().isEmpty()); 23 | mdc.clear(); 24 | assertTrue(mdc.getCopyOfContextMap().isEmpty()); 25 | } 26 | 27 | @Test 28 | public void testSetContextMap() { 29 | Map map0 = new HashMap<>(); 30 | map0.put("key0", "val0"); 31 | 32 | mdc.setContextMap(map0); 33 | Map map1 = mdc.getCopyOfContextMap(); 34 | 35 | assertEquals(map0, map1); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/test/resources/eventFields.properties: -------------------------------------------------------------------------------- 1 | log4j.debug=true 2 | log4j.rootLogger=DEBUG, LIST 3 | 4 | log4j.appender.LIST=org.slf4j.reload4j.ListAppender 5 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/test/resources/recursiveInit.properties: -------------------------------------------------------------------------------- 1 | log4j.debug=true 2 | log4j.rootLogger=DEBUG, RECURSIVE 3 | 4 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 5 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.CONSOLE.layout.ConversionPattern=[%t] %c - %m%n 7 | 8 | log4j.appender.RECURSIVE=org.slf4j.reload4j.testHarness.RecursiveAppender 9 | -------------------------------------------------------------------------------- /slf4j-reload4j/src/test/resources/recursiveInitWithActivationDelay.properties: -------------------------------------------------------------------------------- 1 | log4j.debug=true 2 | log4j.rootLogger=DEBUG, CONSOLE, RECURSIVE 3 | 4 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 5 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.CONSOLE.layout.ConversionPattern=CON [%t] %c - %m%n 7 | 8 | log4j.appender.RECURSIVE=org.slf4j.reload4j.testHarness.RecursiveAppender 9 | log4j.appender.RECURSIVE.activationDelay=10 10 | -------------------------------------------------------------------------------- /slf4j-simple/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2023 QOS.ch 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /slf4j-simple/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.slf4j 9 | slf4j-parent 10 | 2.0.18-SNAPSHOT 11 | ../parent/pom.xml 12 | 13 | 14 | slf4j-simple 15 | jar 16 | SLF4J Simple Provider 17 | SLF4J Simple Provider 18 | http://www.slf4j.org 19 | 20 | 21 | org.slf4j.simple 22 | org.slf4j.simple.SimpleServiceProvider 23 | simple 24 | 25 | 26 | 27 | 28 | org.slf4j 29 | slf4j-api 30 | 31 | 32 | 33 | org.slf4j 34 | slf4j-api 35 | test-jar 36 | ${project.version} 37 | test 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /slf4j-simple/src/main/java/org/slf4j/simple/OutputChoice.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.simple; 2 | 3 | import java.io.PrintStream; 4 | 5 | /** 6 | * This class encapsulates the user's choice of output target. 7 | * 8 | * @author Ceki Gülcü 9 | * 10 | */ 11 | class OutputChoice { 12 | 13 | enum OutputChoiceType { 14 | SYS_OUT, CACHED_SYS_OUT, SYS_ERR, CACHED_SYS_ERR, FILE; 15 | } 16 | 17 | final OutputChoiceType outputChoiceType; 18 | final PrintStream targetPrintStream; 19 | 20 | OutputChoice(OutputChoiceType outputChoiceType) { 21 | if (outputChoiceType == OutputChoiceType.FILE) { 22 | throw new IllegalArgumentException(); 23 | } 24 | this.outputChoiceType = outputChoiceType; 25 | if (outputChoiceType == OutputChoiceType.CACHED_SYS_OUT) { 26 | this.targetPrintStream = System.out; 27 | } else if (outputChoiceType == OutputChoiceType.CACHED_SYS_ERR) { 28 | this.targetPrintStream = System.err; 29 | } else { 30 | this.targetPrintStream = null; 31 | } 32 | } 33 | 34 | OutputChoice(PrintStream printStream) { 35 | this.outputChoiceType = OutputChoiceType.FILE; 36 | this.targetPrintStream = printStream; 37 | } 38 | 39 | PrintStream getTargetPrintStream() { 40 | switch (outputChoiceType) { 41 | case SYS_OUT: 42 | return System.out; 43 | case SYS_ERR: 44 | return System.err; 45 | case CACHED_SYS_ERR: 46 | case CACHED_SYS_OUT: 47 | case FILE: 48 | return targetPrintStream; 49 | default: 50 | throw new IllegalArgumentException(); 51 | } 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /slf4j-simple/src/main/java/org/slf4j/simple/SimpleServiceProvider.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.simple; 2 | 3 | import org.slf4j.ILoggerFactory; 4 | import org.slf4j.IMarkerFactory; 5 | import org.slf4j.helpers.BasicMarkerFactory; 6 | import org.slf4j.helpers.NOPMDCAdapter; 7 | import org.slf4j.spi.MDCAdapter; 8 | import org.slf4j.spi.SLF4JServiceProvider; 9 | 10 | public class SimpleServiceProvider implements SLF4JServiceProvider { 11 | 12 | /** 13 | * Declare the version of the SLF4J API this implementation is compiled against. 14 | * The value of this field is modified with each major release. 15 | */ 16 | // to avoid constant folding by the compiler, this field must *not* be final 17 | public static String REQUESTED_API_VERSION = "2.0.99"; // !final 18 | 19 | private ILoggerFactory loggerFactory; 20 | // LoggerFactory expects providers to initialize markerFactory as early as possible. 21 | private final IMarkerFactory markerFactory; 22 | // LoggerFactory expects providers to initialize their MDCAdapter field 23 | // as early as possible, preferably at construction time. 24 | private final MDCAdapter mdcAdapter; 25 | 26 | public SimpleServiceProvider() { 27 | markerFactory = new BasicMarkerFactory(); 28 | mdcAdapter = new NOPMDCAdapter(); 29 | } 30 | 31 | public ILoggerFactory getLoggerFactory() { 32 | return loggerFactory; 33 | } 34 | 35 | @Override 36 | public IMarkerFactory getMarkerFactory() { 37 | return markerFactory; 38 | } 39 | 40 | @Override 41 | public MDCAdapter getMDCAdapter() { 42 | return mdcAdapter; 43 | } 44 | 45 | @Override 46 | public String getRequestedApiVersion() { 47 | return REQUESTED_API_VERSION; 48 | } 49 | 50 | @Override 51 | public void initialize() { 52 | loggerFactory = new SimpleLoggerFactory(); 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /slf4j-simple/src/main/java9/module-info.java: -------------------------------------------------------------------------------- 1 | module org.slf4j.simple { 2 | requires org.slf4j; 3 | provides org.slf4j.spi.SLF4JServiceProvider with org.slf4j.simple.SimpleServiceProvider; 4 | exports org.slf4j.simple; 5 | opens org.slf4j.simple to org.slf4j; 6 | } 7 | -------------------------------------------------------------------------------- /slf4j-simple/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider: -------------------------------------------------------------------------------- 1 | org.slf4j.simple.SimpleServiceProvider -------------------------------------------------------------------------------- /slf4j-simple/src/test/java/org/slf4j/simple/AcceptanceTest.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.simple; 2 | 3 | import org.junit.Ignore; 4 | import org.slf4j.Logger; 5 | import org.slf4j.event.Level; 6 | 7 | import java.io.PrintStream; 8 | 9 | @Ignore 10 | public class AcceptanceTest extends LoggerTestSuite { 11 | 12 | @Override 13 | public Logger createLogger(ListAppendingOutputStream outputStream, Level level) { 14 | SimpleLogger.CONFIG_PARAMS.outputChoice = new OutputChoice(new PrintStream(outputStream)); 15 | 16 | SimpleLogger logger = new SimpleLogger("TestSuiteLogger"); 17 | logger.currentLogLevel = SimpleLoggerConfiguration.stringToLevel(level.toString()); 18 | return logger; 19 | } 20 | 21 | @Override 22 | public String extractMessage(String message) { 23 | return message 24 | .split("\n")[0] 25 | .split("- ")[1]; 26 | } 27 | 28 | @Override 29 | public String extractExceptionMessage(String message) { 30 | String[] logLines = message.split("\n"); 31 | 32 | if (logLines.length < 2) { 33 | return null; 34 | } 35 | String exceptionLine = logLines[1]; 36 | return exceptionLine.split(": ")[1]; 37 | } 38 | 39 | @Override 40 | public String extractExceptionType(String message) { 41 | String[] logLines = message.split("\n"); 42 | 43 | if (logLines.length < 2) { 44 | return null; 45 | } 46 | String exceptionLine = logLines[1]; 47 | return exceptionLine.split(": ")[0]; 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /slf4j-simple/src/test/java/org/slf4j/simple/DoubleInitializationPitfallTest.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.simple; 2 | 3 | import static org.junit.Assert.fail; 4 | 5 | import org.junit.Test; 6 | import org.slf4j.ILoggerFactory; 7 | import org.slf4j.LoggerFactory; 8 | import org.slf4j.MDC; 9 | import org.slf4j.MarkerFactory; 10 | 11 | // See https://jira.qos.ch/browse/SLF4J-463 12 | public class DoubleInitializationPitfallTest { 13 | 14 | // See https://jira.qos.ch/browse/SLF4J-463 15 | @Test 16 | public void verifyImpactOfMarkerFactory() { 17 | ILoggerFactory firstFactory = LoggerFactory.getILoggerFactory(); 18 | MarkerFactory.getMarker("DOUBLE_INIT"); 19 | ILoggerFactory secondFactory = LoggerFactory.getILoggerFactory(); 20 | 21 | if (firstFactory != secondFactory) { 22 | fail("MarkerFactory.getMarker causes multiple provider initialization"); 23 | } 24 | } 25 | 26 | @Test 27 | public void verifyImpactOfMDC() { 28 | ILoggerFactory firstFactory = LoggerFactory.getILoggerFactory(); 29 | MDC.put("DoubleInitializationPitfallTest", "a"); 30 | ILoggerFactory secondFactory = LoggerFactory.getILoggerFactory(); 31 | 32 | if (firstFactory != secondFactory) { 33 | fail("MarkerFactory.getMarker causes multiple provider initialization"); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /slf4j-simple/src/test/java/org/slf4j/simple/SilentPrintStream.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2004-2011 QOS.ch 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | package org.slf4j.simple; 26 | 27 | import java.io.PrintStream; 28 | 29 | public class SilentPrintStream extends PrintStream { 30 | 31 | PrintStream other; 32 | 33 | public SilentPrintStream(PrintStream ps) { 34 | super(ps); 35 | other = ps; 36 | } 37 | 38 | public void print(String s) { 39 | } 40 | 41 | public void println(String s) { 42 | } 43 | 44 | public void println(Object x) { 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /slf4j-simple/src/test/java/org/slf4j/simple/Slf4jVersionTest.java: -------------------------------------------------------------------------------- 1 | package org.slf4j.simple; 2 | 3 | import org.junit.Test; 4 | import org.slf4j.helpers.Slf4jEnvUtil; 5 | 6 | import static org.junit.Assert.assertNotNull; 7 | import static org.junit.Assert.assertTrue; 8 | 9 | public class Slf4jVersionTest { 10 | 11 | 12 | @Test 13 | public void slf4jVersionTest() { 14 | 15 | String version = Slf4jEnvUtil.slf4jVersion(); 16 | assertNotNull(version); 17 | assertTrue(version.startsWith("2")); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /slf4j-simple/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # SLF4J's SimpleLogger configuration file 2 | # Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. 3 | 4 | # Default logging detail level for all instances of SimpleLogger. 5 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 6 | # If not specified, defaults to "info". 7 | #org.slf4j.simpleLogger.defaultLogLevel=info 8 | 9 | # Logging detail level for a SimpleLogger instance named "xxxxx". 10 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 11 | # If not specified, the default logging detail level is used. 12 | #org.slf4j.simpleLogger.log.xxxxx= 13 | 14 | # Set to true if you want the current date and time to be included in output messages. 15 | # Default is false, and will output the number of milliseconds elapsed since startup. 16 | #org.slf4j.simpleLogger.showDateTime=false 17 | 18 | # The date and time format to be used in the output messages. 19 | # The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. 20 | # If the format is not specified or is invalid, the default format is used. 21 | # The default format is yyyy-MM-dd HH:mm:ss:SSS Z. 22 | #org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z 23 | 24 | # Set to true if you want to output the current thread name. 25 | # Defaults to true. 26 | #org.slf4j.simpleLogger.showThreadName=true 27 | 28 | # Set to true if you want the Logger instance name to be included in output messages. 29 | # Defaults to true. 30 | #org.slf4j.simpleLogger.showLogName=true 31 | 32 | # Set to true if you want the last component of the name to be included in output messages. 33 | # Defaults to false. 34 | #org.slf4j.simpleLogger.showShortLogName=false 35 | -------------------------------------------------------------------------------- /src/main/javadocHeaders.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | */ 6 | 7 | (\s|\t)*/\*.*$ 8 | .*\*/(\s|\t)*$ 9 | 10 | -------------------------------------------------------------------------------- /src/main/licenseHeader.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2011 QOS.ch 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | --------------------------------------------------------------------------------