Compare commits

...

568 Commits

Author SHA1 Message Date
ceki 61400453cd start work on 2.0.19-SNAPSHOT
Signed-off-by: ceki <ceki@qos.ch>
2026-05-12 20:37:36 +02:00
ceki 58b66c2c7e update central-publishing-maven-plugin
Signed-off-by: ceki <ceki@qos.ch>
2026-05-12 20:32:21 +02:00
ceki be4841cce8 prepare release 2.0.18
Signed-off-by: ceki <ceki@qos.ch>
2026-05-12 20:15:59 +02:00
ceki d2073bece8 minor refactoring, javadoc changes
Signed-off-by: ceki <ceki@qos.ch>
2025-11-24 17:51:51 +01:00
ceki 32a9854cf4 add a trivial test for CONFIG_PARAMS.warnLevelString
Signed-off-by: ceki <ceki@qos.ch>
2025-11-03 15:24:43 +01:00
ceki 77936c6f1f CONFIG_PARAMS.warnLevelString should be taken into account
See https://github.com/qos-ch/slf4j/issues/471

Signed-off-by: ceki <ceki@qos.ch>
2025-11-03 14:31:01 +01:00
ceki 34c9d30af5 extract first marker when caller locationAwareLogger
Signed-off-by: ceki <ceki@qos.ch>
2025-11-01 20:09:13 +01:00
ceki 902b463957 remove cruft
Signed-off-by: ceki <ceki@qos.ch>
2025-10-01 16:00:03 +02:00
ceki b3c2f16f12 security manager is no longer supported in later JDKs
Signed-off-by: ceki <ceki@qos.ch>
2025-10-01 15:59:29 +02:00
ceki 9468c7a28f remove unneccessary and unused files
Signed-off-by: ceki <ceki@qos.ch>
2025-10-01 15:58:52 +02:00
Ceki Gulcu 183aaa5070 start work on 2.0.18-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2025-02-25 18:40:43 +01:00
Ceki Gulcu c233ea1932 prepare release 2.0.17
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2025-02-25 17:36:36 +01:00
Ceki Gulcu 4b4d533771 In SLF4JProviders, move initialization of the markerFactory and
mdcAdapter fields to the constructor.

Added comments regarding LoggerFactory expectation of providers to
initialize their MDCAdapter and markerFactory field as early as
possible, preferably at construction time.

Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2025-02-07 10:36:45 +01:00
Ceki Gulcu 9349d64f95 In response to issue 450, moved the binding of the MDCAdapter in the
MDC class from the static initializer to the LoggerFactory.bind method.

In case MDC methods are called before LoggerFactory, the various methods
in MDC have been modified to go through the getMDCAdapter method which
checks for this rare case.

https://github.com/qos-ch/slf4j/issues/450

Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2025-02-07 10:05:06 +01:00
Piotr P. Karwasz 0def25ebfa Replace license names with SPDX identifiers
As suggested by [Maven documentation](https://maven.apache.org/pom.html#Licenses) the `/project/licenses/licence/name` element in the POM file should contain a SPDX identifier of the license.
The license element is often used by external tools, such as SBOM generators.

This PR:

- Replaces the current content of the `<name>` element with the appropriate SPDX identifier.
- Follows all HTTP 301 redirections of the currently provided license URLs.

Signed-off-by: Piotr P. Karwasz <piotr.github@karwasz.org>
2024-12-10 11:01:56 +01:00
Ceki Gulcu 69c333de28 fix issues/425
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-10-21 20:50:59 +02:00
Ceki Gülcü 2470fad4fd
Update README.md 2024-09-22 11:14:48 +02:00
Ceki Gülcü c2c29fec98
Update README.md 2024-09-22 11:12:06 +02:00
Ceki Gulcu 0597225b5b README updates
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-09-22 11:07:14 +02:00
Ceki Gulcu f7b34c2e60 fix incorrect interpretation of Level.OFF and Level.ALL in SLF4JPlatformLogger
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-09-21 13:16:33 +02:00
Ceki Gulcu 4fa92fc007 start work on 2.0.17-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-10 11:38:41 +02:00
Ceki Gulcu 101086ba35 prepare release 2.0.16
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-10 11:11:51 +02:00
Ceki Gulcu 8ae0efca23 class.getModule is new in Java9
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-10 11:00:18 +02:00
Ceki Gulcu 3ff00870b3 print connected provider only if DEBUG level for internal reporting is enabled
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-10 09:49:56 +02:00
Manfred Hanke 0df43e9e53 fix javadoc of Slf4jEnvUtil
resolves #423

Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
2024-08-08 22:24:18 +02:00
Ceki Gulcu 46b5ea54a6 start work on 2.0.16-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-08 16:48:10 +02:00
Ceki Gulcu 5321a975d4 prepare release 2.0.15
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-08 14:56:10 +02:00
Ceki Gulcu 09111e8c1e added copyright, @since to Slf4jEnvUtil
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-07 17:46:14 +02:00
Ceki Gulcu 6a04f67fdd start work on version 2.0.15-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-07 17:31:29 +02:00
Ceki Gulcu 03aa6b915a prepare release 2.0.14
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-06 22:30:45 +02:00
Ceki Gulcu 7c3b0ef011 added method returning slf4j version
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-06 22:17:49 +02:00
Ceki Gulcu 42810107b0 LoggerFactory emits 'SLF4J(I): Connected with provider of type'
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-05 22:10:08 +02:00
Ceki Gulcu 982e4b067f clearer assertion take II
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-04 21:30:31 +02:00
Ceki Gulcu dd4486b5c5 clearer assertion
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-08-04 21:25:43 +02:00
Ceki Gulcu 1d82519b07 start work on 2.0.14-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-04-12 18:05:28 +02:00
Ceki Gulcu 5ffbc67def prepare release 2.0.13
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-04-12 16:21:00 +02:00
Ceki Gulcu 3386517ad6 fix issues/409 SLF4J-601, wrong classname when using slf4j inside a wrapper
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-04-12 15:47:48 +02:00
Ceki Gulcu 448bca173c start work on 2.0.13-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-02-05 22:58:12 +01:00
Ceki Gulcu 955209464d increase leniency count
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-02-05 22:32:22 +01:00
Ceki Gulcu c1473c957a prepare release 2.0.12
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-02-05 22:21:34 +01:00
Ceki Gulcu 98932348fb minor reminder
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-02-05 22:20:48 +01:00
Ceki Gulcu c52da92599 revert Util.report methods removed by mistake
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-02-05 22:17:54 +01:00
Ceki Gulcu da91e4f219 export provider packages, allow reflection by org.slf4j
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-02-05 21:45:58 +01:00
Ceki Gulcu 8c4ea8f225 more comments
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-01-23 15:51:31 +01:00
Ceki Gulcu 6b2921a523 start wotk on 2.0.12-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-01-08 20:50:02 +01:00
Ceki Gulcu 3f4717c44e get javadoc:aggregate command to work
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-01-08 20:48:59 +01:00
Ceki Gulcu d9145fba56 prepare release 2.0.11
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-01-08 18:58:10 +01:00
Ceki Gulcu 68ff7064ec acceptance test, disabled for the moment
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-01-08 18:50:54 +01:00
Guillaume Nodet db8cd90c10 Use computeIfAbsent with a protected method, make reset protected
Signed-off-by: Guillaume Nodet <gnodet@gmail.com>
2024-01-08 17:39:25 +01:00
Guillaume Nodet d564304a61 Use computeIfAbsent with a protected method, make reset protected
Signed-off-by: Guillaume Nodet <gnodet@gmail.com>
2024-01-08 17:39:25 +01:00
Ceki Gulcu ef8dda71dd javadoc changed for SimpleLogger constructor
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-01-08 15:23:23 +01:00
Ceki Gulcu fe42ecb5f7 change constructor access modifier instead of
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-01-08 15:16:08 +01:00
Ceki Gulcu 7029a8b7fd add renderLevel method in SimpleLogger
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2024-01-08 15:02:22 +01:00
Ceki Gulcu 8c873b2e75 start work on 2.0.11-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-12-29 00:03:40 +01:00
Ceki Gulcu 7bcee9aa1f javadoc configuration tweak
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-12-29 00:02:38 +01:00
Ceki Gulcu 6fe9c07113 more javadoc adjustments
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-12-28 21:48:34 +01:00
Ceki Gulcu df562c22d8 migrator should have javadocs
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-12-28 21:38:38 +01:00
Ceki Gulcu 6d39ca8bf9 prepare release 2.0.10
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-12-28 21:14:08 +01:00
Ceki Gulcu 86ee8298d9 javadoc edit
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-12-06 20:54:40 +01:00
Ceki Gulcu 5ccbe20b11 remove unreachable code, see issues/371
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-12-05 10:02:43 +01:00
Ceki Gulcu 02b36a269a attempt at fixing PR 358
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-11-25 20:47:16 +01:00
Ceki Gulcu c12667b906 document Reporter class
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-11-17 12:57:30 +01:00
Ceki Gulcu 316b5d1727 first attempt at fixing issues/361
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-11-15 19:59:01 +01:00
Hervé Boutemy 7c164fab8d upgrade maven-bundle-plugin
fixes Reproducible  Builds issue with OSGi metadata
2023-09-03 23:03:40 +02:00
Ceki Gulcu 56e42fdb61 start work on 2.0.10-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-09-03 18:20:34 +02:00
Ceki Gulcu 216459e5d8 prepare release 2.0.9
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-09-03 18:12:02 +02:00
Ceki Gulcu 2481810f94 rename slf4j.binding system proerty as slf4j.provider
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-09-03 18:06:27 +02:00
Ceki Gulcu 25d742d666 start work on 2.0.9-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-09-03 17:44:47 +02:00
Ceki Gulcu 10a151756d further adjusments for successful deployment on Maven Central
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-08-29 23:31:08 +02:00
Ceki Gulcu 17f5bf3d87 fix issues during deployment
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-08-29 23:04:24 +02:00
Ceki Gulcu f967033766 move parent-pom.xml to parent/pom.xml as explained in SLF4J-437
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-08-29 22:50:25 +02:00
Ceki Gulcu 0b9c92cc3a prepare release 2.0.8
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-08-29 22:14:17 +02:00
Ceki Gulcu 05698f8d23 fine tuning for SLF4J-450
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-08-29 22:06:48 +02:00
Kengo TODA 9783320b6c feat: allow binding to be explicitly specified 2023-08-29 16:40:18 +02:00
Ethan McCue aa13da39ed Fix typo in "SLF4JPlarformLoggerFactory"
Signed-off-by: Ethan McCue <ethan@mccue.dev>
2023-08-08 18:25:20 +02:00
Ceki Gulcu 7a4da876b3 add equals/hashCode to KeyValuePair
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-08-08 18:20:12 +02:00
Taku Miyakawa 0769bc8182 use MessageFormat insetad of String.format to comply spec of System.Logger.log
Signed-off-by: Taku Miyakawa <miyakawa.taku@gmail.com>
2023-08-08 18:12:15 +02:00
Ceki Gulcu e63f87f02c fix SLF4J-595
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-07-12 22:50:26 +02:00
Ceki Gulcu 3f20e0dfd2 update certain plugins, add parent-pom.xml as a module fixing SLF4J-596
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-07-12 21:52:15 +02:00
Ceki Gulcu 06fa09a2fb use jar plugin to add MainClass information in MANIFEST.MF instead of the fleix plugin, see SLF4J-594
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-07-11 11:04:41 +02:00
Ceki Gulcu 6fd9db9b5e add BOM file, fixes SLF4J-437
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-06-16 18:05:17 +02:00
Hannes Wellmann f871e7f2e9 Restore 'Main-Class' header in slf4j-migrator Manifest.MF
Because the Manifest.MF did not have a terminating new-line it was
invalid and its content was ignored, thus the Main-Class entry was
missing.

To have less files in the project, generate the entry using the
maven-bundle-plugin.

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
2023-04-10 00:13:24 +02:00
Hannes Wellmann 0b4d88edef Use project.name in Bundle-Name and simplify slf4j-api OSGi metadata gen
The value of project.name is more expressive than the previously used
project.artifactId.

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
2023-04-10 00:11:41 +02:00
Hannes Wellmann 2ec7c1034c Replace all remaining OSGi MANIFEST.MF by bundle-plugin instructions
This ensures that there is only a single source for OSGi metadata.
Additionally this improves the metadata for some Export-Package entries.

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
2023-04-10 00:11:41 +02:00
Hannes Wellmann df44ace9c3 Automate OSGi metadata creation and fix metadata for other slf4j-modules
Only use the maven-bundle-plugin to generate all OSGi metadata into
slf4j's Manifest.MF files. This unifies the resulting MANIFEST.MFs
that are currently partly generated and partly statically defined and
fixes the following aspects:

- Fix the package-export of slf4j-jdk-platform-logging (from
'slf4j.jdk.platform.logging' to 'org.slf4j.jdk.platform.logging')
- Import missing packages for slf4j-reload4j and log4j-over-slf4j
- Replace the deprecated 'Bundle-RequiredExecutionEnvironment' by a
corresponding required 'osgi.ee' capability
- Restores the exported packages of jcl-over-slf4j

Fixes https://jira.qos.ch/browse/SLF4J-578

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
2023-04-10 00:11:41 +02:00
Hannes Wellmann 661869eeb2 Adapt project names from 'Binding' to 'Provider'
Since slf4j 2 Bindings are now called Providers. The corresponding Maven
project names and descriptions should be adapted accordingly.

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
2023-04-09 18:25:43 +02:00
Ceki Gulcu cff3312e43 start work on 2.0.8-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-03-17 20:41:07 +01:00
Ceki Gulcu d6a21ae68f update javadoc plugin to version 3.0.5
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-03-17 20:35:35 +01:00
Ceki Gulcu 13950e51a6 prepare release 2.0.7
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-03-17 19:49:13 +01:00
Ceki Gulcu 122e0c18dd add LICENSE.txt files to all modules, rename LICENSE as LICENSE.txt when appropriate
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2023-03-17 19:35:56 +01:00
TWI 2a8ca99caf add license file to jar 2023-03-17 19:25:44 +01:00
Hannes Wellmann b363bb31ed SLF4J-579: Export client packages of slf4j-api in version 1
Fixes https://jira.qos.ch/browse/SLF4J-576

This allows to use the slf4j-api version 2 artifact as drop-in
replacement for slf4j-api version 1 in OSGi environments as well.
slf4j-api can now be wired to bundles that require packages of slf4j-api
in version 1 or 2.

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
2023-03-17 18:01:31 +01:00
Hannes Wellmann 2235d3c698
Fully automate OSGi metadata creation and fix brocken OSGi-metadata in slf4j-api (#330)
* Improve generated OSGi metadata and restore Bundle-SymbolicName

Enhance the generated OSGi metadata for all slf4j-modules in the
following ways:
- Restore the Bundle-SymbolicName, Bundle-Name, Bundle-Vendor and
Bundle-DocURL from SLF4J-2.0.5 and before
- Removes Export-Package: META-INF.versions.9
- Removes self-Imports of exported package (has to be added again in a
follow up, where desired)
- Remove unnecessary BND-internal headers

Additionally move the maven-bundle-plugin configuration from the
execution configuration up into the configuration of the plugin so that
it can be easier overwritten in child-modules.

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>

* Automate OSGi metadata creation and restore package-exports of slf4j-api

Only use the maven-bundle-plugin to generate all OSGi metadata into
slf4j-api's Manifest.MF file. This unifies the resulting MANIFEST.MFs
that are currently partly generated and partly statically defined.

Furthermore it fixes the following flaws in the currently generated OSGi
metadata of slf4j-api:
- Import only the exported org.slf4j.spi package (like in slf4j 2.0.5
and before)
- Replace the deprecated 'Bundle-RequiredExecutionEnvironment' header by
a corresponding required 'osgi.ee' capability

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>

---------

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
2023-03-15 21:28:25 +01:00
Sean C. Sullivan a5540ad510 setup-java v3
Signed-off-by: Sean C. Sullivan <github@seansullivan.com>
2022-12-19 20:40:13 +01:00
Ceki Gulcu 1ed084cbc0 add missing distribution instruction to github action
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-19 20:25:11 +01:00
Ceki Gulcu b2cb017422 update github action versions
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-19 20:21:52 +01:00
Sean C. Sullivan fa6721a53e add JDK 19 to CI build
Signed-off-by: Sean C. Sullivan <github@seansullivan.com>
2022-12-19 20:19:54 +01:00
Ceki Gulcu f85104040c start work on 2.0.7-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-12 20:19:53 +01:00
Ceki Gulcu 5ff6f2c385 prepare for release 2.0.6
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-12 20:11:11 +01:00
Ceki Gulcu 2f4aa75445 fix SLF4J-575
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-10 19:30:48 +01:00
Ceki Gulcu 363f0a534e remove unused parts
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-10 00:38:56 +01:00
Jonah Graham 171679baa8 SLF4J-574: Add full OSGi headers, especially "uses" clauses
Fixes: https://jira.qos.ch/browse/SLF4J-574

This uses the BND tool, via org.apache.felix to generate
the MANIFEST.MF to be fully compliant with OSGi.
Compared to using just the maven-jar-plugin to create
the MANIFEST.MF the uses clauses are added to the
Export-Package

Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
2022-12-10 00:10:39 +01:00
Ceki Gulcu 921b5b31e1 fix FUNDING file
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-09 13:31:52 +01:00
Ceki Gulcu e02244c39f fix FUNDING file
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-09 13:31:16 +01:00
Ceki Gulcu 441d4584be fix FUNDING file
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-09 13:30:56 +01:00
Ceki Gulcu f5e741ba1a add FUNDING file
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-12-09 13:30:01 +01:00
Ceki Gulcu 2e71327c8e remove unused log4j dependency in the version definition section of pom.xml
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-26 20:43:43 +01:00
Ceki Gulcu 3ff2a30e05 start work on 2.0.6-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-25 13:33:29 +01:00
Ceki Gulcu 7e62e1e691 prepare release 2.0.5
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-25 12:40:18 +01:00
Ceki Gulcu d250ad79eb in jcl-over-slf4j rename LICENSE.TXT as LICENSE, add LICENSE file to log4j-over-slf4j
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-25 09:56:46 +01:00
Ceki Gulcu 3bc58f3e81 add SecurityManager support
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-24 20:12:00 +01:00
Ceki Gulcu 207bb299c3 start work on 2.0.5-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-17 21:38:06 +01:00
Ceki Gulcu 35dd7ff1e7 removed unused META-INF/services entry
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-17 21:25:09 +01:00
Ceki Gulcu 440c2f3000 prepare release 2.0.4
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-17 21:04:44 +01:00
Ceki Gulcu 43a36303e5 use the class loader that loaded LoggerFactory (instead of the threadContextClassLoader) to find providers
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-11-17 20:49:29 +01:00
Piotr P. Karwasz 557bf7c0bd [SLF4J-548] Fix ServiceLoader usage in servlet environment
If both the servlet container and a web application use SLF4J,
`ServiceLoader` calls are susceptible to three problems:

1. The SLF4J copy in the webapp detects the common providers by can not
instantiate them (they implement a different copy of
`SLF4JProviderService`),
2. The SLF4J copy in the common classloader can bind the providers in
the webapp classloader and cause a memory leak,
3. If the server uses a SecurityManager the static initialization of
`LoggerFactory` fails if called by unprivileged code.

This PR should solve these problems.

Signed-off-by: Piotr P. Karwasz <piotr.github@karwasz.org>
2022-11-17 19:28:19 +01:00
Stefan Bischof 632410565b enhance manifest with capabilities
provide for SLF4JServiceProvider (with name attribute
require for registrar

Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
2022-11-14 18:30:33 +01:00
Ceki Gulcu e540299d58 edit blurb on release championing 2022-10-11 21:18:58 +02:00
Ceki Gülcü dfb41b06a8
Update README.md 2022-10-11 21:04:18 +02:00
Ceki Gulcu 47c7cc7fa4 clarify Logger.makeLoggingEventBuilder javadoc
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-28 15:25:09 +02:00
Ceki Gulcu 0be1bc15f2 Merge branch 'master' of github.com:qos-ch/slf4j 2022-09-28 15:24:06 +02:00
Ceki Gülcü d60690c0b9
more flexible way to 2022-09-28 15:23:30 +02:00
Ceki Gülcü 6720d8db66
Update README.md 2022-09-28 15:10:51 +02:00
Ceki Gülcü 72a0bc6528
Update README.md 2022-09-28 15:04:47 +02:00
Ceki Gülcü f276d52d96
Update README.md 2022-09-28 15:04:20 +02:00
Ceki Gulcu 7cad6082dc Merge branch 'master' of github.com:qos-ch/slf4j 2022-09-28 13:44:04 +02:00
Kengo TODA 143978ce05 annotates new methods to help static analysis tools
Signed-off-by: Kengo TODA <skypencil@gmail.com>
2022-09-28 13:43:36 +02:00
Ceki Gulcu 88b0ee3c1f start work on 2.0.4-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-28 13:30:20 +02:00
Ceki Gulcu b2cb05f16a prepare release 2.0.3
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-28 12:15:18 +02:00
Ceki Gulcu 4b5bb41ede fix SLF4J-546, Fluent logging API doesn't populate timestamp with Reload4JLogger
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-28 12:05:26 +02:00
Ceki Gulcu b500a6fdfd javadoc explaining using multiple markers instead of nested markers
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-26 19:58:49 +02:00
Ceki Gulcu d81affb012 comment about ThreadLocal key or value types
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-26 19:57:31 +02:00
Ashley Scopes bcbbe40ffd Reword Marker Javadoc to improve grammar.
Signed-off-by: Ashley Scopes <73482956+ascopes@users.noreply.github.com>
2022-09-25 16:05:27 +02:00
Ceki Gülcü 7686020c36
Merge pull request #310 from ascopes/patch-1
Add missing javadoc to SLF4JServiceProvider.java
2022-09-25 16:02:33 +02:00
Ashley Scopes 3f47f87ccc Add missing javadoc to SLF4JServiceProvider.java
Had to do some digging around the logback-classic alpha release for SLF4J2 API
integration to work out the nature of this behaviour. This should prevent confusion
for developers of other logging implementations in the future.

Signed-off-by: Ashley Scopes <73482956+ascopes@users.noreply.github.com>
2022-09-25 14:49:03 +01:00
Ceki Gulcu eb1710af7b start work on 2.0.3-SNAPSHOT, fix SLF4J-564 2022-09-21 23:17:52 +02:00
Ceki Gülcü bb49a5aeef
Merge pull request #307 from radio-rogal/slf4j-564-simple-logger-javadoc
[SLF4J-564] slf4j-simple: fix javadoc for SimpleLogger
2022-09-21 23:03:25 +02:00
Witalij Berdinskich 768ca7d4c0 [SLF4J-564] slf4j-simple: fix javadoc for SimpleLogger
Signed-off-by: Witalij Berdinskich <radio_rogal@keemail.me>
2022-09-21 22:40:56 +03:00
Ceki Gulcu 0645c18caf prepare release 2.0.2
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-20 21:36:11 +02:00
Ceki Gulcu 894b1890a0 fix SLF4J-563
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-20 20:44:05 +02:00
Ceki Gulcu 7c1d86e21e start work on 2.0.2-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-14 16:48:41 +02:00
Ceki Gulcu 9752442b6e prepare release 2.0.1
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-14 16:27:30 +02:00
Ceki Gulcu c0f7f16bfb minor javadoc change
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-14 16:06:16 +02:00
Ceki Gulcu 1148b98529 Merge branch 'master' of github.com:qos-ch/slf4j 2022-09-14 15:39:58 +02:00
Ceki Gulcu 593f89f85a fix SLF4J SLF4J-560
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-09-14 15:39:40 +02:00
Ceki Gülcü 03deea9f77
Merge pull request #302 from coheigea/coheigea/reload4j_1.2.22
Update reload4j to 1.2.22
2022-08-29 09:40:18 +02:00
Colm O hEigeartaigh c9d5cc1257
Update reload4j to 1.2.22 2022-08-29 08:02:12 +01:00
Ceki Gülcü bae56f544b
Merge pull request #294 from marcwrobel/fix-typos
fix typos in documentations
2022-08-25 21:35:07 +02:00
Marc Wrobel 24788ac731
fix typos in documentations
Fix typos in javadoc, comments and README.

Signed-off-by: Marc Wrobel <marc.wrobel@gmail.com>
2022-08-25 20:48:13 +02:00
Ceki Gulcu 05c0b0a881 fix SLF4J-555
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-23 22:42:13 +02:00
Ceki Gulcu 400a885e7d remove reference to 1.7
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-22 17:50:40 +02:00
Ceki Gulcu a4f165689f use https links
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-22 16:36:38 +02:00
Ceki Gulcu 4685f1ebc0 add reminder in release.sh
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-22 15:01:50 +02:00
Ceki Gulcu 15d4c1fdd6 fix path to codes.html
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-22 15:01:17 +02:00
Ceki Gulcu 42f863863f upodate gpg key information
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-20 21:56:31 +02:00
Ceki Gulcu 51ceaf6224 start work on 2.0.1-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-20 21:31:19 +02:00
Ceki Gulcu 0614d467d7 prepare release 2.0.0
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-20 21:04:05 +02:00
Ceki Gulcu b1afcd01b1 javadoc edits
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-07 00:04:53 +02:00
Ceki Gulcu 20cd3ad0ab start work on 2.0.0-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-07 00:04:28 +02:00
Ceki Gulcu aeebb6199d prepare release 2.0.0-beta1
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-06 23:31:54 +02:00
Ceki Gulcu 1068cd0eb9 javadoc changes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-06 23:25:49 +02:00
Ceki Gulcu 4e4e56a2df add CheckReturnValue annotation in org.slf4j.helpers
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-06 22:44:44 +02:00
Ceki Gulcu 0dcfa19040 check for return value in some oggingEventBuilder methods
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-06 22:03:35 +02:00
Ceki Gulcu e7ca8d17c8 start work on 2.0.0-beta1-SNAPSHOPT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-06 21:26:09 +02:00
Ceki Gulcu 2314de9dd9 add setMessage and log method to the fluent API
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-05 22:46:46 +02:00
Ceki Gulcu 508a796552 set version to 2.0.0-beta0
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-08-05 22:00:48 +02:00
Ceki Gulcu d93a5e0456 minor javadoc changes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-07-21 12:46:38 +02:00
Ceki Gülcü 43005d1d85
Merge pull request #293 from varunsh-coder/token-perms
ci: add GitHub token permissions for workflow
2022-07-21 12:42:02 +02:00
Varun Sharma 14ec670971 ci: add GitHub token permissions for workflow
Signed-off-by: Varun Sharma <varunsh@stepsecurity.io>
2022-07-10 07:17:58 -07:00
Ceki Gulcu c0001d4619 remove slf4j-site
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-06-15 20:31:10 +02:00
Ceki Gulcu 9feda2c795 remove slf4j-site
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-06-15 20:30:49 +02:00
Ceki Gulcu 287fe4f97a add closing double quote
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-06-14 17:01:39 +02:00
Ceki Gülcü 5537ff1699
Merge pull request #290 from ckbisk/patch-1
SLF4J-551: fix broken org/org Log4j link in left.js
2022-06-08 15:38:16 +02:00
Chad K Bisk 996866fae7
fix broken org/org Log4j link in left.js
https://jira.qos.ch/browse/SLF4J-551
2022-06-07 23:30:06 -04:00
Ceki Gulcu ae032b1297 remove infra information
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-05-27 17:50:14 +02:00
Ceki Gulcu 6afe5ab7a7 gpg password on a dedicated panel
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-05-27 17:34:30 +02:00
Ceki Gulcu 82a592ed79 info about keystore
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-05-17 18:49:07 +02:00
Ceki Gulcu e454d28282 deny history overwrite
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-05-11 12:02:06 +02:00
Ceki Gulcu db3835d392 add SECURITY.md
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-05-11 11:49:52 +02:00
Ceki Gulcu 61574d22f4 discussion header
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-05-11 10:47:13 +02:00
Ceki Gulcu 9dd3de0511 fix name of variable
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-05-05 20:36:48 +02:00
Ceki Gülcü 6701960a59
Merge pull request #287 from srt4/bugfix/SLF4J-549-update-event-recoding-logger-name
Update EventRecodingLogger name to EventRecordingLogger (SLF4J-549)
2022-05-05 19:43:00 +02:00
Spencer Thomas 98728180ac Update EventRecodingLogger name to EventRecordingLogger (SLF4J-549)
Signed-off-by: Spencer Thomas <srt4@uw.edu>
2022-05-05 10:20:39 -07:00
Ceki Gülcü ac854c79ea
Merge pull request #282 from tenghuanhe/patch-2
Fix minor typos in README.md
2022-04-14 18:42:02 +02:00
Tenghuan He 0c0eb1275d Fix minor typos in README.md
Signed-off-by: tenghuanhe <tenghuanhe@gmail.com>
2022-04-15 00:24:05 +08:00
Ceki Gülcü 2b0e15874a
Merge pull request #249 from gnp/master
Fix typo: "apllications" --> "applications"
2022-04-05 20:10:11 +02:00
Ceki Gülcü 045f502fa9
Merge pull request #281 from josephw/typo-in-reload4j-logger-adapter-variable-name
Fix typo abbreviation for fully-qualified class name.
2022-04-02 21:56:18 +02:00
Joseph Walton a188a3ed73 Fix typo abbreviation for fully-qualified class name.
Signed-off-by: Joseph Walton <joe@kafsemo.org>
2022-04-01 22:02:23 +11:00
Ceki Gulcu 23182d4468 delete unused import
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-03-30 20:36:13 +02:00
Ceki Gulcu aa0de34dc6 start work on 2.0.0-alpha8
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-03-17 20:45:02 +01:00
Ceki Gulcu 5c4fe1d48c minor edits
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-03-17 20:40:33 +01:00
Ceki Gulcu 90f3f1ea07 update news about release 2.0.0-alpha7
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-03-17 20:34:10 +01:00
Ceki Gulcu 5fcbb283a3 slf4j-log4j12 relocated, prepare release 2.0.0-alpha7
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-03-17 18:38:36 +01:00
Ceki Gulcu 956acb06d6 add info about version99.qos.ch going away at the end of the year
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-03-17 17:03:38 +01:00
Ceki Gulcu 6df6053c24 caller data extraction support - SLF4J-511
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-03-09 23:08:54 +01:00
Ceki Gulcu 74ccf20fab typo fixes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-02-28 21:23:39 +01:00
Ceki Gulcu 8806a45ede doc edits
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-02-18 11:22:44 +01:00
Ceki Gulcu 2287768293 fix SLF4J-541
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-02-08 14:39:04 +01:00
Ceki Gulcu bef80280e6 add sponsorship request to header
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-26 20:50:23 +01:00
Ceki Gulcu c1282ba08c update stable versions
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-25 15:39:50 +01:00
Ceki Gulcu 81a0568d68 update docs
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-25 15:38:35 +01:00
Ceki Gulcu f04cf16b66 fix comments, less bragging
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-24 00:07:40 +01:00
Ceki Gulcu c69570fc51 mvn install seems to work better
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-17 23:37:27 +01:00
Ceki Gulcu 85541d5669 try maven package
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-17 23:33:05 +01:00
Ceki Gulcu 4835381767 try maven install
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-17 23:23:13 +01:00
Ceki Gulcu c9c5492ded add test in relation with LOGBACK-1612
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-17 22:21:52 +01:00
Ceki Gulcu 510cc99e37 try using JDK 11 and 17
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-17 22:20:13 +01:00
Ceki Gulcu a20a22299d github actions
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-17 22:17:23 +01:00
Ceki Gulcu 2d6b6344f0 doc edit
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-17 22:16:29 +01:00
Ceki Gulcu 16ab482cab added paragraph on JEP264, doc changes, minor refactoring
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-17 22:11:33 +01:00
Ceki Gulcu 39a07b9ce4 make VersionUtil more robust
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-14 16:42:33 +01:00
Ceki Gulcu 10bd70ca75 start work on 2.0.0-alpha7-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-13 17:01:39 +01:00
Ceki Gulcu 66e9c2555f prepare release 2.0.0-alpa6
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-13 16:56:49 +01:00
Ceki Gulcu 28528094b9 mentioned reload4j in the docs
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-13 16:27:04 +01:00
Ceki Gulcu 6abaf6897b rename slf4j-reload4j classes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-13 16:26:36 +01:00
Ceki Gulcu 39cf0fc837 fix SimpleLogger javadoc comment
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-13 16:25:23 +01:00
Ceki Gulcu 0e04efdbf6 add slf4j-reload4j module
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-13 15:21:26 +01:00
Ceki Gulcu 0d4167abe7 fix SLF4J-499
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-13 15:19:10 +01:00
ceki 60e70fbc83 Fix SLF4J-499 - log thread id in SimpleLogger 2022-01-13 11:55:50 +01:00
Ceki Gulcu 9e4a358634 Merge branch 'master' of github.com:qos-ch/slf4j 2022-01-12 22:43:15 +01:00
Ceki Gulcu f6076c1409 mention reload4j in log4Shell.html
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-12 22:42:52 +01:00
Ceki Gülcü 34547b2f32
Merge pull request #276 from japzio/japzio-patch-doc-typo
minor typo fix
2022-01-10 11:07:33 +01:00
Jasper C ea47492d7a typo
Signed-off-by: Jasper C <jculongit10@gmail.com>
2022-01-10 16:08:50 +08:00
Ceki Gulcu f09e33dd15 add support for keyed deques in MDC
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-05 22:11:03 +01:00
Ceki Gulcu 12b5a6b676 mvn compile in slf4j-site should copy images
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-05 22:09:59 +01:00
Ceki Gulcu 23c8cc0121 fix SubstitutableLoggerTest
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-05 22:09:05 +01:00
Ceki Gulcu 0877cb6410 add github sponsors link
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-04 18:32:23 +01:00
Ceki Gulcu 7144b50915 add FUNDING.yml file
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-04 15:03:13 +01:00
Ceki Gulcu 0e8713e1eb minor doc changes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-02 23:30:41 +01:00
Ceki Gulcu 62a265d3c5 add keyedStack interface to MDC - SLF4J-531
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2022-01-02 23:26:23 +01:00
Ceki Gulcu 59100d75e1 add atLevel method to SubstituteLogger
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-24 11:39:21 +01:00
Ceki Gulcu b655c0a2b7 site updates
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-24 11:38:28 +01:00
Ceki Gulcu 6208cbbded site updates
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-24 11:37:18 +01:00
Ceki Gulcu 7c62cf8254 added atLevel method to Logger
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-16 18:25:14 +01:00
Ceki Gulcu c61f01783a added at() as an alias for makeLoggingEventBuilder()
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-16 00:56:42 +01:00
Ceki Gulcu ce15e71dd8 less drama 2021-12-15 08:51:26 +01:00
Ceki Gulcu c6ea154309 doc fixes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-14 17:51:11 +01:00
Ceki Gulcu 2a9bcb15e0 doc fixes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-14 17:17:33 +01:00
Ceki Gulcu 53a9833a3c read only access
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-13 20:16:44 +01:00
Ceki Gulcu 71d5c081e8 typo fixes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-13 14:23:45 +01:00
Ceki Gulcu 81d57c271b doc changes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-13 14:06:04 +01:00
Ceki Gulcu 65524de79a AS IS with no warranty
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-13 13:49:59 +01:00
Ceki Gulcu 45fbb1ebc8 css improvements
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-13 01:00:02 +01:00
Ceki Gulcu 7a68675fc6 updates to log4shell comments
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-12 00:39:53 +01:00
Ceki Gulcu 25ddfaaab0 comments on CVE-2021-44228
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-12-11 17:20:02 +01:00
Ceki Gulcu 98f1f2f465 fix typo in version name
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-09-27 23:23:14 +02:00
Ceki Gulcu cf09b2e34d Class.getPackageName is new to JDK 9
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-09-08 17:28:33 +02:00
Ceki Gulcu 1cea7b72e3 removed link to instructions for contributors
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-09-05 13:20:05 +02:00
Ceki Gulcu 50a68fe8cc tinkering with right.js
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-09-03 20:24:42 +02:00
Ceki Gulcu 6f0c54caa4 add jquery to pages
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-09-03 19:34:45 +02:00
Ceki Gulcu 590434e55f start work on 2.0.0-alpha6-SNAPSNOT 2021-08-30 21:38:21 +02:00
Ceki Gulcu 545755c2b7 bump junit version, remove unused repo reference 2021-08-30 21:36:34 +02:00
Ceki Gulcu 0a34a87495 preparing release of 2.0.0-alpha5
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-30 18:02:34 +02:00
Ceki Gulcu 252593b934 news update in relation with 2.0.0-alpha5
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-30 18:01:02 +02:00
Ceki Gulcu 43bcc961a2
Merge pull request #266 from dfa1/master
minor code cleanups
2021-08-30 17:05:50 +02:00
Ceki Gulcu f8bb0da47b
Merge branch 'master' into master 2021-08-30 17:05:18 +02:00
Ceki Gulcu 1d4535ad23 rename SLF4JPlarformLogger as SLF4JPlatformLogger
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-30 16:58:30 +02:00
Ceki Gulcu baadb61681 attempting to check for incorrect info META-INF/services/
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-30 15:11:36 +02:00
Ceki Gulcu 41b612d150 updates to faq
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-30 14:46:06 +02:00
Davide Angelocola 6e784e4ca3 minor code cleanups
- more private final fields
- avoiding C-style array declarations
- few typos, notably JPlarformLogger -> JPlatformLogger

Signed-off-by: Davide Angelocola <davide.angelocola@gmail.com>
2021-08-29 19:40:02 +02:00
Ceki Gulcu b977791f50
Merge pull request #265 from nipafx/patch-1
Fix platform logging service registration
2021-08-29 15:04:55 +02:00
Nicolai Parlog 4672a6fd52
Fix platform logging service registration
Related to #232 and SLF4J-442[1].

[1]: https://jira.qos.ch/browse/SLF4J-442
2021-08-29 11:23:57 +02:00
Ceki Gulcu d0836be06f
Merge pull request #264 from dfa1/master
upgrading code to Java 8
2021-08-27 01:16:43 +02:00
Davide Angelocola c7d79d86a9 upgrading code to Java 8
- for each
- diamond operator
- some typos

Signed-off-by: Davide Angelocola <davide.angelocola@gmail.com>
2021-08-25 19:52:31 +02:00
Ceki Gulcu 9bc0152371 doc changes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-16 16:13:05 +02:00
Ceki Gulcu 21af69f3eb add travis build cache
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-16 16:12:45 +02:00
Ceki Gulcu 55357d2270 doc changes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-15 10:09:12 +02:00
Ceki Gulcu 66aed4dfb1 javadoc fix
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-13 14:41:53 +02:00
Ceki Gulcu ccbd8f8c96 start work on 2.0.0-alpha5-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-12 23:47:02 +02:00
Ceki Gulcu 7836be3be5 minor last minute fixes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-12 23:20:04 +02:00
Ceki Gulcu c2e02170bb preparing 2.0.0-alpha4 release
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-12 22:34:32 +02:00
Ceki Gulcu e240abe9b1 testing caller info extraction with slf4j-jpl
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-12 22:28:39 +02:00
Ceki Gulcu eaa9fae39d ongoing work on the slf4j-jdk-platform-logging 2021-08-12 13:05:04 +02:00
Ceki Gulcu a42ad1f4f7 ongoing work on the slf4j-jdk-platform-logging module
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-11 17:09:18 +02:00
Ceki Gulcu e0448ad699 minor tweaks transparent to users
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-11 13:49:45 +02:00
Ceki Gulcu cc8e690ee8 initial version of PlatformLoggingTest
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 23:03:23 +02:00
Ceki Gulcu 4083b3dd0f Merge branch 'master' of github.com:qos-ch/slf4j
In relation with PR 232
2021-08-10 19:56:16 +02:00
Ceki Gulcu 1754a89208 start work on 2.0.0-alpha4-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu d6c2ddbe89 latest stable is 1.7.32
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 551283ba4c prepare release 2.0.0-alpha3
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu c0bacabab2 updated build-helper plugin version, removed lifecycle plugin
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 2d3e9f7d2b release 2.0.0-alpha3 notes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu e6d5d12c03 add toString method in KeyValuePair
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 5958599ca9 make fields protected in DefaultLoggingEventBuilder
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 66dda1a323 in DefaultLoggingEventBuilder renamde innerLog to log
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 280129046e very minor changes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu cf4d011ac0 simplify compilation directives
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 8d5df5a41c move test to test packages
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu fc66b1fc68 correct path for NOPServiceProvider
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 316e59084d rename org/slf4j/helpers/NOPServiceProvider as NOP_FallbackServiceProvider
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 7483a11dd6 fix SLF4J-516
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu 47e751d63c make CONFIG_PARAMS aa final field
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:16 +02:00
Ceki Gulcu fb1929011f version should have a SNAPSHOT suffix at this stage
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 5b3e70a353 align with changes in the 1.7 branch
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 19d037f11a blurb about SLF4J-515
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 75f6c0b2f9 fixing SLF4J-515
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 5a0eba57e5 allow unit tests to run in a new thread
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 3321b220b8 add info for verifying signed artifacts
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu b682787a2e start work on 2.0.0-alpha3
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 252fbffede allow slf4j-site to build
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 8601beed76 prepare release 2.0.0-alpha2
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 8571f5d7f2 removing unused file
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 62d6497f6a fix unit tests
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu b5446d67bb blurb on DCO
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 8f602c309a testing sign-off hook
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 04f3d418d1 testing sign-off hook 2021-08-10 19:54:15 +02:00
Ceki Gulcu 8859a8a019 edits
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 19:54:15 +02:00
Ceki Gulcu 0ae15e3981 document DCO requirement 2021-08-10 19:54:14 +02:00
Ceki Gulcu c233c86457 typo fixes and minor edits 2021-08-10 19:54:14 +02:00
Ceki Gulcu e74699276b Fix SLF4J-414 2021-08-10 19:54:14 +02:00
Ceki Gulcu 65eacb35a8 Fix SLF4J-421 and SLF4J-287 2021-08-10 19:54:14 +02:00
Ceki Gulcu 3e0016d8d1 add JMPS module names in FAQ (fixes SLF4J-465), other edits 2021-08-10 19:54:14 +02:00
Ceki Gulcu 601405b76f fix bugs detected by SubstituteLoggerTest 2021-08-10 19:54:14 +02:00
Ceki Gulcu 10d78b04d6 fix SLF4J-435 2021-08-10 19:54:14 +02:00
Ceki Gulcu 7547d1c871 add isEnabledForLevel method in Logger 2021-08-10 19:54:14 +02:00
Ceki Gulcu 45b177c2d2 make NOPLoggingEventBuilder constructor private and allow access via the singleton 2021-08-10 19:54:14 +02:00
Ceki Gulcu 730ee35665 removed unused NOPLogger, NOPLoggerFactory and NOPMDCAdapter from slf4j-nop module, these were moved to slf4j-a4j-ap-api module 2021-08-10 19:54:14 +02:00
Ceki Gulcu 3afcb8e8c4 formatting changes only. applied slf4j/codeStyle.xml in Eclipse 2021-08-10 19:54:14 +02:00
Ceki Gulcu 8a83b1bd34 cleaning up deprecated usage 2021-08-10 19:54:14 +02:00
Ceki Gulcu 4cd41f799d upgade plugin versions, clean up 2021-08-10 19:54:13 +02:00
Ceki Gulcu 9558b2103e the second -jar- goal is redundant 2021-08-10 19:54:13 +02:00
Ceki Gulcu a1683d9323 formatting changes only 2021-08-10 19:54:13 +02:00
Ceki Gulcu da6b46d8d7 stable version is 1.7.31 2021-08-10 19:54:13 +02:00
Ceki Gulcu 092d527971 keep highlighted info for 2.0.0-alpha0 2021-08-10 19:54:13 +02:00
Ceki Gulcu 153a6cabda minimal version is 8 2021-08-10 19:54:13 +02:00
Ceki Gulcu 494bd9aee9 minor doc changes 2021-08-10 19:54:13 +02:00
Ceki Gulcu 1600611850 fix SLF4J-514 2021-08-10 19:54:13 +02:00
Ceki Gulcu b56a878bc2 fix SLF4J-514 2021-08-10 19:54:13 +02:00
Ceki Gulcu 865c88e340 slightly higher tolerance 2021-08-10 19:54:13 +02:00
Ceki Gulcu 91eb61c3c9 news blurb about SLF4J-497 2021-08-10 19:54:13 +02:00
Ceki Gulcu 63ac275a5f unused imports 2021-08-10 19:54:13 +02:00
Ceki Gulcu ccce832b8f fix SLF4J-485, LoggingEventBuilder addArgument() should take Supplier<?>, not Supplier<Object> 2021-08-10 19:54:13 +02:00
Ceki Gulcu b38727956d formatting changes only 2021-08-10 19:54:13 +02:00
Ceki Gulcu 0b1d536e04 formatting changes only 2021-08-10 19:54:13 +02:00
Ceki Gulcu 6359e55d52 formatting changes only 2021-08-10 19:54:12 +02:00
Ceki Gulcu 4c1b6832f6 formatting and minor cleanup 2021-08-10 19:54:12 +02:00
Ceki Gulcu a9d4187fad news update 2021-08-10 19:54:12 +02:00
Ceki Gulcu 03c37619d5 fix SLF4J-511 2021-08-10 19:54:12 +02:00
Ceki Gulcu 6a09a76bb6 rename private method 2021-08-10 19:54:12 +02:00
Antonio Tomac 4a11208ae4 Avoid potentially "expensive" rendering of message Object to String when log level is disabled SLF4J-497 2021-08-10 19:54:12 +02:00
Ceki Gulcu 65009d8e62 minor doc fix 2021-08-10 19:54:12 +02:00
Ceki Gulcu 2f1ccdddae fix SLF4J-511 for j.u.l 2021-08-10 19:54:12 +02:00
Ceki Gulcu a739d541a5 minor edit 2021-08-10 19:54:12 +02:00
Ceki Gulcu 76cc29cb47 update link to Maven central 2021-08-10 19:54:12 +02:00
Ceki Gulcu 230573ab10 news about 1.7.30 2021-08-10 19:54:12 +02:00
Ceki Gulcu b0e3ad34f4 minor refactoring, docs 2021-08-10 19:54:12 +02:00
David Harsha a0319ce725 Fix NOP fallback memory leak
Substitute loggers are not getting "fixed" when no SLF4J provider is
found, which means `SUBST_PROVIDER` will add messages to its
`LinkedBlockingQueue` until the process runs out of memory.

`NoBindingMultithreadedInitializationTest` doesn't contain any
assertions of its own because `MultithreadedInitializationTest` already
asserts loggers are fixed in `assertAllSubstLoggersAreFixed`.

https://jira.qos.ch/browse/SLF4J-469
2021-08-10 19:54:12 +02:00
Ceki Gulcu 78b1f19a64 latest stable is 1.7.29 2021-08-10 19:54:12 +02:00
Björn Kautler 2d3c03622e Make slf4j with java.util.ServiceLoader properly work in OSGi by using the Service Loader Mediator Specification 2021-08-10 19:54:12 +02:00
Ceki Gulcu 6719babbce minor edit 2021-08-10 19:54:11 +02:00
Ceki Gulcu 17528421bf fix SLF4J-475 2021-08-10 19:54:11 +02:00
Ceki Gulcu 6ec50c7b47 minor javadoc edits 2021-08-10 19:54:11 +02:00
Ceki Gulcu ce640dbce2 skip assembly 2021-08-10 19:54:11 +02:00
Ceki Gulcu fbadf47724 updated redirect.html 2021-08-10 19:54:11 +02:00
Ceki Gulcu d779d080e4 don't put on Maven Central 2021-08-10 19:54:11 +02:00
Hervé Boutemy ec75e2b0f3 this module is Apache 2.0 licensed 2021-08-10 19:54:11 +02:00
Ceki Gulcu d03c5fe016 add redirect.html to src control 2021-08-10 19:54:11 +02:00
Ceki Gulcu 9213667ba2 remove link to tar.gz or zip distributions 2021-08-10 19:54:11 +02:00
Ceki Gulcu 8ee427d6bb document release info for 2.0-alpha1 2021-08-10 19:54:11 +02:00
Ceki Gulcu ed1ffb325a start work on 2.0.0-alpha2-SNAPSHOT 2021-08-10 19:54:11 +02:00
Ceki Gulcu fdf496daf2 version 2.0.0-alpha1 2021-08-10 19:54:11 +02:00
Ceki Gulcu 7fbe973ad9 have slf4j log markers and key-value pairs by default 2021-08-10 19:54:11 +02:00
Ceki Gulcu 13736433b1 makeLoggingEventBuilder made public 2021-08-10 19:54:11 +02:00
Ceki Gulcu c81f6cfdbd cosmetic changes 2021-08-10 19:54:11 +02:00
Ceki Gulcu 7202302537 fix test 2021-08-10 19:54:10 +02:00
Ceki Gulcu 6eaeb0f6af 'fix build, other changes 2021-08-10 19:54:10 +02:00
Ceki Gulcu a9f84d58b3 API consolidation 2021-08-10 19:54:10 +02:00
Ceki Gulcu c1c8d21bc4 minor edits 2021-08-10 19:54:10 +02:00
Sebastian Schuberth 854d6fbf79 Fix the SCM connection URL in pom.xml
The "connection" should be an URL valid for read-only access and has to follow
the syntax as described at https://maven.apache.org/pom.html#SCM.
2021-08-10 19:54:10 +02:00
Wessel van Norel a35c1d331d Fix the build and a typo 2021-08-10 19:54:10 +02:00
Ceki Gulcu ea8da7fedd refactored EventRecodingLogger and EventRecodingLoggerTest 2021-08-10 19:54:10 +02:00
Ceki Gulcu 7e6e3d1f24 move methods from Util back to MessageFormatter 2021-08-10 19:54:10 +02:00
Wessel van Norel 176e067fb9 SLF4j-466: if was missing a space 2021-08-10 19:54:10 +02:00
Wessel van Norel 1238dbcb0b SLF4j-466: fixed typo in javadoc 2021-08-10 19:54:10 +02:00
Wessel van Norel 1df318d08a SLF4j-466: added missing newline at end of file 2021-08-10 19:54:10 +02:00
Wessel van Norel 315a95824b SLF4j-466: only call arraycopy if we have elements to copy 2021-08-10 19:54:10 +02:00
Wessel van Norel 21c1be85ab SLF4j-466: put the throwable at the right place of the SubstituteLoggingEvent, introduced two more recordEvent methods for the two object argument log statements 2021-08-10 19:54:10 +02:00
Wessel van Norel 7af8f7e2f4 SLF4j-466: Move two methods from MessageFormatter to Util so they can be used by the EventRecordingLogger as well 2021-08-10 19:54:09 +02:00
Wessel van Norel 50eec4afd6 SLF4j-466: add missing marker in one of the warn methods 2021-08-10 19:54:09 +02:00
Wessel van Norel 1cd31dc9bb SLF4j-466: Add test for all happy flow cases 2021-08-10 19:54:09 +02:00
Wessel van Norel 3a06ff0b19 Change the java indent from 2 to 4. 2021-08-10 19:54:09 +02:00
Ceki Gulcu f9b0656ad8 1.7.28 notes 2021-08-10 19:54:09 +02:00
Ceki Gulcu 01340b2bcf typo fix 2021-08-10 19:54:09 +02:00
Ceki Gulcu 9ce38e487b update to README.md 2021-08-10 19:54:09 +02:00
Ceki Gulcu a73b744853 misplaced test class 2021-08-10 19:54:09 +02:00
Ceki Gulcu cebdf810d6 misplaced test class 2021-08-10 19:54:09 +02:00
Ceki Gulcu 21be0bccef minor edit 2021-08-10 19:54:09 +02:00
Ceki Gulcu df48717c87 fix SLF4J-463 2021-08-10 19:54:09 +02:00
Ceki Gulcu 334ef9a266 update 1,7,27 release information 2021-08-10 19:54:09 +02:00
Ceki Gulcu a0030b6e6a allow SubstitutableLoggerTest to pass 2021-08-10 19:54:09 +02:00
Ceki Gulcu e108a279c7 bump version 2021-08-10 19:54:09 +02:00
Ceki Gulcu 5f45225565 refactor EventBuilder construction 2021-08-10 19:54:08 +02:00
Artsiom Chapialiou efeb3665c1 fix JavaDoc typo 2021-08-10 19:54:08 +02:00
Ceki Gulcu 456e8a8841 ongoing doc improvements 2021-08-10 19:54:08 +02:00
Ceki Gulcu 383f008a05 doc fixes 2021-08-10 19:54:08 +02:00
Ceki Gulcu 6f1583fb01 document fluent api 2021-08-10 19:54:08 +02:00
Ceki Gulcu 69338e78f3 documentating fluent api 2021-08-10 19:54:08 +02:00
Ceki Gulcu f0674e9648 attempt to fix slf4j-migrator Maven Central upload issue 2021-08-10 19:54:08 +02:00
Nicolai Parlog 3c4b29b061 Relax service discovery in test 2021-08-10 19:46:32 +02:00
Nicolai Parlog fa20cc51be Ensure `ResourceBundle::getString` can't crash program 2021-08-10 19:46:32 +02:00
Nicolai Parlog 258caf4a61 Polish 2021-08-10 19:46:32 +02:00
Nicolai Parlog b67dabb03d Set up testing 2021-08-10 19:46:32 +02:00
Nicolai Parlog e2f0fca4ad Add service provider-configuration file for use on class path 2021-08-10 19:46:32 +02:00
Nicolai Parlog 1d4daa1c53 Import proof of concept 2021-08-10 19:46:32 +02:00
Nicolai Parlog 8c2ee1378e Create project structure 2021-08-10 19:46:32 +02:00
Ceki Gulcu 877817a5a3 start work on 2.0.0-alpha4-SNAPSHOT
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 16:09:37 +02:00
Ceki Gulcu 8eea071d3e latest stable is 1.7.32
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 15:55:43 +02:00
Ceki Gulcu 11d5b0bd8d prepare release 2.0.0-alpha3
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 15:53:40 +02:00
Ceki Gulcu caa81d7368 updated build-helper plugin version, removed lifecycle plugin
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 15:53:16 +02:00
Ceki Gulcu 2dc0cd2b32 release 2.0.0-alpha3 notes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 15:41:51 +02:00
Ceki Gulcu ba8506c47b add toString method in KeyValuePair
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 14:37:32 +02:00
Ceki Gulcu 947654aa64 make fields protected in DefaultLoggingEventBuilder
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-10 14:36:40 +02:00
Ceki Gulcu 9df53fb968 in DefaultLoggingEventBuilder renamde innerLog to log
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-09 17:47:44 +02:00
Ceki Gulcu c87ac7bb29 very minor changes
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-09 15:11:43 +02:00
Ceki Gulcu a1c763e6e1 simplify compilation directives
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-08-01 21:34:11 +02:00
Ceki Gulcu 5f6f92a8d1 move test to test packages
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-31 22:27:04 +02:00
Ceki Gulcu bb1ca6886a correct path for NOPServiceProvider
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-31 22:26:35 +02:00
Ceki Gulcu 975a9a1e7e rename org/slf4j/helpers/NOPServiceProvider as NOP_FallbackServiceProvider
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-11 07:08:08 +02:00
Ceki Gulcu 3e2381ea69 fix SLF4J-516
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-11 07:00:09 +02:00
Ceki Gulcu edb09d7ffa make CONFIG_PARAMS aa final field
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-09 22:56:53 +02:00
Ceki Gulcu f91024f676 version should have a SNAPSHOT suffix at this stage
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-09 10:16:01 +02:00
Ceki Gulcu 28e07908a2 align with changes in the 1.7 branch
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-09 10:12:49 +02:00
Ceki Gulcu 6a61c433ee blurb about SLF4J-515
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-08 23:28:38 +02:00
Ceki Gulcu 50e1c635d5 fixing SLF4J-515
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-08 23:24:30 +02:00
Ceki Gulcu 36e39dd0cf allow unit tests to run in a new thread
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-08 19:55:53 +02:00
Ceki Gulcu 666533989a add info for verifying signed artifacts
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-08 15:55:03 +02:00
Ceki Gulcu 39e3b81e5e start work on 2.0.0-alpha3
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-02 17:03:34 +02:00
Ceki Gulcu 3f4d3d91f3 allow slf4j-site to build
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-02 16:52:58 +02:00
Ceki Gulcu 81b95ab868 prepare release 2.0.0-alpha2
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-02 16:43:17 +02:00
Ceki Gulcu 2c914492fd removing unused file
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-02 16:23:48 +02:00
Ceki Gulcu ff4a3a438e fix unit tests
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-02 16:23:17 +02:00
Ceki Gulcu 15e1e7704b blurb on DCO
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-02 14:08:37 +02:00
Ceki Gulcu 6a06d84243 testing sign-off hook
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-02 13:25:41 +02:00
Ceki Gulcu a9caf3ee3c testing sign-off hook 2021-07-02 13:24:48 +02:00
Ceki Gulcu 280335bf14 edits
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
2021-07-02 00:21:14 +02:00
Ceki Gulcu f9c4dcd1dd document DCO requirement 2021-07-02 00:19:53 +02:00
Ceki Gulcu dd2bb115b0 typo fixes and minor edits 2021-07-01 23:26:31 +02:00
Ceki Gulcu d7786eafa7 Fix SLF4J-414 2021-07-01 22:37:39 +02:00
Ceki Gulcu 684dfca280 Fix SLF4J-421 and SLF4J-287 2021-07-01 21:32:31 +02:00
Ceki Gulcu 05486b909a add JMPS module names in FAQ (fixes SLF4J-465), other edits 2021-07-01 11:02:24 +02:00
Ceki Gulcu 86e45d7728 fix bugs detected by SubstituteLoggerTest 2021-07-01 10:03:25 +02:00
Ceki Gulcu b4b2f6fef7 fix SLF4J-435 2021-06-29 23:13:52 +02:00
Ceki Gulcu 49831a3f06 add isEnabledForLevel method in Logger 2021-06-29 22:40:14 +02:00
Ceki Gulcu 49356a792a make NOPLoggingEventBuilder constructor private and allow access via the singleton 2021-06-29 22:39:30 +02:00
Ceki Gulcu 3d01cc2ca3 removed unused NOPLogger, NOPLoggerFactory and NOPMDCAdapter from slf4j-nop module, these were moved to slf4j-a4j-ap-api module 2021-06-29 22:05:53 +02:00
Ceki Gulcu 61220a8b42 formatting changes only. applied slf4j/codeStyle.xml in Eclipse 2021-06-29 20:11:52 +02:00
Ceki Gulcu be3007c6cd cleaning up deprecated usage 2021-06-29 17:25:21 +02:00
Ceki Gulcu 9e9a64bcb6 upgade plugin versions, clean up 2021-06-29 15:33:27 +02:00
Ceki Gulcu 854ce8aa7d the second -jar- goal is redundant 2021-06-29 15:29:49 +02:00
Ceki Gulcu 7b753d69b0 Merge branch 'master' of github.com:qos-ch/slf4j 2021-06-29 15:09:44 +02:00
Ceki Gulcu 5c586f1192 slightly higher tolerance 2021-06-29 15:08:55 +02:00
Ceki Gulcu 17e73cee3a formatting changes only 2021-06-19 18:52:57 +02:00
Ceki Gulcu 990b508703 stable version is 1.7.31 2021-06-19 10:27:56 +02:00
Ceki Gulcu cb4ac02d7b keep highlighted info for 2.0.0-alpha0 2021-06-19 10:25:15 +02:00
Ceki Gulcu 92d20a66be minimal version is 8 2021-06-17 23:09:44 +02:00
Ceki Gulcu 6f23d94201 minor doc changes 2021-06-17 17:02:03 +02:00
Ceki Gulcu ba62fdc694 fix SLF4J-514 2021-06-17 10:52:38 +02:00
Ceki Gulcu 0ef8cb4721 fix SLF4J-514 2021-06-17 10:49:03 +02:00
Ceki Gulcu d0dad8aa38 news blurb about SLF4J-497 2021-06-16 00:48:11 +02:00
Ceki Gulcu 5c0f12afae unused imports 2021-06-16 00:29:08 +02:00
Ceki Gulcu 5fb5ecb98a fix SLF4J-485, LoggingEventBuilder addArgument() should take Supplier<?>, not Supplier<Object> 2021-06-16 00:28:32 +02:00
Ceki Gulcu a405c8db97 formatting changes only 2021-06-16 00:23:37 +02:00
Ceki Gulcu 82aca890f0 formatting changes only 2021-06-16 00:17:16 +02:00
Ceki Gulcu ade6380f1a formatting changes only 2021-06-16 00:14:39 +02:00
Ceki Gulcu 44371046e0 formatting and minor cleanup 2021-06-16 00:02:24 +02:00
Ceki Gulcu 3c927fa7ed news update 2021-06-15 23:59:31 +02:00
Ceki Gulcu 2d1d948c5e fix SLF4J-511 2021-06-15 23:51:03 +02:00
Ceki Gulcu c34960912a rename private method 2021-06-15 23:03:21 +02:00
Antonio Tomac 3e5110501c Avoid potentially "expensive" rendering of message Object to String when log level is disabled SLF4J-497 2021-06-15 11:59:32 +02:00
Ceki Gulcu 57a06aaa2c minor doc fix 2021-06-14 15:55:02 +02:00
Ceki Gulcu 61e879fa32 fix SLF4J-511 for j.u.l 2021-06-14 15:53:45 +02:00
gnp d8b223e379
Fix typo: "apllications" --> "applications" 2020-10-13 09:29:15 -07:00
Ceki Gulcu e2c29c81df minor edit 2020-02-24 10:28:51 +01:00
Ceki Gulcu 76ee1112e5 update link to Maven central 2020-01-19 08:48:56 +01:00
Ceki Gulcu 715b591185 news about 1.7.30 2019-12-20 16:27:47 +01:00
Ceki Gulcu 2ac2e807ea minor refactoring, docs 2019-12-10 09:17:29 +01:00
Ceki Gulcu 306d8fd23d
Merge pull request #228 from davishmcclurg/SLF4J-469
Fix NOP fallback memory leak
2019-12-10 08:51:02 +01:00
David Harsha 27358d395c Fix NOP fallback memory leak
Substitute loggers are not getting "fixed" when no SLF4J provider is
found, which means `SUBST_PROVIDER` will add messages to its
`LinkedBlockingQueue` until the process runs out of memory.

`NoBindingMultithreadedInitializationTest` doesn't contain any
assertions of its own because `MultithreadedInitializationTest` already
asserts loggers are fixed in `assertAllSubstLoggersAreFixed`.

https://jira.qos.ch/browse/SLF4J-469
2019-12-09 20:27:04 -08:00
Ceki Gulcu 9a3f1f4928 latest stable is 1.7.29 2019-11-04 19:15:33 +01:00
Ceki Gulcu 4a1d5194fe
Merge pull request #198 from Vampire/serviceloader-in-osgi
Make slf4j with java.util.ServiceLoader properly work in OSGi by using the Service Loader Mediator Specification
2019-10-17 11:48:48 +02:00
Ceki Gulcu 7c56fe22eb minor edit 2019-10-16 20:32:17 +02:00
Ceki Gulcu 043e9f2d6d fix SLF4J-475 2019-10-16 20:27:50 +02:00
Ceki Gulcu e00d9a145b minor javadoc edits 2019-10-13 18:10:39 +02:00
Ceki Gulcu 11bc6c56e3 skip assembly 2019-10-13 18:10:13 +02:00
Ceki Gulcu fd5c84fabc updated redirect.html 2019-10-13 18:04:37 +02:00
Ceki Gulcu 1f49dffdf3 don't put on Maven Central 2019-10-13 18:04:00 +02:00
Ceki Gulcu 78a2bf7352
Merge pull request #226 from hboutemy/master
this module is Apache 2.0 licensed
2019-10-13 17:54:42 +02:00
Hervé Boutemy a04a1f31cf this module is Apache 2.0 licensed 2019-10-13 17:28:33 +02:00
Ceki Gulcu 340b820478 add redirect.html to src control 2019-10-11 12:37:41 +02:00
Ceki Gulcu 33dc750730 remove link to tar.gz or zip distributions 2019-10-11 12:33:53 +02:00
Ceki Gulcu 8756e69497 document release info for 2.0-alpha1 2019-10-04 20:28:51 +02:00
Ceki Gulcu 233803688a start work on 2.0.0-alpha2-SNAPSHOT 2019-10-01 21:25:16 +02:00
Ceki Gulcu 0c1d72b602 version 2.0.0-alpha1 2019-10-01 21:22:21 +02:00
Ceki Gulcu a4010572cb have slf4j log markers and key-value pairs by default 2019-10-01 20:06:40 +02:00
Ceki Gulcu b726801a9b makeLoggingEventBuilder made public 2019-09-08 17:53:15 +02:00
Ceki Gulcu 80b7d224e8 cosmetic changes 2019-09-08 17:04:27 +02:00
Ceki Gulcu 0ae60630b5 fix test 2019-09-08 16:53:00 +02:00
Ceki Gulcu 112271b8f6 'fix build, other changes 2019-09-08 15:42:29 +02:00
Ceki Gulcu 93e9f097a1 API consolidation 2019-09-07 10:57:35 +02:00
Ceki Gulcu 6f217bbf63 minor edits 2019-08-19 22:01:52 +02:00
Ceki Gulcu 0d0f187b14
Merge pull request #178 from sschuberth/patch-1
Fix the SCM connection URL in pom.xml
2019-08-19 21:52:22 +02:00
Sebastian Schuberth c025afe536 Fix the SCM connection URL in pom.xml
The "connection" should be an URL valid for read-only access and has to follow
the syntax as described at https://maven.apache.org/pom.html#SCM.
2019-08-19 14:02:52 +02:00
Ceki Gulcu 32532107f5
Merge pull request #218 from delgurth/SLF4J-466-Fix-build
Fix the build and a typo
2019-08-14 00:06:04 +02:00
Wessel van Norel e757c41a57 Fix the build and a typo 2019-08-14 00:00:29 +02:00
Ceki Gulcu 78c10ee651 refactored EventRecodingLogger and EventRecodingLoggerTest 2019-08-13 17:30:17 +02:00
Ceki Gulcu 178e836f71 move methods from Util back to MessageFormatter 2019-08-13 15:38:32 +02:00
Ceki Gulcu 4ed24489fa
Merge pull request #215 from delgurth/SLF4J-466
Fixes SLF4J-466
2019-08-13 14:38:31 +02:00
Ceki Gulcu 8a5c449bd8
Merge pull request #217 from delgurth/fix-intellij-java-indent
Change the java indent from 2 to 4.
2019-08-12 18:04:24 +02:00
Wessel van Norel b266bb2937 Change the java indent from 2 to 4. 2019-08-12 17:46:11 +02:00
Wessel van Norel b0b57b9f9b SLF4j-466: if was missing a space 2019-08-12 17:40:47 +02:00
Wessel van Norel a98bd22216 SLF4j-466: fixed typo in javadoc 2019-08-12 16:49:37 +02:00
Wessel van Norel 587ec03af7 SLF4j-466: added missing newline at end of file 2019-08-12 16:42:41 +02:00
Wessel van Norel 7c3d35596f SLF4j-466: only call arraycopy if we have elements to copy 2019-08-12 16:40:13 +02:00
Wessel van Norel 9df5d4fe91 SLF4j-466: put the throwable at the right place of the SubstituteLoggingEvent, introduced two more recordEvent methods for the two object argument log statements 2019-08-12 16:14:37 +02:00
Wessel van Norel a09d788310 SLF4j-466: Move two methods from MessageFormatter to Util so they can be used by the EventRecordingLogger as well 2019-08-12 16:14:37 +02:00
Wessel van Norel b99ad9f80f SLF4j-466: add missing marker in one of the warn methods 2019-08-12 16:14:37 +02:00
Wessel van Norel fe440ce9cd SLF4j-466: Add test for all happy flow cases 2019-08-12 16:14:37 +02:00
Ceki Gulcu 206449b674 1.7.28 notes 2019-08-10 10:58:36 +02:00
Ceki Gulcu 173b06ad88 typo fix 2019-08-09 23:33:53 +02:00
Ceki Gulcu 999539196e update to README.md 2019-08-09 23:30:23 +02:00
Ceki Gulcu 9439356727 misplaced test class 2019-08-09 22:30:47 +02:00
Ceki Gulcu 96783aab43 misplaced test class 2019-08-09 22:30:23 +02:00
Ceki Gulcu e0a6d06fc0 minor edit 2019-08-09 14:51:04 +02:00
Ceki Gulcu acc915075b fix SLF4J-463 2019-08-09 14:47:48 +02:00
Ceki Gulcu d5074263f8 update 1,7,27 release information 2019-08-06 12:22:55 +02:00
Ceki Gulcu b05e7fe90d allow SubstitutableLoggerTest to pass 2019-07-28 18:25:07 +02:00
Ceki Gulcu a5eb9ce00c bump version 2019-07-28 17:18:22 +02:00
Ceki Gulcu fde8ca480c refactor EventBuilder construction 2019-07-28 17:13:08 +02:00
Ceki Gulcu 7533fde765
Merge pull request #210 from ArtsiomCh/patch-1
fix JavaDoc typo
2019-07-26 12:01:17 +02:00
Artsiom Chapialiou 83b88c502a
fix JavaDoc typo 2019-07-25 17:09:52 -04:00
Ceki Gulcu a5357c8d49 ongoing doc improvements 2019-06-14 13:11:01 +02:00
Ceki Gulcu f9c1d25113 doc fixes 2019-06-14 12:08:20 +02:00
Ceki Gulcu 4faf891b8a document fluent api 2019-06-14 02:06:42 +02:00
Ceki Gulcu 890fc5b0e6 documentating fluent api 2019-06-13 18:40:10 +02:00
Ceki Gulcu d3f50a9185 attempt to fix slf4j-migrator Maven Central upload issue 2019-06-13 01:19:32 +02:00
Ceki Gulcu 365edc7c32 actually uploadable build 2019-06-13 00:54:15 +02:00
Ceki Gulcu 669c550ab8 fix javadoc generation work 2019-06-13 00:34:57 +02:00
Ceki Gulcu 68c7c99adf more javadoc fixes 2019-06-12 22:23:14 +02:00
Ceki Gulcu c243bc6476 more javadoc fixes 2019-06-12 22:14:51 +02:00
Ceki Gulcu abad55509a javadoc fixes 2019-06-12 22:13:22 +02:00
Ceki Gulcu e52fb5ae15 ongoing work on fluent api 2019-06-12 21:07:41 +02:00
Ceki Gulcu d9690a131e fix notification adress 2019-05-05 17:25:17 +02:00
Ceki Gulcu 029eab1569 ongoing work 2019-05-02 14:50:35 +02:00
Ceki Gulcu 4d4ebb395e initial backward compatible implementation of fluent API 2019-04-29 22:35:08 +02:00
Ceki Gulcu c7b2218283 changes to the LoggingEvent interface 2019-04-29 21:29:13 +02:00
Ceki Gulcu 1f3b8726d1 ongoing work on fluent api 2019-04-28 23:49:20 +02:00
Ceki Gulcu 8c51d8ea7c mark pom as 2.0.0-alpha0-SNAPSHOT 2019-04-28 21:28:47 +02:00
Ceki Gulcu 8705978bb7 ongoing api changes 2019-04-28 13:38:25 +02:00
Ceki Gulcu 1cb6b26288 start 2.0.0-alpha0 2019-04-28 11:48:09 +02:00
Ceki Gulcu 875442057f very basic experimental version 2019-02-20 22:15:52 +01:00
Ceki Gulcu 905443f39f
Merge pull request #205 from rgansevles/master
Additional fix for SLF4J-449
2019-02-20 21:16:18 +01:00
Rob Gansevles abe7a7835c Additional fix for SLF4J-449 2019-02-20 20:44:41 +01:00
Ceki Gulcu 5ddfa9c6b3 tweak VII .travis.yml 2019-02-19 23:30:30 +01:00
Ceki Gulcu e2dc9174e8 tweak VI .travis.yml 2019-02-19 23:26:06 +01:00
Ceki Gulcu 08f378764a tweak V .travis.yml 2019-02-19 23:24:47 +01:00
Ceki Gulcu 51be1dfe0b tweak IV .travis.yml 2019-02-19 23:15:35 +01:00
Ceki Gulcu a9b3d222c4 tweak III .travis.yml 2019-02-19 23:13:02 +01:00
Ceki Gulcu f7c0d367dc tweak II .travis.yml 2019-02-19 23:09:16 +01:00
Ceki Gulcu 6b65bbd86b tweak .travis.yml 2019-02-19 23:05:15 +01:00
Ceki Gulcu 91a30c8967 remove toolchain dependency to simplify build, make travis happy 2019-02-19 22:53:59 +01:00
Ceki Gulcu 379d96b304 upgrade Travus build to JDK 11 2019-02-19 22:39:37 +01:00
Ceki Gulcu 9928d80daf SLF4J-445 2019-02-19 22:38:04 +01:00
Ceki Gulcu 458525e2e1 fix SLF4J-449 2019-02-19 21:15:32 +01:00
Ceki Gulcu 603ae2cb22 SLF4J-439 2019-02-19 21:00:18 +01:00
Ceki Gulcu a822fd7615 fixed SLF4J-233 2019-02-19 20:52:40 +01:00
Ceki Gulcu fc7bf4dee4 maven build without warnings 2019-02-19 19:24:01 +01:00
Ceki Gulcu 7092ce68af start work on 1.8.0-beta5 2019-02-19 18:43:24 +01:00
Björn Kautler acf62ef1cf Make slf4j with java.util.ServiceLoader properly work in OSGi by using the Service Loader Mediator Specification 2018-05-18 15:38:40 +02:00
344 changed files with 8953 additions and 13436 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
tidelift: maven/org.slf4j:slf4j-api
github: qos-ch

47
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: CI
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners
concurrency:
# On master/release, we don't want any jobs cancelled so the sha is used to name the group
# On PR branches, we cancel the job if new commits are pushed
# More info: https://stackoverflow.com/a/68422069/253468
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) }}
cancel-in-progress: true
permissions:
contents: read
jobs:
Test:
name: JDK ${{ matrix.jdk }}, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
jdk: [11, 17, 19]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: true
max-parallel: 4
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 50
- name: Set up Java ${{ matrix.jdk }}
if: ${{ matrix.jdk != '8' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk }}
- name: Install
# download dependencies, etc, so test log looks better
run: mvn -B install

12
.github/workflows/toolchains.xml vendored Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
</provides>
<configuration>
<jdkHome>${env.JAVA_HOME_8}</jdkHome>
</configuration>
</toolchain>
</toolchains>

View File

@ -31,8 +31,8 @@
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
<option name="KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">

View File

@ -1,7 +1,21 @@
dist: trusty
language: java
jdk:
- oraclejdk9
- oraclejdk11
notifications:
email:
- notification@qos.ch
install: /bin/true
script:
- mvn clean
- mvn install
cache:
directories:
- $HOME/.m2

1
FUNDING.yml Normal file
View File

@ -0,0 +1 @@
github: qos-ch

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2017 QOS.ch
Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland)
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining

View File

@ -1,14 +1,69 @@
# About SLF4J
The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.
The Simple Logging Facade for Java (SLF4J) serves as a simple facade
or abstraction for various logging frameworks (e.g. java.util.logging,
logback, reload4j, log4j 2.x, logevents, penna, rainbowgum, tinylog)
allowing the end user to plug in the desired logging framework at
deployment time.
More information can be found on the [SLF4J website](http://www.slf4j.org).
# Build Status
[![Build Status](https://travis-ci.org/qos-ch/slf4j.svg)](https://travis-ci.org/qos-ch/slf4j)
# Search org.slf4j artifacts on Maven Central
[![Maven Central](https://img.shields.io/badge/Search%20org%2Eslf4j%20artifacts%20on%20Maven%20Central-2.0.x-green)](https://central.sonatype.com/search?namespace=org.slf4j)
# In case of problems
In case of problems please do not hesitate to post an e-mail message
on the [slf4j-user@qos.ch](https://mailman.qos.ch/cgi-bin/mailman/listinfo/slf4j-user)
mailing list or to start a <a
href="https://github.com/qos-ch/slf4j/discussions">discussion</a> on
github. However, please do not directly e-mail SLF4J developers. The
answer to your question might be useful to other users. Moreover,
there are many knowledgeable users on the slf4j-user mailing lists who
can quickly answer your questions.
# Urgent issues
For urgent issues do not hesitate to [champion a
release](https://github.com/sponsors/qos-ch/sponsorships?tier_id=77436).
In principle, most championed issues are solved within 3 business days
ensued by a release.
# How to build SLF4J
SLF4J uses Maven as its build tool.
SLF4J version 2.0.x will run under Java 8 but requires Java 9 or later to build.
# How to contribute pull requests
If you are interested in improving SLF4J, great! The SLF4J community looks forward to your contribution. Please follow this process:
1. Start a discussion on the [slf4j-dev mailing list](http://www.slf4j.org/mailing-lists.html) about your proposed change. Alternately file a [bug report](http://www.slf4j.org/bug-reporting.html).
2. Fork qos-ch/slf4j. Ideally, create a new branch from your fork for your contribution to make it easier to merge your changes back.
3. Make your changes on the branch you hopefuly created in Step 2. Be sure that your code passes existing unit tests. Please add unit tests for your work if appropriate. It usually is.
4. Push your changes to your fork/branch in github. Don't push it to your master! If you do it will make it harder to submit new changes later.
5. Submit a pull request to SLF4J from from your commit page on github.
If you are interested in improving SLF4J, that is great! The SLF4J
community looks forward to your contribution. Please follow this
process:
1. Start a discussion on the [slf4j-dev mailing
list](http://www.slf4j.org/mailing-lists.html) about your proposed
change. Alternately, file a [bug
report](https://github.com/qos-ch/slf4j/issues) on github to initiate the
discussion.
2. Fork qos-ch/slf4j. Ideally, create a new branch from your fork for
your contribution to make it easier to merge your changes back.
3. Make your changes on the branch created in Step 2. Be
sure that your code passes existing unit tests. Please add unit tests
for your work if appropriate. It usually is.
4. All commits must have signed off by the contributor attesting to
[Developer Certificate of Origin
(DCO)](https://developercertificate.org/). Commits without sign off
will be automatically rejected by the [DCO GitHub
check](https://probot.github.io/apps/dco/) application.
5. Push your changes to your fork/branch in GitHub. Don't push it to
your master! If you do, it will make it harder to submit new changes
later.
6. Submit a pull request to SLF4J from your commit page on GitHub.

69
SECURITY.md Normal file
View File

@ -0,0 +1,69 @@
## Reporting security issues
Please report security issues related to the SLF4J project to the
following email address:
support(at)qos.ch
## Verifying contents
All SLF4J project artifacts published on Maven central are signed. For
each artifact, there is an associated signature file with the .asc
suffix.
### After 2022-08-08
To verify the signature use [this public key](https://www.slf4j.org/public-keys/60200AC4AE761F1614D6C46766D68DAA073BE985.gpg). Here is its fingerprint:
```
pub nistp521 2022-08-08 [SC]
60200AC4AE761F1614D6C46766D68DAA073BE985
uid Ceki Gulcu <ceki@qos.ch>
sub nistp521 2022-08-08 [E]
```
A copy of this key is stored on the
[keys.openpgp.org](https://keys.openpgp.org) keyserver. To add it to
your public key ring use the following command:
```
> FINGER_PRINT=60200AC4AE761F1614D6C46766D68DAA073BE985
> gpg --keyserver hkps://keys.openpgp.org --recv-keys $FINGER_PRINT
```
### Before 2022-08-08
To verify the signature use [this public key](https://www.slf4j.org/public-keys/ceki-public-key.pgp). Here is its fingerprint:
```
pub 2048R/A511E325 2012-04-26
Key fingerprint = 475F 3B8E 59E6 E63A A780 6748 2C7B 12F2 A511 E325
uid Ceki Gulcu <ceki@qos.ch>
sub 2048R/7FBFA159 2012-04-26
```
A copy of this key is stored on the
[keys.openpgp.org](https://keys.openpgp.org) keyserver. To add it to
your public key ring use the following command:
```
> FINGER_PRINT=475F3B8E59E6E63AA78067482C7B12F2A511E325
> gpg --keyserver hkps://keys.openpgp.org --recv-keys $FINGER_PRINT
```
## Preventing commit history overwrite
In order to prevent loss of commit history, developers of the project
are highly encouraged to deny branch deletions or history overwrites
by invoking the following two commands on their local copy of the
repository.
```
git config receive.denyDelete true
git config receive.denyNonFastForwards true
```

View File

@ -82,12 +82,12 @@
</target>
<target name="testAll" depends="init,
testNoProvider150,
testNoProvider150,
testMismatch,
testMatch,
testMultiBinding,
testFuture_16Series,
testActiveSecurityManager">
testMultiBinding,
testFuture_16Series"
>
</target>
@ -201,7 +201,7 @@
<property name="path_to_policy" value="file:./src/policy/java-under-ant.policy"/>
</target>
<!-- no longer supported in JDK 24 and later -->
<target name="testActiveSecurityManager" depends="setPathToPolicy_FromTop, setPathToPolicy_FromIntegration">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<jvmarg value="-Djava.security.manager"/>

View File

@ -66,7 +66,7 @@
<!-- for some reason if mvn is invoked from the parent directory, junit gets
invoked from the parent dir, which messes up theses tests. Hence, the
invoked from the parent dir, which messes up these tests. Hence, the
fork="yes" dir="${basedir}" -->
<!--
@ -107,4 +107,4 @@
</junit>
</target>
</project>
</project>

View File

@ -7,7 +7,8 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.8.0-beta4</version>
<version>2.0.19-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>integration</artifactId>
@ -124,9 +125,19 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>

View File

@ -10,6 +10,6 @@ Implementation-Title: iBundle
Bundle-ManifestVersion: 2
Bundle-SymbolicName: iBundle
Bundle-Name: abundle
Bundle-RequiredExecutionEnvironment: J2SE-1.6
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: apack
Import-Package: org.osgi.framework, org.slf4j;version=1.5

View File

@ -27,6 +27,7 @@ package org.slf4j;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.slf4j.helpers.Reporter.SLF4J_INTERNAL_VERBOSITY_KEY;
import java.io.PrintStream;
import java.util.Random;
@ -41,14 +42,15 @@ public class CompatibilityAssertionTest {
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
@Before
public void setUp() throws Exception {
System.setProperty(SLF4J_INTERNAL_VERBOSITY_KEY, "debug");
System.setErr(sps);
}
@After
public void tearDown() throws Exception {
System.clearProperty(SLF4J_INTERNAL_VERBOSITY_KEY);
System.setErr(old);
}
@ -57,9 +59,13 @@ public class CompatibilityAssertionTest {
Logger logger = LoggerFactory.getLogger(this.getClass());
String msg = "hello world " + diff;
logger.info(msg);
assertEquals(1, sps.stringList.size());
assertEquals(2, sps.stringList.size());
String s0 = (String) sps.stringList.get(0);
assertTrue(s0.contains(msg));
assertTrue(s0.startsWith("SLF4J(D): Connected with provider of type [org.slf4j.simple.SimpleServiceProvider]"));
String s1 = (String) sps.stringList.get(1);
assertTrue(s1.contains(msg));
}
}

View File

@ -39,28 +39,29 @@ public class MultiBindingAssertionTest {
PrintStream old = System.err;
int diff = 1024 + new Random().nextInt(10000);
@Before
public void setUp() throws Exception {
System.setErr(sps);
}
@After
public void tearDown() throws Exception {
System.setErr(old);
}
@Test
public void test() throws Exception {
Logger logger = LoggerFactory.getLogger(this.getClass());
String msg = "hello world " + diff;
logger.info(msg);
List<String> list = sps.stringList;
assertMsgContains(list, 0, "Class path contains multiple SLF4J providers.");
assertMsgContains(list, 1, "Found provider");
assertMsgContains(list, 2, "Found provider");
assertMsgContains(list, 3, "See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.");
assertMsgContains(list, 4, "Actual provider is of type [");
int line = 0;
assertMsgContains(list, line++, "Class path contains multiple SLF4J providers.");
assertMsgContains(list, line++, "Found provider");
assertMsgContains(list, line++, "Found provider");
assertMsgContains(list, line++, "See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.");
//assertMsgContains(list, line++, "SLF4J(D): Connected with provider of type [");
}
void assertMsgContains(List<String> strList, int index, String msg) {

View File

@ -31,7 +31,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class NoProviderAssertionTest {
StringPrintStream sps = new StringPrintStream(System.err);

View File

@ -44,7 +44,6 @@ public class OldAPIVersionMismatchAssertionTest {
System.setErr(sps);
}
@After
public void tearDown() throws Exception {
System.setErr(old);

View File

@ -28,12 +28,12 @@ public class OutputVerifier {
}
{
String s = (String) sps.stringList.get(2);
assertTrue(s.contains("SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details."));
assertTrue(s.contains("See https://www.slf4j.org/codes.html#noProviders for further details."));
}
{
String s = (String) sps.stringList.get(3);
assertTrue(s.contains("SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8."));
assertTrue(s.contains("Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier."));
}
{
@ -42,7 +42,7 @@ public class OutputVerifier {
}
{
String s = (String) sps.stringList.get(5);
assertTrue(s.contains("See http://www.slf4j.org/codes.html#ignoredBindings for an explanation"));
assertTrue(s.contains("See https://www.slf4j.org/codes.html#ignoredBindings for an explanation"));
}
}

View File

@ -32,13 +32,13 @@ public class StringPrintStream extends PrintStream {
public static final String LINE_SEP = System.getProperty("line.separator");
PrintStream other;
List<String> stringList = new ArrayList<String>();
List<String> stringList = new ArrayList<>();
public StringPrintStream(PrintStream ps) {
super(ps);
other = ps;
}
public void print(String s) {
other.print(s);
stringList.add(s);

View File

@ -7,7 +7,7 @@ import junit.framework.TestCase;
public class Issue324Test extends TestCase {
public void testLoggerCreationInPresenseOfSecurityManager() {
public void testLoggerCreationInPresenceOfSecurityManager() {
String currentDir = System.getProperty("user.dir");
System.out.println("currentDir:" + currentDir);
Logger logger = LoggerFactory.getLogger(Issue324Test.class);

View File

@ -33,7 +33,7 @@ import org.osgi.framework.BundleListener;
public class CheckingBundleListener implements BundleListener {
List<BundleEvent> eventList = new ArrayList<BundleEvent>();
List<BundleEvent> eventList = new ArrayList<>();
public void bundleChanged(BundleEvent be) {
eventList.add(be);
@ -45,16 +45,14 @@ public class CheckingBundleListener implements BundleListener {
}
public void dumpAll() {
for (int i = 0; i < eventList.size(); i++) {
BundleEvent fe = (BundleEvent) eventList.get(i);
for (BundleEvent fe : eventList) {
dump(fe);
}
}
boolean exists(String bundleName) {
for (int i = 0; i < eventList.size(); i++) {
BundleEvent fe = (BundleEvent) eventList.get(i);
Bundle b = fe.getBundle();
for (BundleEvent bundleEvent : eventList) {
Bundle b = bundleEvent.getBundle();
System.out.println("===[" + b + "]");
if (bundleName.equals(b.getSymbolicName())) {
return true;

View File

@ -75,7 +75,7 @@ public class FelixHost {
try {
// Create host activator;
List<Object> list = new ArrayList<Object>();
List<Object> list = new ArrayList<>();
// list.add(new HostActivator());
configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "org.xml.sax, org.xml.sax.helpers, javax.xml.parsers, javax.naming");

View File

@ -32,8 +32,9 @@ import org.osgi.framework.FrameworkListener;
public class FrameworkErrorListener implements FrameworkListener {
public List<FrameworkEvent> errorList = new ArrayList<FrameworkEvent>();
public List<FrameworkEvent> errorList = new ArrayList<>();
@Override
public void frameworkEvent(FrameworkEvent fe) {
if (fe.getType() == FrameworkEvent.ERROR) {
errorList.add(fe);
@ -54,9 +55,8 @@ public class FrameworkErrorListener implements FrameworkListener {
}
public void dumpAll() {
for (int i = 0; i < errorList.size(); i++) {
FrameworkEvent fe = (FrameworkEvent) errorList.get(i);
dump(fe);
for (FrameworkEvent frameworkEvent : errorList) {
dump(frameworkEvent);
}
}
}

View File

@ -5,7 +5,8 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.8.0-beta4</version>
<version>2.0.19-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -16,10 +17,18 @@
<description>JCL 1.2 implemented over SLF4J</description>
<url>http://www.slf4j.org</url>
<licenses>
<license>
<name>Apache-2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<module-name>org.apache.commons.logging</module-name>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
@ -31,5 +40,19 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<_exportcontents>org.apache.commons.logging*;version=${jcl.version};-noimport:=true</_exportcontents>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -20,7 +20,7 @@ package org.apache.commons.logging;
* <p>A simple logging interface abstracting logging APIs. In order to be
* instantiated successfully by {@link LogFactory}, classes that implement
* this interface must have a constructor that takes a single String
* parameter representing the "name" of this Log.</p>
* parameter representing the "name" of this Log.
*
* <p> The six logging levels used by <code>Log</code> are (in order):
* <ol>
@ -34,27 +34,27 @@ package org.apache.commons.logging;
* The mapping of these log levels to the concepts used by the underlying
* logging system is implementation dependent.
* The implementation should ensure, though, that this ordering behaves
* as expected.</p>
* as expected.
*
* <p>Performance is often a logging concern.
* By examining the appropriate property,
* a component can avoid expensive operations (producing information
* to be logged).</p>
* to be logged).
*
* <p> For example,
* <code><pre>
* <pre>
* if (log.isDebugEnabled()) {
* ... do something expensive ...
* log.debug(theResult);
* }
* </pre></code>
* </p>
* </pre>
*
*
* <p>Configuration of the underlying logging system will generally be done
* external to the Logging APIs, through whatever mechanism is supported by
* that system.</p>
* that system.
*
* <p style="color: #E40; font-weight: bold;">Please note that this interface is identical to that found in JCL 1.1.1.</p>
* <p style="color: #E40; font-weight: bold;">Please note that this interface is identical to that found in JCL 1.1.1.
*
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
* @author Rod Waldhoff
@ -65,74 +65,74 @@ public interface Log {
// ----------------------------------------------------- Logging Properties
/**
* <p> Is debug logging currently enabled? </p>
* <p> Is debug logging currently enabled?
*
* <p> Call this method to prevent having to perform expensive operations
* (for example, <code>String</code> concatenation)
* when the log level is more than debug. </p>
* when the log level is more than debug.
*/
public boolean isDebugEnabled();
/**
* <p> Is error logging currently enabled? </p>
* <p> Is error logging currently enabled?
*
* <p> Call this method to prevent having to perform expensive operations
* (for example, <code>String</code> concatenation)
* when the log level is more than error. </p>
* when the log level is more than error.
*/
public boolean isErrorEnabled();
/**
* <p> Is fatal logging currently enabled? </p>
* <p> Is fatal logging currently enabled?
*
* <p> Call this method to prevent having to perform expensive operations
* (for example, <code>String</code> concatenation)
* when the log level is more than fatal. </p>
* when the log level is more than fatal.
*/
public boolean isFatalEnabled();
/**
* <p> Is info logging currently enabled? </p>
* <p> Is info logging currently enabled?
*
* <p> Call this method to prevent having to perform expensive operations
* (for example, <code>String</code> concatenation)
* when the log level is more than info. </p>
* when the log level is more than info.
*
* @return true if info enabled, false otherwise
*/
public boolean isInfoEnabled();
/**
* <p> Is trace logging currently enabled? </p>
* <p> Is trace logging currently enabled?
*
* <p> Call this method to prevent having to perform expensive operations
* (for example, <code>String</code> concatenation)
* when the log level is more than trace. </p>
* when the log level is more than trace.
*
* @return true if trace enabled, false otherwise
*/
public boolean isTraceEnabled();
/**
* <p> Is warn logging currently enabled? </p>
* <p> Is warn logging currently enabled?
*
* <p> Call this method to prevent having to perform expensive operations
* (for example, <code>String</code> concatenation)
* when the log level is more than warn. </p>
* when the log level is more than warn.
*/
public boolean isWarnEnabled();
// -------------------------------------------------------- Logging Methods
/**
* <p> Log a message with trace log level. </p>
* <p> Log a message with trace log level.
*
* @param message log this message
*/
public void trace(Object message);
/**
* <p> Log an error with trace log level. </p>
* <p> Log an error with trace log level.
*
* @param message log this message
* @param t log this cause
@ -140,14 +140,14 @@ public interface Log {
public void trace(Object message, Throwable t);
/**
* <p> Log a message with debug log level. </p>
* <p> Log a message with debug log level.
*
* @param message log this message
*/
public void debug(Object message);
/**
* <p> Log an error with debug log level. </p>
* <p> Log an error with debug log level.
*
* @param message log this message
* @param t log this cause
@ -155,14 +155,14 @@ public interface Log {
public void debug(Object message, Throwable t);
/**
* <p> Log a message with info log level. </p>
* <p> Log a message with info log level.
*
* @param message log this message
*/
public void info(Object message);
/**
* <p> Log an error with info log level. </p>
* <p> Log an error with info log level.
*
* @param message log this message
* @param t log this cause
@ -170,14 +170,14 @@ public interface Log {
public void info(Object message, Throwable t);
/**
* <p> Log a message with warn log level. </p>
* <p> Log a message with warn log level.
*
* @param message log this message
*/
public void warn(Object message);
/**
* <p> Log an error with warn log level. </p>
* <p> Log an error with warn log level.
*
* @param message log this message
* @param t log this cause
@ -185,14 +185,14 @@ public interface Log {
public void warn(Object message, Throwable t);
/**
* <p> Log a message with error log level. </p>
* <p> Log a message with error log level.
*
* @param message log this message
*/
public void error(Object message);
/**
* <p> Log an error with error log level. </p>
* <p> Log an error with error log level.
*
* @param message log this message
* @param t log this cause
@ -200,14 +200,14 @@ public interface Log {
public void error(Object message, Throwable t);
/**
* <p> Log a message with fatal log level. </p>
* <p> Log a message with fatal log level.
*
* @param message log this message
*/
public void fatal(Object message);
/**
* <p> Log an error with fatal log level. </p>
* <p> Log an error with fatal log level.
*
* @param message log this message
* @param t log this cause

View File

@ -21,7 +21,7 @@ package org.apache.commons.logging;
* An exception that is thrown only if a suitable <code>LogFactory</code> or
* <code>Log</code> instance cannot be created by the corresponding factory
* methods.
* </p>
*
*
* <p>
* In this version of JCL, this exception will never be thrown in practice.

View File

@ -25,7 +25,7 @@ import org.apache.commons.logging.impl.SLF4JLogFactory;
* Factory for creating {@link Log} instances, which always delegates to an
* instance of {@link SLF4JLogFactory}.
*
* </p>
*
*
* @author Craig R. McClanahan
* @author Costin Manolache
@ -170,7 +170,7 @@ public abstract class LogFactory {
* <p>
* Construct (if necessary) and return a <code>Log</code> instance, using
* the factory's current set of configuration attributes.
* </p>
*
*
* <p>
* <strong>NOTE </strong>- Depending upon the implementation of the
@ -178,7 +178,7 @@ public abstract class LogFactory {
* you are returned may or may not be local to the current application, and
* may or may not be returned again on a subsequent call with the same name
* argument.
* </p>
*
*
* @param name
* Logical name of the <code>Log</code> instance to be
@ -229,7 +229,7 @@ public abstract class LogFactory {
* Construct (if necessary) and return a <code>LogFactory</code> instance,
* using the following ordered lookup procedure to determine the name of the
* implementation class to be loaded.
* </p>
*
* <ul>
* <li>The <code>org.apache.commons.logging.LogFactory</code> system
* property.</li>
@ -248,7 +248,7 @@ public abstract class LogFactory {
* <code>LogFactory</code> implementation class is utilized, all of the
* properties defined in this file will be set as configuration attributes on
* the corresponding <code>LogFactory</code> instance.
* </p>
*
*
* @exception LogConfigurationException
* if the implementation class is not available or cannot
@ -345,64 +345,64 @@ public abstract class LogFactory {
* This method exists to ensure signature compatibility.
*/
protected static Object createFactory(String factoryClass, ClassLoader classLoader) {
throw new UnsupportedOperationException("Operation [factoryClass] is not supported in jcl-over-slf4j. See also "
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
throw new UnsupportedOperationException(
"Operation [factoryClass] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
}
/**
* This method exists to ensure signature compatibility.
*/
protected static ClassLoader directGetContextClassLoader() {
throw new UnsupportedOperationException("Operation [directGetContextClassLoader] is not supported in jcl-over-slf4j. See also "
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
throw new UnsupportedOperationException(
"Operation [directGetContextClassLoader] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
}
/**
* This method exists to ensure signature compatibility.
*/
protected static ClassLoader getContextClassLoader() throws LogConfigurationException {
throw new UnsupportedOperationException("Operation [getContextClassLoader] is not supported in jcl-over-slf4j. See also "
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
throw new UnsupportedOperationException(
"Operation [getContextClassLoader] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
}
/**
* This method exists to ensure signature compatibility.
*/
protected static ClassLoader getClassLoader(Class clazz) {
throw new UnsupportedOperationException("Operation [getClassLoader] is not supported in jcl-over-slf4j. See also "
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
throw new UnsupportedOperationException(
"Operation [getClassLoader] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
}
/**
* This method exists to ensure signature compatibility.
*/
protected static boolean isDiagnosticsEnabled() {
throw new UnsupportedOperationException("Operation [isDiagnosticsEnabled] is not supported in jcl-over-slf4j. See also "
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
throw new UnsupportedOperationException(
"Operation [isDiagnosticsEnabled] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
}
/**
* This method exists to ensure signature compatibility.
*/
protected static void logRawDiagnostic(String msg) {
throw new UnsupportedOperationException("Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also "
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
throw new UnsupportedOperationException(
"Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
}
/**
* This method exists to ensure signature compatibility.
*/
protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader, final ClassLoader contextClassLoader) {
throw new UnsupportedOperationException("Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also "
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
throw new UnsupportedOperationException(
"Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
}
/**
* This method exists to ensure signature compatibility.
*/
protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader) {
throw new UnsupportedOperationException("Operation [newFactory] is not supported in jcl-over-slf4j. See also "
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
throw new UnsupportedOperationException(
"Operation [newFactory] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
}
}

View File

@ -23,7 +23,7 @@ import org.apache.commons.logging.Log;
* <p>
* Trivial implementation of Log that throws away all messages. No configurable
* system properties are supported.
* </p>
*
*
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
* @author Rod Waldhoff

View File

@ -43,7 +43,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
// logger instance is transient
private transient LocationAwareLogger logger;
private final transient LocationAwareLogger logger;
private static final String FQCN = SLF4JLocationAwareLog.class.getName();
@ -104,7 +104,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the message to log. Converted to {@link String}
*/
public void trace(Object message) {
logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, null);
if (isTraceEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, null);
}
}
/**
@ -117,7 +119,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the exception to log
*/
public void trace(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, t);
if (isTraceEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(message), null, t);
}
}
/**
@ -128,7 +132,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the message to log. Converted to {@link String}
*/
public void debug(Object message) {
logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, null);
if (isDebugEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, null);
}
}
/**
@ -141,7 +147,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the exception to log
*/
public void debug(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, t);
if (isDebugEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(message), null, t);
}
}
/**
@ -152,7 +160,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the message to log. Converted to {@link String}
*/
public void info(Object message) {
logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, null);
if (isInfoEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, null);
}
}
/**
@ -165,7 +175,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the exception to log
*/
public void info(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, t);
if (isInfoEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(message), null, t);
}
}
/**
@ -176,7 +188,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the message to log. Converted to {@link String}
*/
public void warn(Object message) {
logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, null);
if (isWarnEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, null);
}
}
/**
@ -189,7 +203,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the exception to log
*/
public void warn(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, t);
if (isWarnEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(message), null, t);
}
}
/**
@ -200,7 +216,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the message to log. Converted to {@link String}
*/
public void error(Object message) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
if (isErrorEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
}
}
/**
@ -213,7 +231,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the exception to log
*/
public void error(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, t);
if (isErrorEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, t);
}
}
/**
@ -224,7 +244,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the message to log. Converted to {@link String}
*/
public void fatal(Object message) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
if (isErrorEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, null);
}
}
/**
@ -237,7 +259,9 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
* the exception to log
*/
public void fatal(Object message, Throwable t) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, t);
if (isErrorEnabled()) {
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(message), null, t);
}
}
/**

View File

@ -42,7 +42,7 @@ public class SLF4JLog implements Log, Serializable {
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
// logger instance is transient
private transient Logger logger;
private final transient Logger logger;
public SLF4JLog(Logger logger) {
this.logger = logger;

View File

@ -42,7 +42,7 @@ import java.util.concurrent.ConcurrentMap;
*
* <p>
* This implementation ignores any configured attributes.
* </p>
*
*
* @author Rod Waldhoff
* @author Craig R. McClanahan
@ -64,7 +64,7 @@ public class SLF4JLogFactory extends LogFactory {
* Public no-arguments constructor required by the lookup mechanism.
*/
public SLF4JLogFactory() {
loggerMap = new ConcurrentHashMap<String, Log>();
loggerMap = new ConcurrentHashMap<>();
}
// ----------------------------------------------------- Manifest Constants
@ -105,12 +105,12 @@ public class SLF4JLogFactory extends LogFactory {
@SuppressWarnings("unchecked")
public String[] getAttributeNames() {
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
Enumeration<String> keys = attributes.keys();
while (keys.hasMoreElements()) {
names.add((String) keys.nextElement());
}
String results[] = new String[names.size()];
String[] results = new String[names.size()];
for (int i = 0; i < results.length; i++) {
results[i] = (String) names.get(i);
}
@ -136,7 +136,7 @@ public class SLF4JLogFactory extends LogFactory {
* <p>
* Construct (if necessary) and return a <code>Log</code> instance, using
* the factory's current set of configuration attributes.
* </p>
*
*
* @param name
* Logical name of the <code>Log</code> instance to be returned
@ -173,12 +173,10 @@ public class SLF4JLogFactory extends LogFactory {
public void release() {
// This method is never called by jcl-over-slf4j classes. However,
// in certain deployment scenarios, in particular if jcl-over-slf4j.jar
// is
// in the the web-app class loader and the official commons-logging.jar is
// deployed in some parent class loader (e.g. commons/lib), then it is
// possible
// for the parent class loader to mask the classes shipping in
// jcl-over-slf4j.jar.
// is in the web-app class loader and the official commons-logging.jar
// is deployed in some parent class loader (e.g. commons/lib), then it
// is possible for the parent class loader to mask the classes shipping
// in jcl-over-slf4j.jar.
System.out.println("WARN: The method " + SLF4JLogFactory.class + "#release() was invoked.");
System.out.println("WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.");
System.out.flush();
@ -216,4 +214,4 @@ public class SLF4JLogFactory extends LogFactory {
}
}
}
}

View File

@ -35,7 +35,7 @@ import org.apache.commons.logging.LogConfigurationException;
* Simple implementation of Log that sends all enabled log messages, for all
* defined loggers, to System.err. The following system properties are supported
* to configure the behavior of this logger:
* </p>
*
* <ul>
* <li><code>org.apache.commons.logging.simplelog.defaultlog</code> - Default
* logging detail level for all instances of SimpleLog. Must be one of ("trace",
@ -67,7 +67,7 @@ import org.apache.commons.logging.LogConfigurationException;
* this implementation also checks for a class loader resource named
* <code>"simplelog.properties"</code>, and includes any matching definitions
* from this resource (if it exists).
* </p>
*
*
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
* @author Rod Waldhoff
@ -165,7 +165,7 @@ public class SimpleLog implements Log, Serializable {
} catch (java.io.IOException e) {
// ignored
}
}
}
}
showLogName = getBooleanProperty(systemPrefix + "showlogname", showLogName);
@ -248,7 +248,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Set logging level.
* </p>
*
*
* @param currentLogLevel
* new logging level
@ -262,7 +262,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Get logging level.
* </p>
*
*/
public int getLevel() {
@ -275,7 +275,7 @@ public class SimpleLog implements Log, Serializable {
* <p>
* Do the actual logging. This method assembles the message and then calls
* <code>write()</code> to cause it to be written.
* </p>
*
*
* @param type
* One of the LOG_LEVEL_XXX constants defining the log level
@ -354,7 +354,7 @@ public class SimpleLog implements Log, Serializable {
* Write the content of the message accumulated in the specified
* <code>StringBuffer</code> to the appropriate output destination. The
* default implementation writes to <code>System.err</code>.
* </p>
*
*
* @param buffer
* A <code>StringBuffer</code> containing the accumulated text to be
@ -383,7 +383,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log a message with debug log level.
* </p>
*
*/
public final void debug(Object message) {
@ -395,7 +395,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log an error with debug log level.
* </p>
*
*/
public final void debug(Object message, Throwable t) {
@ -407,7 +407,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log a message with trace log level.
* </p>
*
*/
public final void trace(Object message) {
@ -419,7 +419,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log an error with trace log level.
* </p>
*
*/
public final void trace(Object message, Throwable t) {
@ -431,7 +431,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log a message with info log level.
* </p>
*
*/
public final void info(Object message) {
@ -443,7 +443,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log an error with info log level.
* </p>
*
*/
public final void info(Object message, Throwable t) {
@ -455,7 +455,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log a message with warn log level.
* </p>
*
*/
public final void warn(Object message) {
@ -467,7 +467,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log an error with warn log level.
* </p>
*
*/
public final void warn(Object message, Throwable t) {
@ -479,7 +479,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log a message with error log level.
* </p>
*
*/
public final void error(Object message) {
@ -491,7 +491,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log an error with error log level.
* </p>
*
*/
public final void error(Object message, Throwable t) {
@ -503,7 +503,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log a message with fatal log level.
* </p>
*
*/
public final void fatal(Object message) {
@ -515,7 +515,7 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Log an error with fatal log level.
* </p>
*
*/
public final void fatal(Object message, Throwable t) {
@ -527,12 +527,12 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Are debug messages currently enabled?
* </p>
*
*
* <p>
* This allows expensive operations such as <code>String</code> concatenation
* to be avoided when the message will be ignored by the logger.
* </p>
*
*/
public final boolean isDebugEnabled() {
@ -542,12 +542,12 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Are error messages currently enabled?
* </p>
*
*
* <p>
* This allows expensive operations such as <code>String</code> concatenation
* to be avoided when the message will be ignored by the logger.
* </p>
*
*/
public final boolean isErrorEnabled() {
@ -557,12 +557,12 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Are fatal messages currently enabled?
* </p>
*
*
* <p>
* This allows expensive operations such as <code>String</code> concatenation
* to be avoided when the message will be ignored by the logger.
* </p>
*
*/
public final boolean isFatalEnabled() {
@ -572,12 +572,12 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Are info messages currently enabled?
* </p>
*
*
* <p>
* This allows expensive operations such as <code>String</code> concatenation
* to be avoided when the message will be ignored by the logger.
* </p>
*
*/
public final boolean isInfoEnabled() {
@ -587,12 +587,12 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Are trace messages currently enabled?
* </p>
*
*
* <p>
* This allows expensive operations such as <code>String</code> concatenation
* to be avoided when the message will be ignored by the logger.
* </p>
*
*/
public final boolean isTraceEnabled() {
@ -602,12 +602,12 @@ public class SimpleLog implements Log, Serializable {
/**
* <p>
* Are warn messages currently enabled?
* </p>
*
*
* <p>
* This allows expensive operations such as <code>String</code> concatenation
* to be avoided when the message will be ignored by the logger.
* </p>
*
*/
public final boolean isWarnEnabled() {
@ -673,15 +673,13 @@ public class SimpleLog implements Log, Serializable {
}
private static InputStream getResourceAsStream(final String name) {
return AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
public InputStream run() {
ClassLoader threadCL = getContextClassLoader();
return AccessController.doPrivileged((PrivilegedAction<InputStream>) () -> {
ClassLoader threadCL = getContextClassLoader();
if (threadCL != null) {
return threadCL.getResourceAsStream(name);
} else {
return ClassLoader.getSystemResourceAsStream(name);
}
if (threadCL != null) {
return threadCL.getResourceAsStream(name);
} else {
return ClassLoader.getSystemResourceAsStream(name);
}
});
}

View File

@ -31,7 +31,7 @@ replacement for the original JCL version 1.0.4.
<p>As the original JCL version 1.0.4, the present version supports
various logging APIs. It differs from the original in implementation
but not the public API. This implementation uses SLF4J under the
covers. As as such, all the logging systems that SLF4J supports,
covers. As such, all the logging systems that SLF4J supports,
e.g. NOP, Simple, JDK14, nlog4j are supported by this version of JCL.
</p>

View File

@ -1,9 +0,0 @@
Implementation-Title: jcl-over-slf4j
Bundle-ManifestVersion: 2
Bundle-SymbolicName: jcl.over.slf4j
Bundle-Name: jcl-over-slf4j
Bundle-Vendor: SLF4J.ORG
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.apache.commons.logging;version=1.2,
org.apache.commons.logging.impl;version=1.2
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion}, org.slf4j.spi;version=${parsedVersion.osgiVersion}

View File

@ -27,6 +27,7 @@ package org.apache.commons.logging.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -88,4 +89,58 @@ public class InvokeJCLTest {
log.fatal(null, e);
log.fatal("fatal message", e);
}
@Test
public void testAvoidConvertingObjectToString() {
Log log = LogFactory.getLog(InvokeJCLTest.class);
Exception e = new Exception("just testing");
TestMessage fatalMsg = new TestMessage("fatal msg");
TestMessage errorMsg = new TestMessage("error msg");
TestMessage warnMsg = new TestMessage("warn msg");
TestMessage infoMsg = new TestMessage("info msg");
TestMessage debugMsg = new TestMessage("debug msg");
TestMessage traceMsg = new TestMessage("trace msg");
log.fatal(fatalMsg);
log.fatal(fatalMsg, e);
assertEquals(2, fatalMsg.invokedCount);
log.error(errorMsg);
log.error(errorMsg, e);
assertEquals(2, errorMsg.invokedCount);
log.warn(warnMsg);
log.warn(warnMsg, e);
assertEquals(2, warnMsg.invokedCount);
log.info(infoMsg);
log.info(infoMsg, e);
assertEquals(2, infoMsg.invokedCount);
log.debug(debugMsg);
log.debug(debugMsg, e);
assertEquals(0, debugMsg.invokedCount);
log.trace(traceMsg);
log.trace(traceMsg, e);
assertEquals(0, traceMsg.invokedCount);
}
static class TestMessage {
private final String msg;
int invokedCount = 0;
TestMessage(String msg) {
this.msg = msg;
}
@Override
public String toString() {
invokedCount++;
return msg;
}
}
}

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2007 QOS.ch
Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland)
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining

View File

@ -7,7 +7,8 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.8.0-beta4</version>
<version>2.0.19-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>jul-to-slf4j</artifactId>
@ -25,10 +26,15 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-reload4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
<build>
<plugins>
</plugins>
</build>
</project>

View File

@ -39,12 +39,12 @@ import org.slf4j.spi.LocationAwareLogger;
// Based on http://jira.qos.ch/browse/SLF4J-30
/**
* <p>Bridge/route all JUL log records to the SLF4J API.</p>
* <p>Bridge/route all JUL log records to the SLF4J API.
* <p>Essentially, the idea is to install on the root logger an instance of
* <code>SLF4JBridgeHandler</code> as the sole JUL handler in the system. Subsequently, the
* SLF4JBridgeHandler instance will redirect all JUL log records are redirected
* to the SLF4J API based on the following mapping of levels:
* </p>
*
* <pre>
* FINEST -&gt; TRACE
* FINER -&gt; DEBUG
@ -52,7 +52,7 @@ import org.slf4j.spi.LocationAwareLogger;
* INFO -&gt; INFO
* WARNING -&gt; WARN
* SEVERE -&gt; ERROR</pre>
* <p><b>Programmatic installation:</b></p>
* <p><b>Programmatic installation:</b>
* <pre>
* // Optionally remove existing handlers attached to j.u.l root logger
* SLF4JBridgeHandler.removeHandlersForRootLogger(); // (since SLF4J 1.6.5)
@ -60,12 +60,12 @@ import org.slf4j.spi.LocationAwareLogger;
* // add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
* // the initialization phase of your application
* SLF4JBridgeHandler.install();</pre>
* <p><b>Installation via <em>logging.properties</em> configuration file:</b></p>
* <p><b>Installation via <em>logging.properties</em> configuration file:</b>
* <pre>
* // register SLF4JBridgeHandler as handler for the j.u.l. root logger
* handlers = org.slf4j.bridge.SLF4JBridgeHandler</pre>
* <p>Once SLF4JBridgeHandler is installed, logging by j.u.l. loggers will be directed to
* SLF4J. Example: </p>
* SLF4J. Example:
* <pre>
* import java.util.logging.Logger;
* ...
@ -79,12 +79,12 @@ import org.slf4j.spi.LocationAwareLogger;
* SLF4J translation can seriously increase the cost of disabled logging
* statements (60 fold or 6000% increase) and measurably impact the performance of enabled log
* statements (20% overall increase).</b> Please note that as of logback-version 0.9.25,
* it is possible to completely eliminate the 60 fold translation overhead for disabled
* it is possible to completely eliminate the 60-fold translation overhead for disabled
* log statements with the help of <a href="http://logback.qos.ch/manual/configuration.html#LevelChangePropagator">LevelChangePropagator</a>.
* </p>
*
*
* <p>If you are concerned about application performance, then use of <code>SLF4JBridgeHandler</code>
* is appropriate only if any one the following two conditions is true:</p>
* is appropriate only if any of the following conditions is true:
* <ol>
* <li>few j.u.l. logging statements are in play</li>
* <li>LevelChangePropagator has been installed</li>
@ -93,7 +93,7 @@ import org.slf4j.spi.LocationAwareLogger;
* <h2>As a Java 9/Jigsaw module</h2>
*
* <p>Given that <b>to</b> is a reserved keyword under Java 9 within module productions,
* the MAFIFEST.MF file in <em>jul-to-slf4j.jar</em> declares <b>jul_to_slf4j</b> as
* the MANIFEST.MF file in <em>jul-to-slf4j.jar</em> declares <b>jul_to_slf4j</b> as
* its Automatic Module Name. Thus, if your application is Jigsaw modularized, the requires
* statement in your <em>module-info.java</em> needs to be <b>jul_to_slf4j</b>
* (note the two underscores).
@ -118,9 +118,8 @@ public class SLF4JBridgeHandler extends Handler {
/**
* Adds a SLF4JBridgeHandler instance to jul's root logger.
* <p/>
* <p/>
* This handler will redirect j.u.l. logging to SLF4J. However, only logs enabled
*
* <p>This handler will redirect j.u.l. logging to SLF4J. However, only logs enabled
* in j.u.l. will be redirected. For example, if a log statement invoking a
* j.u.l. logger is disabled, then the corresponding non-event will <em>not</em>
* reach SLF4JBridgeHandler and cannot be redirected.
@ -144,9 +143,9 @@ public class SLF4JBridgeHandler extends Handler {
public static void uninstall() throws SecurityException {
java.util.logging.Logger rootLogger = getRootLogger();
Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++) {
if (handlers[i] instanceof SLF4JBridgeHandler) {
rootLogger.removeHandler(handlers[i]);
for (Handler handler : handlers) {
if (handler instanceof SLF4JBridgeHandler) {
rootLogger.removeHandler(handler);
}
}
}
@ -154,14 +153,14 @@ public class SLF4JBridgeHandler extends Handler {
/**
* Returns true if SLF4JBridgeHandler has been previously installed, returns false otherwise.
*
* @return true if SLF4JBridgeHandler is already installed, false other wise
* @throws SecurityException
* @return true if SLF4JBridgeHandler is already installed, false otherwise
*
*/
public static boolean isInstalled() throws SecurityException {
public static boolean isInstalled() {
java.util.logging.Logger rootLogger = getRootLogger();
Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++) {
if (handlers[i] instanceof SLF4JBridgeHandler) {
for (Handler handler : handlers) {
if (handler instanceof SLF4JBridgeHandler) {
return true;
}
}
@ -175,8 +174,8 @@ public class SLF4JBridgeHandler extends Handler {
public static void removeHandlersForRootLogger() {
java.util.logging.Logger rootLogger = getRootLogger();
java.util.logging.Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++) {
rootLogger.removeHandler(handlers[i]);
for (Handler handler : handlers) {
rootLogger.removeHandler(handler);
}
}
@ -202,6 +201,9 @@ public class SLF4JBridgeHandler extends Handler {
/**
* Return the Logger instance that will be used for logging.
*
* @param record a LogRecord
* @return an SLF4J logger corresponding to the record parameter's logger name
*/
protected Logger getSLF4JLogger(LogRecord record) {
String name = record.getLoggerName();
@ -283,10 +285,10 @@ public class SLF4JBridgeHandler extends Handler {
/**
* Publish a LogRecord.
* <p/>
* <p>
* The logging request was made initially to a Logger object, which
* initialized the LogRecord and forwarded it here.
* <p/>
* <p>
* This handler ignores the Level attached to the LogRecord, as SLF4J cares
* about discarding log statements.
*

View File

@ -10,6 +10,6 @@
<p>Bridge/route all JUL log records to the SLF4J API.</p>
<hr/>
<hr>
</body>
</html>

View File

@ -0,0 +1,7 @@
module jul.to.slf4j {
requires org.slf4j;
requires java.logging;
exports org.slf4j.bridge;
}

View File

@ -1,8 +0,0 @@
Bundle-ManifestVersion: 2
Bundle-SymbolicName: jul.to.slf4j
Bundle-Name: jul-to-slf4j
Bundle-Vendor: SLF4J.ORG
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.slf4j.bridge;version=${parsedVersion.osgiVersion};uses:="org.slf4j,org.slf4j.spi"
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion},org.slf4j.spi;version=${parsedVersion.osgiVersion}
Automatic-Module-Name: jul.to.slf4j

View File

@ -32,7 +32,7 @@ import org.apache.log4j.spi.LoggingEvent;
public class ListAppender extends AppenderSkeleton {
public List<LoggingEvent> list = new ArrayList<LoggingEvent>();
public List<LoggingEvent> list = new ArrayList<>();
public boolean extractLocationInfo = false;

View File

@ -56,8 +56,8 @@ public class SLF4JBridgeHandlerPerfTest {
fileAppender = new FileAppender(new PatternLayout("%r [%t] %p %c %x - %m%n"), "target/test-output/toto.log");
existingHandlers = julRootLogger.getHandlers();
for (int i = 0; i < existingHandlers.length; i++) {
julRootLogger.removeHandler(existingHandlers[i]);
for (Handler existingHandler : existingHandlers) {
julRootLogger.removeHandler(existingHandler);
}
log4jRoot = org.apache.log4j.Logger.getRootLogger();
log4jRoot.addAppender(fileAppender);
@ -68,8 +68,8 @@ public class SLF4JBridgeHandlerPerfTest {
SLF4JBridgeHandler.uninstall();
fileAppender.close();
log4jRoot.getLoggerRepository().resetConfiguration();
for (int i = 0; i < existingHandlers.length; i++) {
julRootLogger.addHandler(existingHandlers[i]);
for (Handler existingHandler : existingHandlers) {
julRootLogger.addHandler(existingHandler);
}
}

View File

@ -42,14 +42,16 @@ public class SLF4JBridgeHandlerTest {
ListAppender listAppender = new ListAppender();
org.apache.log4j.Logger log4jRoot;
java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger("yay");
java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(LOGGER_NAME);
java.util.logging.Logger julRootLogger = java.util.logging.Logger.getLogger("");
@Before
public void setUp() throws Exception {
listAppender.extractLocationInfo = true;
log4jRoot = org.apache.log4j.Logger.getRootLogger();
log4jRoot.addAppender(listAppender);
log4jRoot.setLevel(org.apache.log4j.Level.TRACE);
julRootLogger.setLevel(Level.FINEST);
}
@After
@ -61,6 +63,7 @@ public class SLF4JBridgeHandlerTest {
@Test
public void testSmoke() {
SLF4JBridgeHandler.install();
String msg = "msg";
julLogger.info(msg);
assertEquals(1, listAppender.list.size());
@ -77,6 +80,19 @@ public class SLF4JBridgeHandlerTest {
assertEquals("SLF4JBridgeHandlerTest.java", li.getFileName());
assertEquals("testSmoke", li.getMethodName());
}
@Test
public void LOGBACK_1612() {
SLF4JBridgeHandler.install();
String msg = "LOGBACK_1612";
julLogger.finer(msg);
assertEquals(1, listAppender.list.size());
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
assertEquals(LOGGER_NAME, le.getLoggerName());
assertEquals(msg, le.getMessage());
}
@Test
public void testLevels() {
@ -101,6 +117,8 @@ public class SLF4JBridgeHandlerTest {
assertLevel(i++, org.apache.log4j.Level.ERROR);
}
@Test
public void testLogWithResourceBundle() {
SLF4JBridgeHandler.install();
@ -115,7 +133,7 @@ public class SLF4JBridgeHandlerTest {
julResourceBundleLogger.info(msg);
assertEquals(1, listAppender.list.size());
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
LoggingEvent le = listAppender.list.get(0);
assertEquals(LOGGER_NAME, le.getLoggerName());
assertEquals(expectedMsg, le.getMessage());
}
@ -149,19 +167,19 @@ public class SLF4JBridgeHandlerTest {
LoggingEvent le = null;
le = (LoggingEvent) listAppender.list.get(0);
le = listAppender.list.get(0);
assertEquals("foo", le.getLoggerName());
assertEquals(expectedMsg1, le.getMessage());
le = (LoggingEvent) listAppender.list.get(1);
le = listAppender.list.get(1);
assertEquals("foo", le.getLoggerName());
assertEquals(expectedMsg2, le.getMessage());
le = (LoggingEvent) listAppender.list.get(2);
le = listAppender.list.get(2);
assertEquals("foo", le.getLoggerName());
assertEquals(expectedMsg3, le.getMessage());
le = (LoggingEvent) listAppender.list.get(3);
le = listAppender.list.get(3);
assertEquals("yay", le.getLoggerName());
assertEquals(expectedMsg3, le.getMessage());
}
@ -173,7 +191,7 @@ public class SLF4JBridgeHandlerTest {
julLogger.logp(Level.INFO, "SLF4JBridgeHandlerTest", "testLogWithPlaceholderNoParameters", msg, new Object[0]);
assertEquals(1, listAppender.list.size());
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
LoggingEvent le = listAppender.list.get(0);
assertEquals(LOGGER_NAME, le.getLoggerName());
assertEquals(msg, le.getMessage());
}
@ -187,7 +205,7 @@ public class SLF4JBridgeHandlerTest {
julLogger.log(Level.INFO, msg, "ignored parameter due to IllegalArgumentException");
assertEquals(1, listAppender.list.size());
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
LoggingEvent le = listAppender.list.get(0);
assertEquals(msg, le.getMessage());
}
@ -197,12 +215,12 @@ public class SLF4JBridgeHandlerTest {
String msg = null;
julLogger.log(Level.INFO, msg);
assertEquals(1, listAppender.list.size());
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
LoggingEvent le = listAppender.list.get(0);
assertEquals("", le.getMessage());
}
void assertLevel(int index, org.apache.log4j.Level expectedLevel) {
LoggingEvent le = (LoggingEvent) listAppender.list.get(index);
LoggingEvent le = listAppender.list.get(index);
assertEquals(expectedLevel, le.getLevel());
}
}

View File

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View File

@ -1,137 +0,0 @@
<project name="testing-log4j-bridge" default="usage" basedir=".">
<property name="lbversion" value="0.9.8-SNAPSHOT" />
<property name="slf4jversion" value="1.4.2" />
<property name="source.home" value="./src/main/java/" />
<property name="javac.dest.12" value="./target/classes12/" />
<property name="javac.dest.13" value="./target/classes13/" />
<property name="lib" value="./lib" />
<property name="deprecation" value="on" />
<path id="basic.classpath">
<pathelement location="${source.home}" />
<pathelement location="${lib}/junit-3.8.1.jar" />
</path>
<path id="log4j12.classpath">
<path refid="basic.classpath" />
<pathelement location="${javac.dest.12}" />
<pathelement location="${lib}/log4j-1.2.14.jar" />
</path>
<path id="log4j13.classpath">
<path refid="basic.classpath" />
<pathelement location="${javac.dest.13}" />
<pathelement location="${lib}/log4j-1.3alpha-8.jar" />
</path>
<path id="los.classpath">
<path refid="basic.classpath" />
<pathelement location="${lib}/log4j-over-slf4j-${slf4jversion}.jar" />
<pathelement location="${lib}/logback-classic-${lbversion}.jar" />
<pathelement location="${lib}/logback-core-${lbversion}.jar" />
<pathelement location="${lib}/slf4j-api-${slf4jversion}.jar" />
</path>
<!-- ================================================================= -->
<!-- Default target -->
<!-- ================================================================= -->
<target name="usage">
<echo>
These are some of the targets supported by this ANT build scpript:
all - run all available tests
refresh - copy required jar files to the lib directory
</echo>
</target>
<delete>
<fileset dir="." includes="**/*.bak"/>
</delete>
<target name="refresh">
<delete>
<fileset dir="lib">
<include name="logback-*.jar"/>
<include name="log4j-bridge-*.jar"/>
</fileset>
</delete>
<copy file="../../slf4j-api/target/slf4j-api-${slf4jversion}.jar" todir="lib/"/>
<copy file="../target/log4j-over-slf4j-${slf4jversion}.jar" todir="lib/"/>
</target>
<target name="init">
<mkdir dir="${javac.dest.12}" />
<mkdir dir="${javac.dest.13}" />
</target>
<target name="clean">
<delete>
<fileset dir="${javac.dest.12}" includes="**" />
<fileset dir="${javac.dest.13}" includes="**" />
</delete>
</target>
<target name="build_log4j12" depends="init">
<javac srcdir="${source.home}"
destdir="${javac.dest.12}"
includes="**/Log4j12Calls.java"
deprecation="${deprecation}" debug="on">
<classpath refid="log4j12.classpath" />
</javac>
</target>
<target name="build_log4j13" depends="init">
<javac srcdir="${source.home}"
destdir="${javac.dest.13}"
includes="**/Log4j13Calls.java" deprecation="${deprecation}" debug="on">
<classpath refid="log4j13.classpath" />
</javac>
</target>
<target name="build_loggerTest" depends="init">
<javac srcdir="${source.home}"
destdir="${javac.dest.12}"
includes="**/LoggerTest.java"
deprecation="${deprecation}" debug="on">
<classpath refid="los.classpath" />
</javac>
</target>
<!-- ================================================================= -->
<!-- Run tests -->
<!-- ================================================================= -->
<target name="all" depends="test12, test13, loggerTest" />
<target name="loggerTest" depends="build_loggerTest">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath refid="los.classpath" />
<classpath location="${javac.dest.12}" />
<formatter type="plain" usefile="false" />
<test name="test.LoggerTest" />
</junit>
</target>
<target name="test12" depends="build_log4j12">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath refid="los.classpath" />
<classpath location="${javac.dest.12}" />
<formatter type="plain" usefile="false" />
<test name="test.Log4j12Calls" />
</junit>
</target>
<target name="test13" depends="build_log4j13">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath refid="los.classpath" />
<classpath location="${javac.dest.13}" />
<formatter type="plain" usefile="false" />
<test name="test.Log4j13Calls" />
</junit>
</target>
</project>

View File

@ -1,17 +0,0 @@
This directory is used to test the module against various log4j calls.
Two test cases simulate the typical calls that one can find in an application
that uses either log4j 1.2.x, or log4j 1.3.x.
In the same directory is a build.xml file that uses ant to
compile the test cases with the corresponding log4j version,
and to runs these tests without log4j in the classpath but with
logback jars instead.
To run the tests, one must have ant installed. Issuing the following command,
once in the compatibility directory will launch the tests:
ant all
To obtain more information about the use of the log4j-over-slf4j module,
please visit http://www..slf4j.org/log4j-over-slf4j.html

View File

@ -1,8 +0,0 @@
package test;
public class DummyObject {
public String toString() {
return "dummy";
}
}

View File

@ -1,39 +0,0 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
*
* Copyright (C) 1999-2006, QOS.ch
*
* This library is free software, you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation.
*/
package test;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
/**
*
* A test case that issues the typical calls
* that an application using log4j 1.2 would do.
*
* @author Ceki G&uuml;lc&uuml;
* @author S&eacute;bastien Pennec
*/
public class Log4j12Calls extends TestCase {
public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
public void testLog() {
MDC.put("key", "value1");
logger.trace("Trace level can be noisy");
logger.debug("Entering application");
logger.info("Violets are blue");
logger.warn("Here is a warning");
logger.error("Exiting application", new Exception("just testing"));
MDC.remove("key");
}
}

View File

@ -1,46 +0,0 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
*
* Copyright (C) 1999-2006, QOS.ch
*
* This library is free software, you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation.
*/
package test;
import junit.framework.TestCase;
import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
/**
*
* A test case that issues the typical calls
* that an application using log4j 1.3 would do.
*
* @author Ceki G&uuml;lc&uuml;
* @author S&eacute;bastien Pennec
*/
public class Log4j13Calls extends TestCase {
public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
public void testLog() {
MDC.put("key", "value1");
logger.trace("Trace level can be noisy");
logger.debug("Entering application");
logger.info("Violets are blue");
logger.warn("Here is a warning");
logger.info("The answer is {}.", new Integer(42));
logger.info("Number: {} and another one: {}.", new Integer(42), new Integer(24));
logger.error("Exiting application", new Exception("just testing"));
MDC.remove("key");
MDC.clear();
}
}

View File

@ -1,169 +0,0 @@
package test;
import junit.framework.TestCase;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.read.ListAppender;
import org.apache.log4j.Level;
/**
* A class that tests the invocation of the org.apache.log4j.Logger class that
* belongs to the log4j-bridge package
*
* @author S&eacute;bastien Pennec
* @author Ceki G&uuml;lc&uuml;
*/
public class LoggerTest extends TestCase {
LoggerContext context;
ListAppender<LoggingEvent> appender;
ch.qos.logback.classic.Logger logbackLogger;
org.apache.log4j.Logger log4jLogger;
public void setUp() throws Exception {
context = (LoggerContext) LoggerFactory.getILoggerFactory();
context.shutdownAndReset();
appender = new ListAppender<LoggingEvent>();
appender.setContext(context);
appender.setName("listAppender");
appender.start();
ch.qos.logback.classic.Logger lbLogger = context
.getLogger(LoggerContext.ROOT_NAME);
lbLogger.addAppender(appender);
log4jLogger = org.apache.log4j.Logger.getLogger(LoggerTest.class);
logbackLogger = context.getLogger(LoggerTest.class);
super.setUp();
}
public void tearDown() throws Exception {
appender.stop();
context.stop();
appender = null;
context = null;
logbackLogger = null;
log4jLogger = null;
super.tearDown();
}
public void testLogWithObjectMessages() {
LoggingEvent event;
log4jLogger.debug("test");
event = appender.list.get(0);
assertEquals("test", event.getMessage());
appender.list.clear();
log4jLogger.debug(null);
event = appender.list.get(0);
assertEquals(null, event.getMessage());
appender.list.clear();
DummyObject dummy = new DummyObject();
log4jLogger.debug(dummy);
event = appender.list.get(0);
assertEquals(dummy.toString(), event.getMessage());
appender.list.clear();
}
public void testIsEnabledAPI() {
assertFalse(log4jLogger.isTraceEnabled());
assertTrue(log4jLogger.isDebugEnabled());
assertTrue(log4jLogger.isInfoEnabled());
assertTrue(log4jLogger.isWarnEnabled());
assertTrue(log4jLogger.isErrorEnabled());
}
public void testPrintAPI() {
Exception e = new Exception("just testing");
log4jLogger.trace(null);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.debug(null);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.debug("debug message");
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.info(null);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.info("info message");
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.warn(null);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.warn("warn message");
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.error(null);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.error("error message");
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.debug(null, e);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.debug("debug message", e);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.info(null, e);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.info("info message", e);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.warn(null, e);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.warn("warn message", e);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.error(null, e);
assertEquals(1, appender.list.size());
appender.list.clear();
log4jLogger.error("error message", e);
assertEquals(1, appender.list.size());
appender.list.clear();
}
public void testLogAPI() {
log4jLogger.log("x", Level.TRACE, "x", null);
assertEquals(0, appender.list.size());
log4jLogger.log("x", Level.DEBUG, "x", null);
log4jLogger.log("x", Level.INFO, "x", null);
log4jLogger.log("x", Level.WARN, "x", null);
log4jLogger.log("x", Level.ERROR, "x", null);
log4jLogger.log("x", Level.FATAL, "x", null);
assertEquals(5, appender.list.size());
appender.list.clear();
}
}

View File

@ -7,7 +7,8 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.8.0-beta4</version>
<version>2.0.19-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
@ -20,8 +21,8 @@
<licenses>
<license>
<name>Apache Software Licenses</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<name>Apache-2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
@ -41,4 +42,20 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<_exportcontents>org.apache.log4j*;version=${reload4j.version};-noimport:=true</_exportcontents>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -54,7 +54,7 @@ public interface Appender {
/**
* Release any resources allocated within the appender such as file
* handles, network connections, etc.
* <p/>
*
* <p>It is a programming error to append to a closed appender.
*
* @since 0.8.4
@ -114,12 +114,12 @@ public interface Appender {
* Configurators call this method to determine if the appender
* requires a layout. If this method returns <code>true</code>,
* meaning that layout is required, then the configurator will
* configure an layout using the configuration information at its
* configure a layout using the configuration information at its
* disposal. If this method returns <code>false</code>, meaning that
* a layout is not required, then layout configuration will be
* skipped even if there is available layout configuration
* information at the disposal of the configurator.
* <p/>
*
* <p>In the rather exceptional case, where the appender
* implementation admits a layout but can also work without it, then
* the appender should return <code>true</code>.

View File

@ -29,7 +29,7 @@ import java.util.Enumeration;
* This class is a minimal implementation of the original
* <code>org.apache.log4j.Category</code> class (as found in log4j 1.2) by
* delegation of all calls to a {@link org.slf4j.Logger} instance.
* </p>
*
*
* <p>
* Log4j's <code>trace</code>, <code>debug()</code>, <code>info()</code>,
@ -45,12 +45,12 @@ public class Category {
private static final String CATEGORY_FQCN = Category.class.getName();
private String name;
private final String name;
protected org.slf4j.Logger slf4jLogger;
private org.slf4j.spi.LocationAwareLogger locationAwareLogger;
private static Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
private static final Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
Category(String name) {
this.name = name;
@ -125,6 +125,7 @@ public class Category {
/**
* @deprecated Please use {@link #getLevel} instead.
* @return a Level
*/
final public Level getPriority() {
return null;
@ -132,6 +133,9 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#isDebugEnabled} method in SLF4J
*
* @return true if this logger is enabled for the level DEBUG
*
*/
public boolean isDebugEnabled() {
return slf4jLogger.isDebugEnabled();
@ -139,6 +143,8 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#isInfoEnabled} method in SLF4J
*
* @return true if this logger is enabled for the level INFO
*/
public boolean isInfoEnabled() {
return slf4jLogger.isInfoEnabled();
@ -146,6 +152,8 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#isWarnEnabled} method in SLF4J
*
* @return true if this logger is enabled for the level WARN
*/
public boolean isWarnEnabled() {
return slf4jLogger.isWarnEnabled();
@ -153,6 +161,8 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#isErrorEnabled} method in SLF4J
*
* @return true if this logger is enabled for the level ERROR
*/
public boolean isErrorEnabled() {
return slf4jLogger.isErrorEnabled();
@ -160,13 +170,11 @@ public class Category {
/**
* Determines whether the priority passed as parameter is enabled in the
* underlying SLF4J logger. Each log4j priority is mapped directly to its
* SLF4J equivalent, except for FATAL which is mapped as ERROR.
* underlying SLF4J logger. Each log4j priority is mapped directly to its SLF4J
* equivalent, except for FATAL which is mapped as ERROR.
*
* @param p
* the priority to check against
* @return true if this logger is enabled for the given level, false
* otherwise.
* @param p the priority to check against
* @return true if this logger is enabled for the given level, false otherwise.
*/
public boolean isEnabledFor(Priority p) {
switch (p.level) {
@ -194,19 +202,19 @@ public class Category {
} else {
switch (level) {
case LocationAwareLogger.TRACE_INT:
slf4jLogger.trace(marker, m);
slf4jLogger.trace(marker, m, (Throwable) t);
break;
case LocationAwareLogger.DEBUG_INT:
slf4jLogger.debug(marker, m);
slf4jLogger.debug(marker, m, (Throwable) t);
break;
case LocationAwareLogger.INFO_INT:
slf4jLogger.info(marker, m);
slf4jLogger.info(marker, m, (Throwable) t);
break;
case LocationAwareLogger.WARN_INT:
slf4jLogger.warn(marker, m);
slf4jLogger.warn(marker, m, (Throwable) t);
break;
case LocationAwareLogger.ERROR_INT:
slf4jLogger.error(marker, m);
slf4jLogger.error(marker, m, (Throwable) t);
break;
}
}
@ -214,6 +222,8 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#debug(String)} method of SLF4J.
*
* @param message a message to log
*/
public void debug(Object message) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, null);
@ -222,6 +232,9 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#debug(String,Throwable)} method in
* SLF4J.
*
* @param message a message to log
* @param t a throwable to log
*/
public void debug(Object message, Throwable t) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, t);
@ -229,14 +242,18 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#info(String)} method in SLF4J.
*
* @param message a message to log
*/
public void info(Object message) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.INFO_INT, message, null);
}
/**
* Delegates to {@link org.slf4j.Logger#info(String,Throwable)} method in
* SLF4J.
* Delegates to {@link org.slf4j.Logger#info(String,Throwable)} method in SLF4J.
*
* @param message a message to log
* @param t a throwable to log
*/
public void info(Object message, Throwable t) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.INFO_INT, message, t);
@ -244,14 +261,20 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#warn(String)} method in SLF4J.
*
* @param message a message to log
*
*/
public void warn(Object message) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.WARN_INT, message, null);
}
/**
* Delegates to {@link org.slf4j.Logger#warn(String,Throwable)} method in
* SLF4J.
* Delegates to {@link org.slf4j.Logger#warn(String,Throwable)} method in SLF4J.
*
* @param message a message to log
* @param t a throwable to log
*
*/
public void warn(Object message, Throwable t) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.WARN_INT, message, t);
@ -259,6 +282,9 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
*
* @param message a message to log
*
*/
public void error(Object message) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
@ -267,6 +293,10 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
* SLF4J.
*
* @param message a message to log
* @param t a throwable to log
*
*/
public void error(Object message, Throwable t) {
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
@ -274,6 +304,9 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
*
* @param message a message to log
*
*/
public void fatal(Object message) {
differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
@ -282,6 +315,10 @@ public class Category {
/**
* Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
* SLF4J. In addition, the call is marked with a marker named "FATAL".
*
* @param message a message to log
* @param t a throwable to log
*
*/
public void fatal(Object message, Throwable t) {
differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);

View File

@ -15,6 +15,18 @@
*/
package org.apache.log4j;
/**
* Skeleton implementation of ConsoleAppender
*/
public class ConsoleAppender extends WriterAppender {
public ConsoleAppender() {
}
public ConsoleAppender(Layout layout) {
}
public ConsoleAppender(Layout layout, String target) {
}
}

View File

@ -20,7 +20,7 @@ package org.apache.log4j;
/**
* This class is a minimal implementation of the original Log4J class.
*
* @author Christian Trutz <christian.trutz@belaso.de>
* @author Christian Trutz
* */
public class Layout {

View File

@ -26,21 +26,21 @@ import java.io.ObjectStreamException;
import java.io.Serializable;
/**
Defines the minimum set of levels recognized by the system, that is
<code>OFF</code>, <code>FATAL</code>, <code>ERROR</code>,
<code>WARN</code>, <code>INFO</code>, <code>DEBUG</code> and
<code>ALL</code>.
<p>The <code>Level</code> class may be subclassed to define a larger
level set.
@author Ceki G&uuml;lc&uuml;
* Defines the minimum set of levels recognized by the system, that is
* <code>OFF</code>, <code>FATAL</code>, <code>ERROR</code>, <code>WARN</code>,
* <code>INFO</code>, <code>DEBUG</code> and <code>ALL</code>.
*
* <p>
* The <code>Level</code> class may be subclassed to define a larger level set.
*
* @author Ceki G&uuml;lc&uuml;
*
*/
public class Level extends Priority implements Serializable {
/**
* TRACE level integer value.
*
* @since 1.2.12
*/
public static final int TRACE_INT = 5000;
@ -49,48 +49,52 @@ public class Level extends Priority implements Serializable {
public static final int X_TRACE_INT = DEBUG_INT - 100;
/**
The <code>OFF</code> has the highest possible rank and is
intended to turn off logging. */
* The <code>OFF</code> has the highest possible rank and is intended to turn
* off logging.
*/
final static public Level OFF = new Level(OFF_INT, "OFF", 0);
/**
The <code>FATAL</code> level designates very severe error
events that will presumably lead the application to abort.
* The <code>FATAL</code> level designates very severe error events that will
* presumably lead the application to abort.
*/
final static public Level FATAL = new Level(FATAL_INT, "FATAL", 0);
/**
The <code>ERROR</code> level designates error events that
might still allow the application to continue running. */
* The <code>ERROR</code> level designates error events that might still allow
* the application to continue running.
*/
final static public Level ERROR = new Level(ERROR_INT, "ERROR", 3);
/**
The <code>WARN</code> level designates potentially harmful situations.
*/
* The <code>WARN</code> level designates potentially harmful situations.
*/
final static public Level WARN = new Level(WARN_INT, "WARN", 4);
/**
The <code>INFO</code> level designates informational messages
that highlight the progress of the application at coarse-grained
level. */
* The <code>INFO</code> level designates informational messages that highlight
* the progress of the application at coarse-grained level.
*/
final static public Level INFO = new Level(INFO_INT, "INFO", 6);
/**
The <code>DEBUG</code> Level designates fine-grained
informational events that are most useful to debug an
application. */
* The <code>DEBUG</code> Level designates fine-grained informational events
* that are most useful to debug an application.
*/
final static public Level DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
/**
* The <code>TRACE</code> Level designates finer-grained
* informational events than the <code>DEBUG</code level.
* @since 1.2.12
*/
* The <code>TRACE</code> Level designates finer-grained informational events
* than the <code>DEBUG</code> level.
*
* @since 1.2.12
*/
public static final Level TRACE = new Level(TRACE_INT, "TRACE", 7);
/**
The <code>ALL</code> has the lowest possible rank and is intended to
turn on all logging. */
* The <code>ALL</code> has the lowest possible rank and is intended to turn on
* all logging.
*/
final static public Level ALL = new Level(ALL_INT, "ALL", 7);
/**
@ -99,33 +103,47 @@ public class Level extends Priority implements Serializable {
static final long serialVersionUID = 3491141966387921974L;
/**
Instantiate a Level object.
* Instantiate a Level object.
*
* @param level a level
* @param levelStr a level string
* @param syslogEquivalent the Syslog equivalent
*/
protected Level(int level, String levelStr, int syslogEquivalent) {
super(level, levelStr, syslogEquivalent);
}
/**
Convert the string passed as argument to a level. If the
conversion fails, then this method returns {@link #DEBUG}.
*/
* Convert the string passed as argument to a level. If the conversion fails,
* then this method returns {@link #DEBUG}.
*
* @param sArg a string
* @return corresponding Level
*
*/
public static Level toLevel(String sArg) {
return (Level) toLevel(sArg, Level.DEBUG);
}
/**
Convert an integer passed as argument to a level. If the
conversion fails, then this method returns {@link #DEBUG}.
*/
* Convert an integer passed as argument to a level. If the conversion fails,
* then this method returns {@link #DEBUG}.
*
* @param val an int
* @return a level
*/
public static Level toLevel(int val) {
return (Level) toLevel(val, Level.DEBUG);
}
/**
Convert an integer passed as argument to a level. If the
conversion fails, then this method returns the specified default.
*/
* Convert an integer passed as argument to a level. If the conversion fails,
* then this method returns the specified default.
*
* @param val a value
* @param defaultLevel a defaultLevel
* @return corresponding Level
*/
public static Level toLevel(int val, Level defaultLevel) {
switch (val) {
case ALL_INT:
@ -150,10 +168,13 @@ public class Level extends Priority implements Serializable {
}
/**
Convert the string passed as argument to a level. If the
conversion fails, then this method returns the value of
<code>defaultLevel</code>.
*/
* Convert the string passed as argument to a level. If the conversion fails,
* then this method returns the value of <code>defaultLevel</code>.
*
* @param sArg a string
* @param defaultLevel a default level
* @return corresponding level
*/
public static Level toLevel(String sArg, Level defaultLevel) {
if (sArg == null)
return defaultLevel;
@ -181,8 +202,9 @@ public class Level extends Priority implements Serializable {
/**
* Custom deserialization of Level.
*
* @param s serialization stream.
* @throws IOException if IO exception.
* @throws IOException if IO exception.
* @throws ClassNotFoundException if class not found.
*/
private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
@ -197,6 +219,7 @@ public class Level extends Priority implements Serializable {
/**
* Serialize level.
*
* @param s serialization stream.
* @throws IOException if exception during serialization.
*/
@ -208,8 +231,9 @@ public class Level extends Priority implements Serializable {
}
/**
* Resolved deserialized level to one of the stock instances.
* May be overridden in classes derived from Level.
* Resolved deserialized level to one of the stock instances. May be overridden
* in classes derived from Level.
*
* @return resolved object.
* @throws ObjectStreamException if exception during resolution.
*/

View File

@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentMap;
class Log4jLoggerFactory {
// String, Logger
private static ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<String, Logger>();
private static final ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<>();
public static Logger getLogger(String name) {
org.apache.log4j.Logger instance = log4jLoggers.get(name);

View File

@ -22,12 +22,11 @@ import java.util.Enumeration;
import java.util.Vector;
/**
* <p/>
* <p>
* This class is a minimal implementation of the original
* <code>org.apache.log4j.LogManager</code> class (as found in log4j 1.2)
* delegating all calls to SLF4J.
* <p/>
* <p/>
* <p>
* This implementation does <b>NOT</b> implement the setRepositorySelector(),
* getLoggerRepository(), exists(), getCurrentLoggers(), shutdown() and
* resetConfiguration() methods which do not have SLF4J equivalents.
@ -67,7 +66,7 @@ public class LogManager {
/**
* This bogus implementation returns an empty enumeration.
*
* @return
* @return an Enumeration of current loggers
*/
public static Enumeration getCurrentLoggers() {
return new Vector().elements();

View File

@ -24,7 +24,7 @@ import org.slf4j.spi.LocationAwareLogger;
* This class is a minimal implementation of the original
* <code>org.apache.log4j.Logger</code> class (as found in log4j 1.2)
* delegating all calls to a {@link org.slf4j.Logger} instance.
* </p>
*
*
* @author Ceki G&uuml;lc&uuml;
* */
@ -52,7 +52,7 @@ public class Logger extends Category {
/**
* Does the obvious.
*
* @return
* @return the root logger
*/
public static Logger getRootLogger() {
return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
@ -61,6 +61,8 @@ public class Logger extends Category {
/**
* Delegates to {@link org.slf4j.Logger#isTraceEnabled}
* method of SLF4J.
*
* @return whether this logger is enabled for the level TRACE
*/
public boolean isTraceEnabled() {
return slf4jLogger.isTraceEnabled();
@ -68,6 +70,9 @@ public class Logger extends Category {
/**
* Delegates to {@link org.slf4j.Logger#trace(String)} method in SLF4J.
*
* @param message the message to log
*
*/
public void trace(Object message) {
differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
@ -76,9 +81,12 @@ public class Logger extends Category {
/**
* Delegates to {@link org.slf4j.Logger#trace(String,Throwable)}
* method in SLF4J.
*
* @param message the message to log
* @param t a Throwable to log
*/
public void trace(Object message, Throwable t) {
differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, t);
}
}

View File

@ -49,6 +49,8 @@ public class MDC {
* This method is not part of the Log4J public API. However it
* has been called by other projects. This method is here temporarily
* until projects who are depending on this method release fixes.
*
* @return a copy of the underlying map returned as a Hashtable
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@Deprecated

View File

@ -20,7 +20,7 @@ package org.apache.log4j;
/**
* This class is a minimal implementation of the original Log4J class.
*
* @author Christian Trutz <christian.trutz@belaso.de>
* @author Christian Trutz
* */
public class PatternLayout extends Layout {

View File

@ -21,8 +21,8 @@ package org.apache.log4j;
// Contributors: Kitching Simon <Simon.Kitching@OOOrange.ch>
/**
<font color="#AA4444">Refrain from using this class directly, use
the {@link Level} class instead</font>.
<b>Refrain from using this class directly, use
the {@link Level} class instead</b>.
@author Ceki G&uuml;lc&uuml; */
public class Priority {
@ -80,6 +80,15 @@ public class Priority {
/**
Instantiate a level object.
@param
*/
/**
* Instantiate a level object.
*
* @param level a level as in int
* @param levelStr a levelStr
* @param syslogEquivalent the syslog equivalent level integer
*/
protected Priority(int level, String levelStr, int syslogEquivalent) {
this.level = level;
@ -102,20 +111,23 @@ public class Priority {
/**
Return the syslog equivalent of this priority as an integer.
@return the Syslog Equivalent of this Priority
*/
public final int getSyslogEquivalent() {
return syslogEquivalent;
}
/**
Returns <code>true</code> if this level has a higher or equal
level than the level passed as argument, <code>false</code>
otherwise.
<p>You should think twice before overriding the default
implementation of <code>isGreaterOrEqual</code> method.
*/
* Returns <code>true</code> if this level has a higher or equal
* level than the level passed as argument, <code>false</code>
* otherwise.
*
* <p>You should think twice before overriding the default
* implementation of <code>isGreaterOrEqual</code> method.
*
* @param r a priority
* @return a boolean
*/
public boolean isGreaterOrEqual(Priority r) {
return level >= r.level;
}
@ -123,8 +135,9 @@ public class Priority {
/**
Return all possible priorities as an array of Level objects in
descending order.
@deprecated This method will be removed with no replacement.
@return array of all possible priorities
*/
@Deprecated
public static Priority[] getAllPossiblePriorities() {
@ -139,7 +152,9 @@ public class Priority {
}
/**
Returns the integer representation of this level.
* Returns the integer representation of this level.
*
* @return integer representation of this level
*/
public final int toInt() {
return level;
@ -147,6 +162,9 @@ public class Priority {
/**
* @deprecated Please use the {@link Level#toLevel(String)} method instead.
*
* @param sArg a string to convert to a Priority
* @return the corresponding Priority
*/
@Deprecated
public static Priority toPriority(String sArg) {
@ -155,6 +173,9 @@ public class Priority {
/**
* @deprecated Please use the {@link Level#toLevel(int)} method instead.
*
* @param val an integer to convert to a Priority
* @return the corresponding Priority
*/
@Deprecated
public static Priority toPriority(int val) {
@ -163,7 +184,11 @@ public class Priority {
/**
* @deprecated Please use the {@link Level#toLevel(int, Level)} method instead.
*/
*
* @param val an integer value
* @param defaultPriority a default priority value
* @return corresponding Priority value
*/
@Deprecated
public static Priority toPriority(int val, Priority defaultPriority) {
return Level.toLevel(val, (Level) defaultPriority);
@ -171,9 +196,12 @@ public class Priority {
/**
* @deprecated Please use the {@link Level#toLevel(String, Level)} method instead.
* @param sArg string value
* @param defaultPriority a default Priority
* @return a Priority
*/
@Deprecated
public static Priority toPriority(String sArg, Priority defaultPriority) {
return Level.toLevel(sArg, (Level) defaultPriority);
}
}
}

View File

@ -23,7 +23,7 @@ import org.apache.log4j.spi.Configurator;
import org.apache.log4j.spi.LoggerRepository;
/**
* An nop implementation of PropertyConfigurator.
* A no-op implementation of PropertyConfigurator.
*/
public class PropertyConfigurator implements Configurator {
public static void configure(Properties properties) {

View File

@ -22,7 +22,7 @@ import java.io.IOException;
/**
* This class is a minimal implementation of the original Log4J class.
*
* @author Christian Trutz <christian.trutz@belaso.de>
* @author Christian Trutz
* */
public class RollingFileAppender {

View File

@ -25,7 +25,7 @@ package org.apache.log4j.helpers;
<b>log4j.configDebug</b> variable.
<p>All log4j internal debug calls go to <code>System.out</code>
where as internal error messages are sent to
whereas internal error messages are sent to
<code>System.err</code>. All internal messages are prepended with
the string "log4j: ".
@ -37,20 +37,20 @@ public class LogLog {
/**
Defining this value makes log4j print log4j-internal debug
statements to <code>System.out</code>.
<p> The value of this string is <b>log4j.debug</b>.
<p>Note that the search for all option names is case sensitive. */
<p>Note that the search for all option names is case-sensitive. */
public static final String DEBUG_KEY = "log4j.debug";
/**
Defining this value makes log4j components print log4j-internal
debug statements to <code>System.out</code>.
<p> The value of this string is <b>log4j.configDebug</b>.
<p>Note that the search for all option names is case sensitive.
<p>Note that the search for all option names is case-sensitive.
@deprecated Use {@link #DEBUG_KEY} instead.
*/
public static final String CONFIG_DEBUG_KEY = "log4j.configDebug";
@ -127,7 +127,7 @@ public class LogLog {
/**
In quite mode no LogLog generates strictly no output, not even
for errors.
@param quietMode A true for not
*/
public static void setQuietMode(boolean quietMode) {

View File

@ -16,7 +16,6 @@
package org.apache.log4j.spi;
import org.apache.log4j.spi.LoggerRepository;
import java.net.URL;
/**
@ -41,10 +40,10 @@ public interface Configurator {
/**
Interpret a resource pointed by a URL and set up log4j accordingly.
The configuration is done relative to the <code>hierarchy</code>
parameter.
@param url The URL to parse
@param repository The hierarchy to operation upon.
*/

View File

@ -21,7 +21,7 @@ import org.apache.log4j.Logger;
/**
Implement this interface to create new instances of Logger or
a sub-class of Logger.
a subclass of Logger.
<p>See <code>examples/subclass/MyLogger.java</code> for an example.

View File

@ -25,7 +25,7 @@ import java.util.Enumeration;
* <code>Loggers</code>. The relation between loggers in a repository
* depends on the repository but typically loggers are arranged in a
* named hierarchy.
* <p/>
*
* <p>In addition to the creational methods, a
* <code>LoggerRepository</code> can be queried for existing loggers,
* can act as a point of registry for events related to loggers.
@ -37,6 +37,8 @@ public interface LoggerRepository {
/**
* Add a {@link HierarchyEventListener} event to the repository.
*
* @param listener a listener
*/
public void addHierarchyEventListener(HierarchyEventListener listener);

View File

@ -1,13 +0,0 @@
Implementation-Title: log4j-over-slf4j
Bundle-ManifestVersion: 2
Bundle-SymbolicName: log4j.over.slf4j
Bundle-Name: log4j-over-slf4j
Bundle-Vendor: SLF4J.ORG
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.apache.log4j;version=${log4j.version},
org.apache.log4j.helpers;version=${log4j.version},
org.apache.log4j.spi;version=${log4j.version},
org.apache.log4j.xml;version=${log4j.version}
Import-Package: org.slf4j;version=${slf4j.api.minimum.compatible.version},
org.slf4j.helpers;version=${slf4j.api.minimum.compatible.version},
org.slf4j.spi;version=${slf4j.api.minimum.compatible.version}

View File

@ -31,7 +31,7 @@ import java.util.logging.LogRecord;
public class ListHandler extends Handler {
List<LogRecord> list = new ArrayList<LogRecord>();
List<LogRecord> list = new ArrayList<>();
public void close() throws SecurityException {

View File

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

View File

@ -7,7 +7,8 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.8.0-beta4</version>
<version>2.0.19-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>osgi-over-slf4j</artifactId>
@ -37,8 +38,27 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>org.slf4j.osgi-over-slf4j</Bundle-SymbolicName>
<Bundle-Activator>org.slf4j.osgi.logservice.impl.Activator</Bundle-Activator>
<Bundle-Category>osgi</Bundle-Category>
<_exportcontents combine.self="override" />
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,8 +0,0 @@
Implementation-Title: osgi-over-slf4j
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.slf4j.osgi-over-slf4j
Bundle-Name: OSGi LogService implemented over SLF4J
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Activator: org.slf4j.osgi.logservice.impl.Activator
Bundle-Category: osgi
Import-Package: org.osgi.framework;version="[1.5,2)",org.osgi.service.log;version="[1.3,2)",org.slf4j;version=${parsedVersion.osgiVersion}

397
parent/pom.xml Normal file
View File

@ -0,0 +1,397 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-bom</artifactId>
<version>2.0.19-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>slf4j-parent</artifactId>
<packaging>pom</packaging>
<name>SLF4J Parent POM</name>
<description>SLF4J project parent pom.xml file</description>
<organization>
<name>QOS.ch</name>
<url>http://www.qos.ch</url>
</organization>
<inceptionYear>2005</inceptionYear>
<properties>
<!-- yyyy-MM-dd'T'HH:mm:ss'Z' -->
<project.build.outputTimestamp>2026-05-12T18:37:04Z</project.build.outputTimestamp>
<latest.1.version>1.7.36</latest.1.version>
<!-- java.util.ServiceLoader requires Java 6 -->
<jdk.version>8</jdk.version>
<maven.compiler.source>${jdk.version}</maven.compiler.source>
<maven.compiler.target>${jdk.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- used in integration testing -->
<cal10n.version>0.8.1</cal10n.version>
<reload4j.version>1.2.22</reload4j.version>
<logback.version>1.2.10</logback.version>
<jcl.version>1.2</jcl.version>
<junit.version>4.13.1</junit.version>
<maven-site-plugin.version>3.7.1</maven-site-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-deploy-plugin.version>3.0.0-M1</maven-deploy-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<maven-jxr-plugin.version>3.1.1</maven-jxr-plugin.version>
<maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
<version>${reload4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.cal10n</groupId>
<artifactId>cal10n-api</artifactId>
<version>${cal10n.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
</extension>
</extensions>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>..</directory>
<targetPath>META-INF</targetPath>
<includes>
<include>LICENSE.txt</include>
</includes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java16</artifactId>
<version>1.0</version>
</signature>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<executions>
<execution>
<id>default-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</execution>
<execution>
<id>module-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<executions>
<!-- Repeated in slf4j-api/pom.xml -->
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<configuration>
<supportIncrementalBuild>true</supportIncrementalBuild>
<!-- populated by the plugin itself -->
<instructions>
<Bundle-SymbolicName>${replacestring;${project.artifactId};-;.}</Bundle-SymbolicName>
<Bundle-Vendor>SLF4J.ORG</Bundle-Vendor>
<_snapshot/>
<_exportcontents>!META-INF.versions.9,*;-noimport:=true</_exportcontents>
<Bundle-Description>${project.description}</Bundle-Description>
<Bundle-DocURL>${project.url}</Bundle-DocURL>
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Multi-Release>true</Multi-Release>
<_removeheaders>Private-Package,Bundle-SCM, Bundle-Developers, Include-Resource</_removeheaders>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<reportFormat>plain</reportFormat>
<trimStackTrace>false</trimStackTrace>
<excludes>
<exclude>**/AllTest.java</exclude>
<exclude>**/PackageTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>skipTests</id>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
<profile>
<id>javadocjar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<failOnError>false</failOnError>
<sourceFileExcludes>
<sourceFileExclude>**/module-info.java</sourceFileExclude>
</sourceFileExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>license</id>
<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<configuration>
<header>src/main/licenseHeader.txt</header>
<quiet>false</quiet>
<failIfMissing>true</failIfMissing>
<aggregate>true</aggregate>
<includes>
<include>src/**/*.java</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
<useDefaultMapping>true</useDefaultMapping>
<properties>
<year>1999</year>
</properties>
<headerDefinitions>
<headerDefinition>src/main/javadocHeaders.xml</headerDefinition>
</headerDefinitions>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
</pluginRepositories>
</profile>
<profile>
<id>generate-osgi-service-loader-mediator-entries</id>
<activation>
<file>
<exists>src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider</exists>
</file>
</activation>
<build>
<!-- Add the OSGi Service Loader Mediator Specification Manifest entries for each module that has a SLF4JServiceProvider Service-Loader file.-->
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Provide-Capability><![CDATA[
osgi.service;objectClass:List<String>="org.slf4j.spi.SLF4JServiceProvider";type=${slf4j.provider.type};effective:=active,
osgi.serviceloader;osgi.serviceloader="org.slf4j.spi.SLF4JServiceProvider";register:="${slf4j.provider.implementation}";type=${slf4j.provider.type}
]]></Provide-Capability>
<Require-Capability><![CDATA[
osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.registrar)(version>=1.0.0)(!(version>=2.0.0)))"
]]></Require-Capability>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!--
<profile>
<id>travis</id>
<activation>
<property>
<name>env.TRAVIS</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>toolchain</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
-->
</profiles>
</project>

599
pom.xml
View File

@ -5,86 +5,53 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.8.0-beta4</version>
<artifactId>slf4j-bom</artifactId>
<version>2.0.19-SNAPSHOT</version>
<packaging>pom</packaging>
<name>SLF4J</name>
<description>Top SLF4J project pom.xml file</description>
<url>http://www.slf4j.org</url>
<organization>
<name>QOS.ch</name>
<url>http://www.qos.ch</url>
</organization>
<inceptionYear>2005</inceptionYear>
<name>SLF4J BOM</name>
<description>SLF4J project BOM</description>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<name>MIT</name>
<url>https://opensource.org/license/mit</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/qos-ch/slf4j</url>
<connection>git@github.com:qos-ch/slf4j.git</connection>
</scm>
<connection>scm:git:https://github.com/qos-ch/slf4j.git</connection>
</scm>
<properties>
<latest.stable.version>1.7.26</latest.stable.version>
<!-- java.util.ServiceLoader requires Java 6 -->
<jdk.version>1.6</jdk.version>
<maven.compiler.source>${jdk.version}</maven.compiler.source>
<maven.compiler.target>${jdk.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- used in integration testing -->
<slf4j.api.minimum.compatible.version>1.6.0</slf4j.api.minimum.compatible.version>
<cal10n.version>0.8.1</cal10n.version>
<log4j.version>1.2.17</log4j.version>
<logback.version>1.0.13</logback.version>
<junit.version>4.12</junit.version>
<maven-site-plugin.version>3.6</maven-site-plugin.version>
<compiler-plugin.version>3.6.1</compiler-plugin.version>
<javadoc.plugin.version>2.10.4</javadoc.plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
</properties>
<developers>
<developer>
<id>ceki</id>
<name>Ceki Gulcu</name>
<email>ceki@qos.ch</email>
</developer>
</developers>
<!-- Inspired by Improving the Maven Bill of Materials (BOM) Pattern -->
<!-- https://www.garretwilson.com/blog/2023/06/14/improve-maven-bom-pattern -->
<modules>
<module>parent</module>
<module>slf4j-api</module>
<module>slf4j-simple</module>
<module>slf4j-nop</module>
<module>slf4j-jdk14</module>
<module>slf4j-jdk-platform-logging</module>
<module>slf4j-log4j12</module>
<module>slf4j-reload4j</module>
<module>slf4j-ext</module>
<module>jcl-over-slf4j</module>
<module>log4j-over-slf4j</module>
<module>jul-to-slf4j</module>
<module>osgi-over-slf4j</module>
<module>integration</module>
<module>slf4j-site</module>
<module>slf4j-migrator</module>
<module>slf4j-migrator</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
@ -97,363 +64,181 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<artifactId>slf4j-simple</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.cal10n</groupId>
<artifactId>cal10n-api</artifactId>
<version>${cal10n.version}</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk-platform-logging</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-ext</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>osgi-over-slf4j</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<developers>
<developer>
<id>ceki</id>
<name>Ceki Gulcu</name>
<email>ceki@qos.ch</email>
</developer>
</developers>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
</extension>
</extensions>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java16</artifactId>
<version>1.0</version>
</signature>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>toolchain</id>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<configuration>
<toolchains>
<jdk>
<version>9</version>
</jdk>
<verbose>true</verbose>
<skippedModules>
slf4j-jdk-platform-logging,slf4j-migrator,osgi-over-slf4j
</skippedModules>
<detectLinks>true</detectLinks>
<doctitle>SLF4J project modules ${project.version}</doctitle>
<windowtitle>SLF4J javadoc</windowtitle>
<bottom><![CDATA[Copyright &copy; 2005-{currentYear} QOS.CH Sarl. All rights reserved]]></bottom>
<linksource>true</linksource>
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
<groups>
<group>
<title>SLF4J API packages</title>
<packages>org.slf4j:org.slf4j.spi:org.slf4j.event:org.slf4j.helpers</packages>
</group>
<group>
<title>slf4j-simple package</title>
<packages>org.slf4j.simple</packages>
</group>
<group>
<title>slf4j-nop package</title>
<packages>org.slf4j.nop</packages>
</group>
<group>
<title>slf4j-jdk14 package</title>
<packages>org.slf4j.jul</packages>
</group>
<group>
<title>slf4j-reload4j package</title>
<packages>org.slf4j.reload4j</packages>
</group>
<group>
<title>SLF4J extensions</title>
<packages>
org.slf4j.cal10n:org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent
</packages>
</group>
<group>
<title>Jakarta Commons Logging packages</title>
<packages>org.apache.commons.*</packages>
</group>
<group>
<title>java.util.logging (JUL) to SLF4J bridge</title>
<packages>org.slf4j.bridge</packages>
</group>
<group>
<title>log4j-over-slf4j redirection</title>
<packages>org.apache.log4j:org.apache.log4j.*</packages>
</group>
</groups>
<jdk>
<version>1.6</version>
</jdk>
</toolchains>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<executions>
<execution>
<id>default-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<jdkToolchain>
<version>[6, )</version>
</jdkToolchain>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</execution>
<execution>
<id>module-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<jdkToolchain>
<version>[9, )</version>
</jdkToolchain>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
</compileSourceRoots>
<outputDirectory>${project.build.outputDirectory}/META-INF/versions/9</outputDirectory>
<compilerArgs>
<arg>--patch-module</arg>
<arg>${module-name}=${project.build.outputDirectory}</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central-publishing-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<archive>
<manifestEntries>
<Bundle-Version>${parsedVersion.osgiVersion}</Bundle-Version>
<Bundle-Description>${project.description}</Bundle-Description>
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
<Implementation-Version>${project.version}</Implementation-Version>
<Multi-Release>true</Multi-Release>
</manifestEntries>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<forkCount>2C</forkCount>
<reuseForks>false</reuseForks>
<reportFormat>plain</reportFormat>
<trimStackTrace>false</trimStackTrace>
<excludes>
<exclude>**/AllTest.java</exclude>
<exclude>**/PackageTest.java</exclude>
</excludes>
<publishingServerId>central</publishingServerId>
<excludeArtifacts>integration</excludeArtifacts>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/source.xml</descriptor>
</descriptors>
<finalName>slf4j-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<outputDirectory>target/site/dist/</outputDirectory>
</configuration>
</plugin>
<!-- as suggested in http://jira.qos.ch/browse/SLF4J-143 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- ====== site plugin ===== -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
<configuration>
<aggregate>true</aggregate>
<javadocDir>target/site/apidocs/</javadocDir>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc-plugin.version}</version>
<configuration>
<linkJavadoc>true</linkJavadoc>
<linksource>true</linksource>
<aggregate>true</aggregate>
<excludePackageNames>org.slf4j.migrator:org.slf4j.migrator.*</excludePackageNames>
<sourceFileExcludes>
<sourceFileExclude>**/module-info.java</sourceFileExclude>
</sourceFileExcludes>
<links>
<link>
http://java.sun.com/j2se/1.5.0/docs/api
</link>
</links>
<groups>
<group>
<title>SLF4J packages</title>
<packages>org.slf4j:org.slf4j.*</packages>
</group>
<group>
<title>SLF4J extensions</title>
<packages>
org.slf4j.cal10n:org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent
</packages>
</group>
<group>
<title>Jakarta Commons Logging packages</title>
<packages>org.apache.commons.*</packages>
</group>
<group>
<title>java.util.logging (JUL) to SLF4J bridge</title>
<packages>org.slf4j.bridge</packages>
</group>
<group>
<title>Apache log4j</title>
<packages>org.apache.log4j:org.apache.log4j.*</packages>
</group>
</groups>
</configuration>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>skipTests</id>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
<profile>
<id>javadocjar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceFileExcludes>
<sourceFileExclude>**/module-info.java</sourceFileExclude>
</sourceFileExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>license</id>
<build>
<plugins>
<plugin>
<groupId>com.google.code.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<configuration>
<header>src/main/licenseHeader.txt</header>
<quiet>false</quiet>
<failIfMissing>true</failIfMissing>
<aggregate>true</aggregate>
<includes>
<include>src/**/*.java</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
<useDefaultMapping>true</useDefaultMapping>
<properties>
<year>1999</year>
</properties>
<headerDefinitions>
<headerDefinition>src/main/javadocHeaders.xml</headerDefinition>
</headerDefinitions>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>mc-release</id>
<name>Local Maven repository of releases</name>
<url>http://mc-repo.googlecode.com/svn/maven2/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>sign-artifacts</id>
@ -476,62 +261,6 @@
</plugins>
</build>
</profile>
<profile>
<id>travis</id>
<activation>
<property>
<name>env.TRAVIS</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>toolchain</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<pluginRepositories>
<pluginRepository>
<id>apache-snapshot-repo</id>
<name>apache-snapshot-repo</name>
<url>https://repository.apache.org/content/groups/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<site>
<id>qos_ch</id>
<url>scp://yvo.qos.ch/var/www/www.slf4j.org/htdocs/</url>
</site>
<repository>
<!--<id>pixie</id>-->
<!--<url>scp://pixie.qos.ch/var/mvnrepo/</url>-->
<id>sonatype-nexus-staging</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>

View File

@ -1,10 +1,18 @@
# Javadoc
#JDK8 - mvn site:site
#rscpSLF4J apidocs/
# JDK 11+
# adding the following
#mvn -Ddoclint=none -Dadditionalparam=-Xdoclint:none javadoc:aggregate
#mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION_NUMBER}
MVN='/java/maven-3.5.2//bin/mvn'
PASS=$1
echo $PASS
function checkExit(){
if test "$?" != "0"; then
echo Command $1 exited with abnormal status
@ -21,7 +29,7 @@ function echoRunAndCheck () { # echo and then run the command
then
echo Failed command: $1
exit 1;
else echo Succussful run: $1
else echo Successful run: $1
fi
}
@ -29,17 +37,26 @@ echoRunAndCheck "$MVN clean"
echoRunAndCheck "$MVN install"
echoRunAndCheck "$MVN site:site"
#echoRunAndCheck "$MVN site:site"
#echoRunAndCheck "$MVN javadoc:aggregate"
#echoRunAndCheck "$MVN jxr:aggregate"
echoRunAndCheck "$MVN assembly:single"
if [ ! -z "$PASS" ]
then
# WARNING deploying without cleaning may leave stale MANIFEST files
export GPG_TTY=$(tty)
echoRunAndCheck "$MVN deploy -P javadocjar,sign-artifacts"
fi
echoRunAndCheck "$MVN deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=$PASS"
#$MVN site:deploy -N # with Java 8!!!
#checkExit "mvn site:deploy -N"
git tag -m "tagging" -a v_${VERSION_NUMBER}
git push --tags
#git tag -m "tagging" -a v_${VERSION_NUMBER}
#git push --tags
#Update release version and add next version on jira
#release version and add next version on jira
echo Full Success

View File

@ -1,4 +1,4 @@
Copyright (c) 2004-2007 QOS.ch
Copyright (c) 2004-2023 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining

View File

@ -7,7 +7,8 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.8.0-beta4</version>
<version>2.0.19-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>slf4j-api</artifactId>
@ -21,7 +22,7 @@
<properties>
<module-name>org.slf4j</module-name>
</properties>
<build>
<plugins>
<plugin>
@ -41,17 +42,38 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<executions>
<execution>
<id>bundle-test-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Import-Package>org.slf4j.spi;version="${range;[===,+);${version_cleanup;${project.version}}}"</Import-Package>
<!-- Export the client/user package of slf4j-api version 1 to make the slf4j-api bundle in version 2 usable for bundles that only import slf4j-1.x -->
<_exportcontents><![CDATA[
*,\
org.slf4j;version="${latest.1.version}",\
org.slf4j.helpers;version="${latest.1.version}"
]]></_exportcontents>
<Require-Capability><![CDATA[
osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.processor)(version>=1.0.0)(!(version>=2.0.0)))",
osgi.serviceloader;filter:="(osgi.serviceloader=org.slf4j.spi.SLF4JServiceProvider)";osgi.serviceloader="org.slf4j.spi.SLF4JServiceProvider"
]]></Require-Capability>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -29,7 +29,7 @@ package org.slf4j;
* instances by name.
*
* <p>Most users retrieve {@link Logger} instances through the static
* {@link LoggerFactory#getLogger(String)} method. An instance of of this
* {@link LoggerFactory#getLogger(String)} method. An instance of this
* interface is bound internally with {@link LoggerFactory} class at
* compile time.
*

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2004-2011 QOS.ch
* Copyright (c) 2004-2022 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
@ -25,12 +25,29 @@
package org.slf4j;
import static org.slf4j.event.EventConstants.DEBUG_INT;
import static org.slf4j.event.EventConstants.ERROR_INT;
import static org.slf4j.event.EventConstants.INFO_INT;
import static org.slf4j.event.EventConstants.TRACE_INT;
import static org.slf4j.event.EventConstants.WARN_INT;
import static org.slf4j.event.Level.DEBUG;
import static org.slf4j.event.Level.ERROR;
import static org.slf4j.event.Level.INFO;
import static org.slf4j.event.Level.TRACE;
import static org.slf4j.event.Level.WARN;
import org.slf4j.event.Level;
import org.slf4j.helpers.CheckReturnValue;
import org.slf4j.spi.DefaultLoggingEventBuilder;
import org.slf4j.spi.LoggingEventBuilder;
import org.slf4j.spi.NOPLoggingEventBuilder;
/**
* The org.slf4j.Logger interface is the main user entry point of SLF4J API.
* It is expected that logging takes place through concrete implementations
* of this interface.
* <p/>
* <h3>Typical usage pattern:</h3>
*
* <H3>Typical usage pattern:</H3>
* <pre>
* import org.slf4j.Logger;
* import org.slf4j.LoggerFactory;
@ -45,26 +62,29 @@ package org.slf4j;
* oldT = t;
* t = temperature;
* <span style="color:green">logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT);</span>
* if(temperature.intValue() > 50) {
* if (temperature.intValue() &gt; 50) {
* <span style="color:green">logger.info("Temperature has risen above 50 degrees.");</span>
* }
* }
* }
* </pre>
*
* Be sure to read the FAQ entry relating to <a href="../../../faq.html#logging_performance">parameterized
* <p>Note that version 2.0 of the SLF4J API introduces a <a href="../../../manual.html#fluent">fluent api</a>,
* the most significant API change to occur in the last 20 years.
*
* <p>Be sure to read the FAQ entry relating to <a href="../../../faq.html#logging_performance">parameterized
* logging</a>. Note that logging statements can be parameterized in
* <a href="../../../faq.html#paramException">presence of an exception/throwable</a>.
*
* <p>Once you are comfortable using loggers, i.e. instances of this interface, consider using
* <a href="MDC.html">MDC</a> as well as <a href="Marker.html">Markers</a>.</p>
* <a href="MDC.html">MDC</a> as well as <a href="Marker.html">Markers</a>.
*
* @author Ceki G&uuml;lc&uuml;
*/
public interface Logger {
/**
* Case insensitive String constant used to retrieve the name of the root logger.
* Case-insensitive String constant used to retrieve the name of the root logger.
*
* @since 1.3
*/
@ -76,6 +96,70 @@ public interface Logger {
*/
public String getName();
/**
* <p>Make a new {@link LoggingEventBuilder} instance as appropriate for this logger implementation.
* This default implementation always returns a new instance of {@link DefaultLoggingEventBuilder}.</p>
* <p></p>
* <p>This method is intended to be used by logging systems implementing the SLF4J API and <b>not</b>
* by end users.</p>
* <p></p>
* <p>Also note that a {@link LoggingEventBuilder} instance should be built for all levels,
* independently of the level argument. In other words, this method is an <b>unconditional</b>
* constructor for the {@link LoggingEventBuilder} appropriate for this logger implementation.</p>
* <p></p>
* @param level desired level for the event builder
* @return a new {@link LoggingEventBuilder} instance as appropriate for <b>this</b> logger
* @since 2.0
*/
default public LoggingEventBuilder makeLoggingEventBuilder(Level level) {
return new DefaultLoggingEventBuilder(this, level);
}
/**
* Make a new {@link LoggingEventBuilder} instance as appropriate for this logger and the
* desired {@link Level} passed as parameter. If this Logger is disabled for the given Level, then
* a {@link NOPLoggingEventBuilder} is returned.
*
*
* @param level desired level for the event builder
* @return a new {@link LoggingEventBuilder} instance as appropriate for this logger
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atLevel(Level level) {
if (isEnabledForLevel(level)) {
return makeLoggingEventBuilder(level);
} else {
return NOPLoggingEventBuilder.singleton();
}
}
/**
* Returns whether this Logger is enabled for a given {@link Level}.
*
* @param level
* @return true if enabled, false otherwise.
*/
default public boolean isEnabledForLevel(Level level) {
int levelInt = level.toInt();
switch (levelInt) {
case (TRACE_INT):
return isTraceEnabled();
case (DEBUG_INT):
return isDebugEnabled();
case (INFO_INT):
return isInfoEnabled();
case (WARN_INT):
return isWarnEnabled();
case (ERROR_INT):
return isErrorEnabled();
default:
throw new IllegalArgumentException("Level [" + level + "] not recognized.");
}
}
/**
* Is the logger instance enabled for the TRACE level?
*
@ -96,9 +180,9 @@ public interface Logger {
/**
* Log a message at the TRACE level according to the specified format
* and argument.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the TRACE level. </p>
* is disabled for the TRACE level.
*
* @param format the format string
* @param arg the argument
@ -109,9 +193,9 @@ public interface Logger {
/**
* Log a message at the TRACE level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the TRACE level. </p>
* is disabled for the TRACE level.
*
* @param format the format string
* @param arg1 the first argument
@ -123,12 +207,12 @@ public interface Logger {
/**
* Log a message at the TRACE level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous string concatenation when the logger
* is disabled for the TRACE level. However, this variant incurs the hidden
* (and relatively small) cost of creating an <code>Object[]</code> before invoking the method,
* even if this logger is disabled for TRACE. The variants taking {@link #trace(String, Object) one} and
* {@link #trace(String, Object, Object) two} arguments exist solely in order to avoid this hidden cost.</p>
* {@link #trace(String, Object, Object) two} arguments exist solely in order to avoid this hidden cost.
*
* @param format the format string
* @param arguments a list of 3 or more arguments
@ -158,6 +242,21 @@ public interface Logger {
*/
public boolean isTraceEnabled(Marker marker);
/**
* Entry point for fluent-logging for {@link org.slf4j.event.Level#TRACE} level.
*
* @return LoggingEventBuilder instance as appropriate for level TRACE
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atTrace() {
if (isTraceEnabled()) {
return makeLoggingEventBuilder(TRACE);
} else {
return NOPLoggingEventBuilder.singleton();
}
}
/**
* Log a message with the specific Marker at the TRACE level.
*
@ -232,9 +331,9 @@ public interface Logger {
/**
* Log a message at the DEBUG level according to the specified format
* and argument.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the DEBUG level. </p>
* is disabled for the DEBUG level.
*
* @param format the format string
* @param arg the argument
@ -244,9 +343,9 @@ public interface Logger {
/**
* Log a message at the DEBUG level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the DEBUG level. </p>
* is disabled for the DEBUG level.
*
* @param format the format string
* @param arg1 the first argument
@ -257,13 +356,13 @@ public interface Logger {
/**
* Log a message at the DEBUG level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous string concatenation when the logger
* is disabled for the DEBUG level. However, this variant incurs the hidden
* (and relatively small) cost of creating an <code>Object[]</code> before invoking the method,
* even if this logger is disabled for DEBUG. The variants taking
* {@link #debug(String, Object) one} and {@link #debug(String, Object, Object) two}
* arguments exist solely in order to avoid this hidden cost.</p>
* arguments exist solely in order to avoid this hidden cost.
*
* @param format the format string
* @param arguments a list of 3 or more arguments
@ -340,6 +439,21 @@ public interface Logger {
*/
public void debug(Marker marker, String msg, Throwable t);
/**
* Entry point for fluent-logging for {@link org.slf4j.event.Level#DEBUG} level.
*
* @return LoggingEventBuilder instance as appropriate for level DEBUG
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atDebug() {
if (isDebugEnabled()) {
return makeLoggingEventBuilder(DEBUG);
} else {
return NOPLoggingEventBuilder.singleton();
}
}
/**
* Is the logger instance enabled for the INFO level?
*
@ -358,9 +472,9 @@ public interface Logger {
/**
* Log a message at the INFO level according to the specified format
* and argument.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the INFO level. </p>
* is disabled for the INFO level.
*
* @param format the format string
* @param arg the argument
@ -370,9 +484,9 @@ public interface Logger {
/**
* Log a message at the INFO level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the INFO level. </p>
* is disabled for the INFO level.
*
* @param format the format string
* @param arg1 the first argument
@ -383,13 +497,13 @@ public interface Logger {
/**
* Log a message at the INFO level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous string concatenation when the logger
* is disabled for the INFO level. However, this variant incurs the hidden
* (and relatively small) cost of creating an <code>Object[]</code> before invoking the method,
* even if this logger is disabled for INFO. The variants taking
* {@link #info(String, Object) one} and {@link #info(String, Object, Object) two}
* arguments exist solely in order to avoid this hidden cost.</p>
* arguments exist solely in order to avoid this hidden cost.
*
* @param format the format string
* @param arguments a list of 3 or more arguments
@ -410,7 +524,8 @@ public interface Logger {
* data is also taken into consideration.
*
* @param marker The marker data to take into consideration
* @return true if this logger is warn enabled, false otherwise
* @return true if this Logger is enabled for the INFO level,
* false otherwise.
*/
public boolean isInfoEnabled(Marker marker);
@ -465,6 +580,21 @@ public interface Logger {
*/
public void info(Marker marker, String msg, Throwable t);
/**
* Entry point for fluent-logging for {@link org.slf4j.event.Level#INFO} level.
*
* @return LoggingEventBuilder instance as appropriate for level INFO
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atInfo() {
if (isInfoEnabled()) {
return makeLoggingEventBuilder(INFO);
} else {
return NOPLoggingEventBuilder.singleton();
}
}
/**
* Is the logger instance enabled for the WARN level?
*
@ -483,9 +613,9 @@ public interface Logger {
/**
* Log a message at the WARN level according to the specified format
* and argument.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the WARN level. </p>
* is disabled for the WARN level.
*
* @param format the format string
* @param arg the argument
@ -495,13 +625,13 @@ public interface Logger {
/**
* Log a message at the WARN level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous string concatenation when the logger
* is disabled for the WARN level. However, this variant incurs the hidden
* (and relatively small) cost of creating an <code>Object[]</code> before invoking the method,
* even if this logger is disabled for WARN. The variants taking
* {@link #warn(String, Object) one} and {@link #warn(String, Object, Object) two}
* arguments exist solely in order to avoid this hidden cost.</p>
* arguments exist solely in order to avoid this hidden cost.
*
* @param format the format string
* @param arguments a list of 3 or more arguments
@ -511,9 +641,9 @@ public interface Logger {
/**
* Log a message at the WARN level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the WARN level. </p>
* is disabled for the WARN level.
*
* @param format the format string
* @param arg1 the first argument
@ -591,6 +721,21 @@ public interface Logger {
*/
public void warn(Marker marker, String msg, Throwable t);
/**
* Entry point for fluent-logging for {@link org.slf4j.event.Level#WARN} level.
*
* @return LoggingEventBuilder instance as appropriate for level WARN
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atWarn() {
if (isWarnEnabled()) {
return makeLoggingEventBuilder(WARN);
} else {
return NOPLoggingEventBuilder.singleton();
}
}
/**
* Is the logger instance enabled for the ERROR level?
*
@ -609,9 +754,9 @@ public interface Logger {
/**
* Log a message at the ERROR level according to the specified format
* and argument.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the ERROR level. </p>
* is disabled for the ERROR level.
*
* @param format the format string
* @param arg the argument
@ -621,9 +766,9 @@ public interface Logger {
/**
* Log a message at the ERROR level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous object creation when the logger
* is disabled for the ERROR level. </p>
* is disabled for the ERROR level.
*
* @param format the format string
* @param arg1 the first argument
@ -634,13 +779,13 @@ public interface Logger {
/**
* Log a message at the ERROR level according to the specified format
* and arguments.
* <p/>
*
* <p>This form avoids superfluous string concatenation when the logger
* is disabled for the ERROR level. However, this variant incurs the hidden
* (and relatively small) cost of creating an <code>Object[]</code> before invoking the method,
* even if this logger is disabled for ERROR. The variants taking
* {@link #error(String, Object) one} and {@link #error(String, Object, Object) two}
* arguments exist solely in order to avoid this hidden cost.</p>
* arguments exist solely in order to avoid this hidden cost.
*
* @param format the format string
* @param arguments a list of 3 or more arguments
@ -718,4 +863,19 @@ public interface Logger {
*/
public void error(Marker marker, String msg, Throwable t);
/**
* Entry point for fluent-logging for {@link org.slf4j.event.Level#ERROR} level.
*
* @return LoggingEventBuilder instance as appropriate for level ERROR
* @since 2.0
*/
@CheckReturnValue
default public LoggingEventBuilder atError() {
if (isErrorEnabled()) {
return makeLoggingEventBuilder(ERROR);
} else {
return NOPLoggingEventBuilder.singleton();
}
}
}

View File

@ -25,54 +25,56 @@
package org.slf4j;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import org.slf4j.event.SubstituteLoggingEvent;
import org.slf4j.helpers.NOPServiceProvider;
import org.slf4j.helpers.SubstituteServiceProvider;
import org.slf4j.helpers.NOP_FallbackServiceProvider;
import org.slf4j.helpers.Reporter;
import org.slf4j.helpers.SubstituteLogger;
import org.slf4j.helpers.SubstituteServiceProvider;
import org.slf4j.helpers.Util;
import org.slf4j.spi.MDCAdapter;
import org.slf4j.spi.SLF4JServiceProvider;
/**
* The <code>LoggerFactory</code> is a utility class producing Loggers for
* various logging APIs, most notably for log4j, logback and JDK 1.4 logging.
* Other implementations such as {@link org.slf4j.impl.NOPLogger NOPLogger} and
* {@link org.slf4j.impl.SimpleLogger SimpleLogger} are also supported.
* <p/>
* <p/>
* <code>LoggerFactory</code> is essentially a wrapper around an
* {@link ILoggerFactory} instance bound with <code>LoggerFactory</code> at
* compile time.
* <p/>
* <p/>
* various logging APIs, e.g. logback, reload4j, log4j and JDK 1.4 logging.
* Other implementations such as {@link org.slf4j.helpers.NOPLogger NOPLogger} and
* SimpleLogger are also supported.
*
* <p><code>LoggerFactory</code> is essentially a wrapper around an
* {@link ILoggerFactory} instance provided by a {@link SLF4JServiceProvider}.
*
* <p>
* Please note that all methods in <code>LoggerFactory</code> are static.
*
*
*
* @author Alexander Dorokhine
* @author Robert Elliot
* @author Ceki G&uuml;lc&uuml;
*
*
*/
public final class LoggerFactory {
static final String CODES_PREFIX = "http://www.slf4j.org/codes.html";
static final String CODES_PREFIX = "https://www.slf4j.org/codes.html";
static final String NO_PROVIDERS_URL = CODES_PREFIX + "#noProviders";
static final String IGNORED_BINDINGS_URL = CODES_PREFIX + "#ignoredBindings";
static final String NO_STATICLOGGERBINDER_URL = CODES_PREFIX + "#StaticLoggerBinder";
static final String MULTIPLE_BINDINGS_URL = CODES_PREFIX + "#multiple_bindings";
static final String NULL_LF_URL = CODES_PREFIX + "#null_LF";
static final String VERSION_MISMATCH = CODES_PREFIX + "#version_mismatch";
static final String SUBSTITUTE_LOGGER_URL = CODES_PREFIX + "#substituteLogger";
static final String LOGGER_NAME_MISMATCH_URL = CODES_PREFIX + "#loggerNameMismatch";
@ -82,6 +84,16 @@ public final class LoggerFactory {
static final String UNSUCCESSFUL_INIT_MSG = "org.slf4j.LoggerFactory in failed state. Original exception was thrown EARLIER. See also "
+ UNSUCCESSFUL_INIT_URL;
static final String CONNECTED_WITH_MSG = "Connected with provider of type [";
/**
* System property for explicitly setting the provider class. If set and the provider could be instantiated,
* then the service loading mechanism will be bypassed.
*
* @since 2.0.9
*/
static final public String PROVIDER_PROPERTY_KEY = "slf4j.provider";
static final int UNINITIALIZED = 0;
static final int ONGOING_INITIALIZATION = 1;
static final int FAILED_INITIALIZATION = 2;
@ -90,7 +102,7 @@ public final class LoggerFactory {
static volatile int INITIALIZATION_STATE = UNINITIALIZED;
static final SubstituteServiceProvider SUBST_PROVIDER = new SubstituteServiceProvider();
static final NOPServiceProvider NOP_FALLBACK_FACTORY = new NOPServiceProvider();
static final NOP_FallbackServiceProvider NOP_FALLBACK_SERVICE_PROVIDER = new NOP_FallbackServiceProvider();
// Support for detecting mismatched logger names.
static final String DETECT_LOGGER_NAME_MISMATCH_PROPERTY = "slf4j.detectLoggerNameMismatch";
@ -100,23 +112,57 @@ public final class LoggerFactory {
static volatile SLF4JServiceProvider PROVIDER;
private static List<SLF4JServiceProvider> findServiceProviders() {
ServiceLoader<SLF4JServiceProvider> serviceLoader = ServiceLoader.load(SLF4JServiceProvider.class);
List<SLF4JServiceProvider> providerList = new ArrayList<SLF4JServiceProvider>();
for (SLF4JServiceProvider provider : serviceLoader) {
providerList.add(provider);
// Package access for tests
static List<SLF4JServiceProvider> findServiceProviders() {
List<SLF4JServiceProvider> providerList = new ArrayList<>();
// retain behaviour similar to that of 1.7 series and earlier. More specifically, use the class loader that
// loaded the present class to search for services
final ClassLoader classLoaderOfLoggerFactory = LoggerFactory.class.getClassLoader();
SLF4JServiceProvider explicitProvider = loadExplicitlySpecified(classLoaderOfLoggerFactory);
if(explicitProvider != null) {
providerList.add(explicitProvider);
return providerList;
}
ServiceLoader<SLF4JServiceProvider> serviceLoader = getServiceLoader(classLoaderOfLoggerFactory);
Iterator<SLF4JServiceProvider> iterator = serviceLoader.iterator();
while (iterator.hasNext()) {
safelyInstantiate(providerList, iterator);
}
return providerList;
}
private static ServiceLoader<SLF4JServiceProvider> getServiceLoader(final ClassLoader classLoaderOfLoggerFactory) {
ServiceLoader<SLF4JServiceProvider> serviceLoader;
SecurityManager securityManager = System.getSecurityManager();
if(securityManager == null) {
serviceLoader = ServiceLoader.load(SLF4JServiceProvider.class, classLoaderOfLoggerFactory);
} else {
final PrivilegedAction<ServiceLoader<SLF4JServiceProvider>> action = () -> ServiceLoader.load(SLF4JServiceProvider.class, classLoaderOfLoggerFactory);
serviceLoader = AccessController.doPrivileged(action);
}
return serviceLoader;
}
private static void safelyInstantiate(List<SLF4JServiceProvider> providerList, Iterator<SLF4JServiceProvider> iterator) {
try {
SLF4JServiceProvider provider = iterator.next();
providerList.add(provider);
} catch (ServiceConfigurationError e) {
Reporter.error("A service provider failed to instantiate:\n" + e.getMessage());
}
}
/**
* It is LoggerFactory's responsibility to track version changes and manage
* the compatibility list.
* <p/>
* <p/>
* It is assumed that all versions in the 1.6 are mutually compatible.
* <p>
*/
static private final String[] API_COMPATIBILITY_LIST = new String[] { "1.8", "1.7" };
static private final String[] API_COMPATIBILITY_LIST = new String[] { "2.0" };
// private constructor prevents instantiation
private LoggerFactory() {
@ -124,13 +170,13 @@ public final class LoggerFactory {
/**
* Force LoggerFactory to consider itself uninitialized.
* <p/>
* <p/>
* <p>
* <p>
* This method is intended to be called by classes (in the same package) for
* testing purposes. This method is internal. It can be modified, renamed or
* removed at any time without notice.
* <p/>
* <p/>
* <p>
* <p>
* You are strongly discouraged from calling this method in production code.
*/
static void reset() {
@ -149,51 +195,86 @@ public final class LoggerFactory {
List<SLF4JServiceProvider> providersList = findServiceProviders();
reportMultipleBindingAmbiguity(providersList);
if (providersList != null && !providersList.isEmpty()) {
PROVIDER = providersList.get(0);
PROVIDER.initialize();
INITIALIZATION_STATE = SUCCESSFUL_INITIALIZATION;
PROVIDER = providersList.get(0);
earlyBindMDCAdapter();
// SLF4JServiceProvider.initialize() is intended to be called here and nowhere else.
PROVIDER.initialize();
INITIALIZATION_STATE = SUCCESSFUL_INITIALIZATION;
reportActualBinding(providersList);
fixSubstituteLoggers();
replayEvents();
// release all resources in SUBST_FACTORY
SUBST_PROVIDER.getSubstituteLoggerFactory().clear();
} else {
INITIALIZATION_STATE = NOP_FALLBACK_INITIALIZATION;
Util.report("No SLF4J providers were found.");
Util.report("Defaulting to no-operation (NOP) logger implementation");
Util.report("See " + NO_PROVIDERS_URL + " for further details.");
Reporter.warn("No SLF4J providers were found.");
Reporter.warn("Defaulting to no-operation (NOP) logger implementation");
Reporter.warn("See " + NO_PROVIDERS_URL + " for further details.");
Set<URL> staticLoggerBinderPathSet = findPossibleStaticLoggerBinderPathSet();
reportIgnoredStaticLoggerBinders(staticLoggerBinderPathSet);
}
postBindCleanUp();
} catch (Exception e) {
failedBinding(e);
throw new IllegalStateException("Unexpected initialization failure", e);
}
}
/**
* The value of PROVIDER.getMDCAdapter() can be null while PROVIDER has not yet initialized.
*
* However, SLF4JServiceProvider implementations are expected to initialize their internal
* MDCAdapter field in their constructor or on field declaration.
*/
private static void earlyBindMDCAdapter() {
MDCAdapter mdcAdapter = PROVIDER.getMDCAdapter();
if(mdcAdapter != null) {
MDC.setMDCAdapter(mdcAdapter);
}
}
static SLF4JServiceProvider loadExplicitlySpecified(ClassLoader classLoader) {
String explicitlySpecified = System.getProperty(PROVIDER_PROPERTY_KEY);
if (null == explicitlySpecified || explicitlySpecified.isEmpty()) {
return null;
}
try {
String message = String.format("Attempting to load provider \"%s\" specified via \"%s\" system property", explicitlySpecified, PROVIDER_PROPERTY_KEY);
Reporter.info(message);
Class<?> clazz = classLoader.loadClass(explicitlySpecified);
Constructor<?> constructor = clazz.getConstructor();
Object provider = constructor.newInstance();
return (SLF4JServiceProvider) provider;
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
String message = String.format("Failed to instantiate the specified SLF4JServiceProvider (%s)", explicitlySpecified);
Reporter.error(message, e);
return null;
} catch (ClassCastException e) {
String message = String.format("Specified SLF4JServiceProvider (%s) does not implement SLF4JServiceProvider interface", explicitlySpecified);
Reporter.error(message, e);
return null;
}
}
private static void reportIgnoredStaticLoggerBinders(Set<URL> staticLoggerBinderPathSet) {
if (staticLoggerBinderPathSet.isEmpty()) {
return;
}
Util.report("Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.");
Reporter.warn("Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.");
for (URL path : staticLoggerBinderPathSet) {
Util.report("Ignoring binding found at [" + path + "]");
Reporter.warn("Ignoring binding found at [" + path + "]");
}
Util.report("See " + IGNORED_BINDINGS_URL + " for an explanation.");
Reporter.warn("See " + IGNORED_BINDINGS_URL + " for an explanation.");
}
// We need to use the name of the StaticLoggerBinder class, but we can't
// reference the class itself.
private static String STATIC_LOGGER_BINDER_PATH = "org/slf4j/impl/StaticLoggerBinder.class";
private static final String STATIC_LOGGER_BINDER_PATH = "org/slf4j/impl/StaticLoggerBinder.class";
static Set<URL> findPossibleStaticLoggerBinderPathSet() {
// use Set instead of list in order to deal with bug #138
// LinkedHashSet appropriate here because it preserves insertion order
// during iteration
Set<URL> staticLoggerBinderPathSet = new LinkedHashSet<URL>();
Set<URL> staticLoggerBinderPathSet = new LinkedHashSet<>();
try {
ClassLoader loggerFactoryClassLoader = LoggerFactory.class.getClassLoader();
Enumeration<URL> paths;
@ -207,11 +288,18 @@ public final class LoggerFactory {
staticLoggerBinderPathSet.add(path);
}
} catch (IOException ioe) {
Util.report("Error getting resources from path", ioe);
Reporter.error("Error getting resources from path", ioe);
}
return staticLoggerBinderPathSet;
}
private static void postBindCleanUp() {
fixSubstituteLoggers();
replayEvents();
// release all resources in SUBST_FACTORY
SUBST_PROVIDER.getSubstituteLoggerFactory().clear();
}
private static void fixSubstituteLoggers() {
synchronized (SUBST_PROVIDER) {
SUBST_PROVIDER.getSubstituteLoggerFactory().postInitialization();
@ -225,7 +313,7 @@ public final class LoggerFactory {
static void failedBinding(Throwable t) {
INITIALIZATION_STATE = FAILED_INITIALIZATION;
Util.report("Failed to instantiate SLF4J LoggerFactory", t);
Reporter.error("Failed to instantiate SLF4J LoggerFactory", t);
}
private static void replayEvents() {
@ -233,7 +321,7 @@ public final class LoggerFactory {
final int queueSize = queue.size();
int count = 0;
final int maxDrain = 128;
List<SubstituteLoggingEvent> eventList = new ArrayList<SubstituteLoggingEvent>(maxDrain);
List<SubstituteLoggingEvent> eventList = new ArrayList<>(maxDrain);
while (true) {
int numDrained = queue.drainTo(eventList, maxDrain);
if (numDrained == 0)
@ -270,29 +358,31 @@ public final class LoggerFactory {
if (substLogger.isDelegateNOP()) {
// nothing to do
} else if (substLogger.isDelegateEventAware()) {
substLogger.log(event);
if(substLogger.isEnabledForLevel(event.getLevel())) {
substLogger.log(event);
}
} else {
Util.report(loggerName);
Reporter.warn(loggerName);
}
}
private static void emitSubstitutionWarning() {
Util.report("The following set of substitute loggers may have been accessed");
Util.report("during the initialization phase. Logging calls during this");
Util.report("phase were not honored. However, subsequent logging calls to these");
Util.report("loggers will work as normally expected.");
Util.report("See also " + SUBSTITUTE_LOGGER_URL);
Reporter.warn("The following set of substitute loggers may have been accessed");
Reporter.warn("during the initialization phase. Logging calls during this");
Reporter.warn("phase were not honored. However, subsequent logging calls to these");
Reporter.warn("loggers will work as normally expected.");
Reporter.warn("See also " + SUBSTITUTE_LOGGER_URL);
}
private static void emitReplayWarning(int eventCount) {
Util.report("A number (" + eventCount + ") of logging calls during the initialization phase have been intercepted and are");
Util.report("now being replayed. These are subject to the filtering rules of the underlying logging system.");
Util.report("See also " + REPLAY_URL);
Reporter.warn("A number (" + eventCount + ") of logging calls during the initialization phase have been intercepted and are");
Reporter.warn("now being replayed. These are subject to the filtering rules of the underlying logging system.");
Reporter.warn("See also " + REPLAY_URL);
}
private final static void versionSanityCheck() {
try {
String requested = PROVIDER.getRequesteApiVersion();
String requested = PROVIDER.getRequestedApiVersion();
boolean match = false;
for (String aAPI_COMPATIBILITY_LIST : API_COMPATIBILITY_LIST) {
@ -301,18 +391,13 @@ public final class LoggerFactory {
}
}
if (!match) {
Util.report("The requested version " + requested + " by your slf4j binding is not compatible with "
Reporter.warn("The requested version " + requested + " by your slf4j provider is not compatible with "
+ Arrays.asList(API_COMPATIBILITY_LIST).toString());
Util.report("See " + VERSION_MISMATCH + " for further details.");
Reporter.warn("See " + VERSION_MISMATCH + " for further details.");
}
} catch (java.lang.NoSuchFieldError nsfe) {
// given our large user base and SLF4J's commitment to backward
// compatibility, we cannot cry here. Only for implementations
// which willingly declare a REQUESTED_API_VERSION field do we
// emit compatibility warnings.
} catch (Throwable e) {
// we should never reach here
Util.report("Unexpected problem occured during version sanity check", e);
Reporter.error("Unexpected problem occurred during version sanity check", e);
}
}
@ -323,29 +408,36 @@ public final class LoggerFactory {
/**
* Prints a warning message on the console if multiple bindings were found
* on the class path. No reporting is done otherwise.
*
*
*/
private static void reportMultipleBindingAmbiguity(List<SLF4JServiceProvider> providerList) {
if (isAmbiguousProviderList(providerList)) {
Util.report("Class path contains multiple SLF4J providers.");
Reporter.warn("Class path contains multiple SLF4J providers.");
for (SLF4JServiceProvider provider : providerList) {
Util.report("Found provider [" + provider + "]");
Reporter.warn("Found provider [" + provider + "]");
}
Util.report("See " + MULTIPLE_BINDINGS_URL + " for an explanation.");
Reporter.warn("See " + MULTIPLE_BINDINGS_URL + " for an explanation.");
}
}
private static void reportActualBinding(List<SLF4JServiceProvider> providerList) {
// binderPathSet can be null under Android
if (!providerList.isEmpty() && isAmbiguousProviderList(providerList)) {
Util.report("Actual provider is of type [" + providerList.get(0) + "]");
// impossible since a provider has been found
if (providerList.isEmpty()) {
throw new IllegalStateException("No providers were found which is impossible after successful initialization.");
}
if (isAmbiguousProviderList(providerList)) {
Reporter.info("Actual provider is of type [" + providerList.get(0) + "]");
} else {
SLF4JServiceProvider provider = providerList.get(0);
Reporter.debug(CONNECTED_WITH_MSG + provider.getClass().getName() + "]");
}
}
/**
* Return a logger named according to the name parameter using the
* statically bound {@link ILoggerFactory} instance.
*
*
* @param name
* The name of the logger.
* @return logger
@ -358,20 +450,20 @@ public final class LoggerFactory {
/**
* Return a logger named corresponding to the class passed as parameter,
* using the statically bound {@link ILoggerFactory} instance.
*
*
* <p>
* In case the the <code>clazz</code> parameter differs from the name of the
* In case the <code>clazz</code> parameter differs from the name of the
* caller as computed internally by SLF4J, a logger name mismatch warning
* will be printed but only if the
* <code>slf4j.detectLoggerNameMismatch</code> system property is set to
* true. By default, this property is not set and no warnings will be
* printed even in case of a logger name mismatch.
*
*
* @param clazz
* the returned logger will be named after clazz
* @return logger
*
*
*
*
* @see <a
* href="http://www.slf4j.org/codes.html#loggerNameMismatch">Detected
* logger name mismatch</a>
@ -381,9 +473,9 @@ public final class LoggerFactory {
if (DETECT_LOGGER_NAME_MISMATCH) {
Class<?> autoComputedCallingClass = Util.getCallingClass();
if (autoComputedCallingClass != null && nonMatchingClasses(clazz, autoComputedCallingClass)) {
Util.report(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),
Reporter.warn(String.format("Detected logger name mismatch. Given name: \"%s\"; computed name: \"%s\".", logger.getName(),
autoComputedCallingClass.getName()));
Util.report("See " + LOGGER_NAME_MISMATCH_URL + " for an explanation");
Reporter.warn("See " + LOGGER_NAME_MISMATCH_URL + " for an explanation");
}
}
return logger;
@ -395,10 +487,10 @@ public final class LoggerFactory {
/**
* Return the {@link ILoggerFactory} instance in use.
* <p/>
* <p/>
* <p>
* <p>
* ILoggerFactory instance is bound with this class at compile time.
*
*
* @return the ILoggerFactory instance in use
*/
public static ILoggerFactory getILoggerFactory() {
@ -424,7 +516,7 @@ public final class LoggerFactory {
case SUCCESSFUL_INITIALIZATION:
return PROVIDER;
case NOP_FALLBACK_INITIALIZATION:
return NOP_FALLBACK_FACTORY;
return NOP_FALLBACK_SERVICE_PROVIDER;
case FAILED_INITIALIZATION:
throw new IllegalStateException(UNSUCCESSFUL_INIT_MSG);
case ONGOING_INITIALIZATION:

View File

@ -1,11 +1,35 @@
/**
* Copyright (c) 2004-2021 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package org.slf4j;
/**
* All methods in this class are reserved for internal use, for testing purposes.
* <p/>
* <p/>They can can be modified, renamed or removed at any time without notice.
* <p/>
* You are strongly discouraged calling any of the methods of this class.
*
* <p>They can be modified, renamed or removed at any time without notice.
*
* <p>You are strongly discouraged calling any of the methods of this class.
*
* @since 1.8.0
*
@ -14,7 +38,7 @@ package org.slf4j;
public class LoggerFactoryFriend {
/*
* Force LoggerFactory to consider itself uninitialized. <p/>
* Force LoggerFactory to consider itself uninitialized.
*/
static public void reset() {
LoggerFactory.reset();
@ -23,7 +47,7 @@ public class LoggerFactoryFriend {
/**
* Set LoggerFactory.DETECT_LOGGER_NAME_MISMATCH variable.
*
* @param enabled
* @param enabled a boolean
*/
public static void setDetectLoggerNameMismatch(boolean enabled) {
LoggerFactory.DETECT_LOGGER_NAME_MISMATCH = enabled;

View File

@ -25,11 +25,10 @@
package org.slf4j;
import java.io.Closeable;
import java.util.Deque;
import java.util.Map;
import org.slf4j.helpers.BasicMDCAdapter;
import org.slf4j.helpers.NOPMDCAdapter;
import org.slf4j.helpers.Util;
import org.slf4j.helpers.*;
import org.slf4j.spi.MDCAdapter;
import org.slf4j.spi.SLF4JServiceProvider;
@ -64,8 +63,9 @@ import org.slf4j.spi.SLF4JServiceProvider;
public class MDC {
static final String NULL_MDCA_URL = "http://www.slf4j.org/codes.html#null_MDCA";
private static final String MDC_ADAPTER_CANNOT_BE_NULL_MESSAGE = "MDCAdapter cannot be null. See also " + NULL_MDCA_URL;
static final String NO_STATIC_MDC_BINDER_URL = "http://www.slf4j.org/codes.html#no_static_mdc_binder";
static MDCAdapter mdcAdapter;
static MDCAdapter MDC_ADAPTER;
/**
* An adapter to remove the key when done.
@ -85,14 +85,30 @@ public class MDC {
private MDC() {
}
static {
private static MDCAdapter getMDCAdapterGivenByProvider() {
SLF4JServiceProvider provider = LoggerFactory.getProvider();
if (provider != null) {
mdcAdapter = provider.getMDCAdapter();
if(provider != null) {
// If you wish to change the mdc adapter, setting the MDC.MDCAdapter variable might be insufficient.
// Keep in mind that the provider *might* perform additional internal mdcAdapter assignments that
// you would also need to replicate/adapt.
// obtain and attach the MDCAdapter from the provider
final MDCAdapter anAdapter = provider.getMDCAdapter();
emitTemporaryMDCAdapterWarningIfNeeded(provider);
return anAdapter;
} else {
Util.report("Failed to find provider.");
Util.report("Defaulting to no-operation MDCAdapter implementation.");
mdcAdapter = new NOPMDCAdapter();
Reporter.error("Failed to find provider.");
Reporter.error("Defaulting to no-operation MDCAdapter implementation.");
return new NOPMDCAdapter();
}
}
private static void emitTemporaryMDCAdapterWarningIfNeeded(SLF4JServiceProvider provider) {
boolean isSubstitute = provider instanceof SubstituteServiceProvider;
if(isSubstitute) {
Reporter.info("Temporary mdcAdapter given by SubstituteServiceProvider.");
Reporter.info("This mdcAdapter will be replaced after backend initialization has completed.");
}
}
@ -115,10 +131,10 @@ public class MDC {
if (key == null) {
throw new IllegalArgumentException("key parameter cannot be null");
}
if (mdcAdapter == null) {
throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
if (getMDCAdapter() == null) {
throw new IllegalStateException(MDC_ADAPTER_CANNOT_BE_NULL_MESSAGE);
}
mdcAdapter.put(key, val);
getMDCAdapter().put(key, val);
}
/**
@ -161,7 +177,7 @@ public class MDC {
* <p>
* This method delegates all work to the MDC of the underlying logging system.
*
* @param key
* @param key a key
* @return the string value identified by the <code>key</code> parameter.
* @throws IllegalArgumentException
* in case the "key" parameter is null
@ -171,10 +187,8 @@ public class MDC {
throw new IllegalArgumentException("key parameter cannot be null");
}
if (mdcAdapter == null) {
throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
}
return mdcAdapter.get(key);
mdcAdapterNullCheck();
return getMDCAdapter().get(key);
}
/**
@ -183,7 +197,7 @@ public class MDC {
* cannot be null. This method does nothing if there is no previous value
* associated with <code>key</code>.
*
* @param key
* @param key a key
* @throws IllegalArgumentException
* in case the "key" parameter is null
*/
@ -192,20 +206,16 @@ public class MDC {
throw new IllegalArgumentException("key parameter cannot be null");
}
if (mdcAdapter == null) {
throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
}
mdcAdapter.remove(key);
mdcAdapterNullCheck();
getMDCAdapter().remove(key);
}
/**
* Clear all entries in the MDC of the underlying implementation.
*/
public static void clear() {
if (mdcAdapter == null) {
throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
}
mdcAdapter.clear();
mdcAdapterNullCheck();
getMDCAdapter().clear();
}
/**
@ -216,10 +226,8 @@ public class MDC {
* @since 1.5.1
*/
public static Map<String, String> getCopyOfContextMap() {
if (mdcAdapter == null) {
throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
}
return mdcAdapter.getCopyOfContextMap();
mdcAdapterNullCheck();
return getMDCAdapter().getCopyOfContextMap();
}
/**
@ -227,25 +235,86 @@ public class MDC {
* then copying the map passed as parameter. The context map passed as
* parameter must only contain keys and values of type String.
*
* Null valued argument is allowed (since SLF4J version 2.0.0).
*
* @param contextMap
* must contain only keys and values of type String
* @since 1.5.1
*/
public static void setContextMap(Map<String, String> contextMap) {
if (mdcAdapter == null) {
throw new IllegalStateException("MDCAdapter cannot be null. See also " + NULL_MDCA_URL);
}
mdcAdapter.setContextMap(contextMap);
mdcAdapterNullCheck();
getMDCAdapter().setContextMap(contextMap);
}
/**
* Returns the MDCAdapter instance currently in use.
*
*
* Since 2.0.17, if the MDCAdapter instance is null, then this method set it to use
* the adapter returned by the SLF4JProvider. However, in the vast majority of cases
* the MDCAdapter will be set earlier (during initialization) by {@link LoggerFactory}.
*
* @return the MDcAdapter instance currently in use.
* @since 1.4.2
*/
public static MDCAdapter getMDCAdapter() {
return mdcAdapter;
if(MDC_ADAPTER == null) {
MDC_ADAPTER = getMDCAdapterGivenByProvider();
}
return MDC_ADAPTER;
}
/**
* Set MDCAdapter instance to use.
*
* @since 2.0.17
*/
static void setMDCAdapter(MDCAdapter anMDCAdapter) {
if(anMDCAdapter == null) {
throw new IllegalStateException(MDC_ADAPTER_CANNOT_BE_NULL_MESSAGE);
}
MDC_ADAPTER = anMDCAdapter;
}
/**
* Push a value into the deque(stack) referenced by 'key'.
*
* @param key identifies the appropriate stack
* @param value the value to push into the stack
* @since 2.0.0
*/
static public void pushByKey(String key, String value) {
mdcAdapterNullCheck();
getMDCAdapter().pushByKey(key, value);
}
/**
* Pop the <b>stack</b> referenced by 'key' and return the value possibly null.
*
* @param key identifies the deque(stack)
* @return the value just popped. May be null/
* @since 2.0.0
*/
static public String popByKey(String key) {
mdcAdapterNullCheck();
return getMDCAdapter().popByKey(key);
}
/**
* Returns a copy of the <b>deque(stack)</b> referenced by 'key'. May be null.
*
* @param key identifies the stack
* @return copy of stack referenced by 'key'. May be null.
*
* @since 2.0.0
*/
public Deque<String> getCopyOfDequeByKey(String key) {
mdcAdapterNullCheck();
return getMDCAdapter().getCopyOfDequeByKey(key);
}
private static void mdcAdapterNullCheck() {
if (getMDCAdapter() == null) {
throw new IllegalStateException(MDC_ADAPTER_CANNOT_BE_NULL_MESSAGE);
}
}
}

View File

@ -29,14 +29,16 @@ import java.util.Iterator;
/**
* Markers are named objects used to enrich log statements. Conforming logging
* system Implementations of SLF4J determine how information conveyed by markers
* are used, if at all. In particular, many conforming logging systems ignore
* marker data.
*
* <p>
* Markers can contain references to other markers, which in turn may contain
* references of their own.
*
* system implementations of SLF4J should determine how information conveyed by
* any markers are used, if at all. Many conforming logging systems ignore marker
* data entirely.
*
* <p>Markers can contain references to nested markers, which in turn may
* contain references of their own. Note that the fluent API (new in 2.0) allows adding
* multiple markers to a logging statement. It is often preferable to use
* multiple markers instead of nested markers.
* </p>
*
* @author Ceki G&uuml;lc&uuml;
*/
public interface Marker extends Serializable {
@ -60,7 +62,11 @@ public interface Marker extends Serializable {
/**
* Add a reference to another Marker.
*
*
* <p>Note that the fluent API allows adding multiple markers to a logging statement.
* It is often preferable to use multiple markers instead of nested markers.
* </p>
*
* @param reference
* a reference to another marker
* @throws IllegalArgumentException

View File

@ -25,6 +25,7 @@
package org.slf4j;
import org.slf4j.helpers.BasicMarkerFactory;
import org.slf4j.helpers.Reporter;
import org.slf4j.helpers.Util;
import org.slf4j.spi.SLF4JServiceProvider;
@ -47,16 +48,14 @@ public class MarkerFactory {
private MarkerFactory() {
}
// this is where the binding happens
static {
SLF4JServiceProvider provider = LoggerFactory.getProvider();
if (provider != null) {
provider.initialize();
MARKER_FACTORY = provider.getMarkerFactory();
} else {
Util.report("Failed to find provider");
Util.report("Defaulting to BasicMarkerFactory.");
Reporter.error("Failed to find provider");
Reporter.error("Defaulting to BasicMarkerFactory.");
MARKER_FACTORY = new BasicMarkerFactory();
}
}

View File

@ -0,0 +1,140 @@
package org.slf4j.event;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.Marker;
/**
* A default implementation of {@link LoggingEvent}.
*
* @author Ceki G&uuml;lc&uuml;
*
* @since 2.0.0
*/
public class DefaultLoggingEvent implements LoggingEvent {
Logger logger;
Level level;
String message;
List<Marker> markers;
List<Object> arguments;
List<KeyValuePair> keyValuePairs;
Throwable throwable;
String threadName;
long timeStamp;
String callerBoundary;
public DefaultLoggingEvent(Level level, Logger logger) {
this.logger = logger;
this.level = level;
}
public void addMarker(Marker marker) {
if (markers == null) {
markers = new ArrayList<>(2);
}
markers.add(marker);
}
@Override
public List<Marker> getMarkers() {
return markers;
}
public void addArgument(Object p) {
getNonNullArguments().add(p);
}
public void addArguments(Object... args) {
getNonNullArguments().addAll(Arrays.asList(args));
}
private List<Object> getNonNullArguments() {
if (arguments == null) {
arguments = new ArrayList<>(3);
}
return arguments;
}
@Override
public List<Object> getArguments() {
return arguments;
}
@Override
public Object[] getArgumentArray() {
if (arguments == null)
return null;
return arguments.toArray();
}
public void addKeyValue(String key, Object value) {
getNonnullKeyValuePairs().add(new KeyValuePair(key, value));
}
private List<KeyValuePair> getNonnullKeyValuePairs() {
if (keyValuePairs == null) {
keyValuePairs = new ArrayList<>(4);
}
return keyValuePairs;
}
@Override
public List<KeyValuePair> getKeyValuePairs() {
return keyValuePairs;
}
public void setThrowable(Throwable cause) {
this.throwable = cause;
}
@Override
public Level getLevel() {
return level;
}
@Override
public String getLoggerName() {
return logger.getName();
}
@Override
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public Throwable getThrowable() {
return throwable;
}
public String getThreadName() {
return threadName;
}
public long getTimeStamp() {
return timeStamp;
}
public void setTimeStamp(long timeStamp) {
this.timeStamp = timeStamp;
}
public void setCallerBoundary(String fqcn) {
this.callerBoundary = fqcn;
}
public String getCallerBoundary() {
return callerBoundary;
}
}

View File

@ -1,296 +0,0 @@
package org.slf4j.event;
import java.util.Queue;
import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.helpers.SubstituteLogger;
public class EventRecodingLogger implements Logger {
String name;
SubstituteLogger logger;
Queue<SubstituteLoggingEvent> eventQueue;
public EventRecodingLogger(SubstituteLogger logger, Queue<SubstituteLoggingEvent> eventQueue) {
this.logger = logger;
this.name = logger.getName();
this.eventQueue = eventQueue;
}
public String getName() {
return name;
}
private void recordEvent(Level level, String msg, Object[] args, Throwable throwable) {
recordEvent(level, null, msg, args, throwable);
}
private void recordEvent(Level level, Marker marker, String msg, Object[] args, Throwable throwable) {
// System.out.println("recording logger:"+name+", msg:"+msg);
SubstituteLoggingEvent loggingEvent = new SubstituteLoggingEvent();
loggingEvent.setTimeStamp(System.currentTimeMillis());
loggingEvent.setLevel(level);
loggingEvent.setLogger(logger);
loggingEvent.setLoggerName(name);
loggingEvent.setMarker(marker);
loggingEvent.setMessage(msg);
loggingEvent.setArgumentArray(args);
loggingEvent.setThrowable(throwable);
loggingEvent.setThreadName(Thread.currentThread().getName());
eventQueue.add(loggingEvent);
}
public boolean isTraceEnabled() {
return true;
}
public void trace(String msg) {
recordEvent(Level.TRACE, msg, null, null);
}
public void trace(String format, Object arg) {
recordEvent(Level.TRACE, format, new Object[] { arg }, null);
}
public void trace(String format, Object arg1, Object arg2) {
recordEvent(Level.TRACE, format, new Object[] { arg1, arg2 }, null);
}
public void trace(String format, Object... arguments) {
recordEvent(Level.TRACE, format, arguments, null);
}
public void trace(String msg, Throwable t) {
recordEvent(Level.TRACE, msg, null, t);
}
public boolean isTraceEnabled(Marker marker) {
return true;
}
public void trace(Marker marker, String msg) {
recordEvent(Level.TRACE, marker, msg, null, null);
}
public void trace(Marker marker, String format, Object arg) {
recordEvent(Level.TRACE, marker, format, new Object[] { arg }, null);
}
public void trace(Marker marker, String format, Object arg1, Object arg2) {
recordEvent(Level.TRACE, marker, format, new Object[] { arg1, arg2 }, null);
}
public void trace(Marker marker, String format, Object... argArray) {
recordEvent(Level.TRACE, marker, format, argArray, null);
}
public void trace(Marker marker, String msg, Throwable t) {
recordEvent(Level.TRACE, marker, msg, null, t);
}
public boolean isDebugEnabled() {
return true;
}
public void debug(String msg) {
recordEvent(Level.DEBUG, msg, null, null);
}
public void debug(String format, Object arg) {
recordEvent(Level.DEBUG, format, new Object[] { arg }, null);
}
public void debug(String format, Object arg1, Object arg2) {
recordEvent(Level.DEBUG, format, new Object[] { arg1, arg2 }, null);
}
public void debug(String format, Object... arguments) {
recordEvent(Level.DEBUG, format, arguments, null);
}
public void debug(String msg, Throwable t) {
recordEvent(Level.DEBUG, msg, null, t);
}
public boolean isDebugEnabled(Marker marker) {
return true;
}
public void debug(Marker marker, String msg) {
recordEvent(Level.DEBUG, marker, msg, null, null);
}
public void debug(Marker marker, String format, Object arg) {
recordEvent(Level.DEBUG, marker, format, new Object[] { arg }, null);
}
public void debug(Marker marker, String format, Object arg1, Object arg2) {
recordEvent(Level.DEBUG, marker, format, new Object[] { arg1, arg2 }, null);
}
public void debug(Marker marker, String format, Object... arguments) {
recordEvent(Level.DEBUG, marker, format, arguments, null);
}
public void debug(Marker marker, String msg, Throwable t) {
recordEvent(Level.DEBUG, marker, msg, null, t);
}
public boolean isInfoEnabled() {
return true;
}
public void info(String msg) {
recordEvent(Level.INFO, msg, null, null);
}
public void info(String format, Object arg) {
recordEvent(Level.INFO, format, new Object[] { arg }, null);
}
public void info(String format, Object arg1, Object arg2) {
recordEvent(Level.INFO, format, new Object[] { arg1, arg2 }, null);
}
public void info(String format, Object... arguments) {
recordEvent(Level.INFO, format, arguments, null);
}
public void info(String msg, Throwable t) {
recordEvent(Level.INFO, msg, null, t);
}
public boolean isInfoEnabled(Marker marker) {
return true;
}
public void info(Marker marker, String msg) {
recordEvent(Level.INFO, marker, msg, null, null);
}
public void info(Marker marker, String format, Object arg) {
recordEvent(Level.INFO, marker, format, new Object[] { arg }, null);
}
public void info(Marker marker, String format, Object arg1, Object arg2) {
recordEvent(Level.INFO, marker, format, new Object[] { arg1, arg2 }, null);
}
public void info(Marker marker, String format, Object... arguments) {
recordEvent(Level.INFO, marker, format, arguments, null);
}
public void info(Marker marker, String msg, Throwable t) {
recordEvent(Level.INFO, marker, msg, null, t);
}
public boolean isWarnEnabled() {
return true;
}
public void warn(String msg) {
recordEvent(Level.WARN, msg, null, null);
}
public void warn(String format, Object arg) {
recordEvent(Level.WARN, format, new Object[] { arg }, null);
}
public void warn(String format, Object arg1, Object arg2) {
recordEvent(Level.WARN, format, new Object[] { arg1, arg2 }, null);
}
public void warn(String format, Object... arguments) {
recordEvent(Level.WARN, format, arguments, null);
}
public void warn(String msg, Throwable t) {
recordEvent(Level.WARN, msg, null, t);
}
public boolean isWarnEnabled(Marker marker) {
return true;
}
public void warn(Marker marker, String msg) {
recordEvent(Level.WARN, marker, msg, null, null);
}
public void warn(Marker marker, String format, Object arg) {
recordEvent(Level.WARN, format, new Object[] { arg }, null);
}
public void warn(Marker marker, String format, Object arg1, Object arg2) {
recordEvent(Level.WARN, marker, format, new Object[] { arg1, arg2 }, null);
}
public void warn(Marker marker, String format, Object... arguments) {
recordEvent(Level.WARN, marker, format, arguments, null);
}
public void warn(Marker marker, String msg, Throwable t) {
recordEvent(Level.WARN, marker, msg, null, t);
}
public boolean isErrorEnabled() {
return true;
}
public void error(String msg) {
recordEvent(Level.ERROR, msg, null, null);
}
public void error(String format, Object arg) {
recordEvent(Level.ERROR, format, new Object[] { arg }, null);
}
public void error(String format, Object arg1, Object arg2) {
recordEvent(Level.ERROR, format, new Object[] { arg1, arg2 }, null);
}
public void error(String format, Object... arguments) {
recordEvent(Level.ERROR, format, arguments, null);
}
public void error(String msg, Throwable t) {
recordEvent(Level.ERROR, msg, null, t);
}
public boolean isErrorEnabled(Marker marker) {
return true;
}
public void error(Marker marker, String msg) {
recordEvent(Level.ERROR, marker, msg, null, null);
}
public void error(Marker marker, String format, Object arg) {
recordEvent(Level.ERROR, marker, format, new Object[] { arg }, null);
}
public void error(Marker marker, String format, Object arg1, Object arg2) {
recordEvent(Level.ERROR, marker, format, new Object[] { arg1, arg2 }, null);
}
public void error(Marker marker, String format, Object... arguments) {
recordEvent(Level.ERROR, marker, format, arguments, null);
}
public void error(Marker marker, String msg, Throwable t) {
recordEvent(Level.ERROR, marker, msg, null, t);
}
}

View File

@ -0,0 +1,84 @@
package org.slf4j.event;
import java.util.Queue;
import org.slf4j.Marker;
import org.slf4j.helpers.LegacyAbstractLogger;
import org.slf4j.helpers.SubstituteLogger;
/**
*
* This class is used to record events during the initialization phase of the
* underlying logging framework. It is called by {@link SubstituteLogger}.
*
*
* @author Ceki G&uuml;lc&uuml;
* @author Wessel van Norel
*
*/
public class EventRecordingLogger extends LegacyAbstractLogger {
private static final long serialVersionUID = -176083308134819629L;
String name;
SubstituteLogger logger;
Queue<SubstituteLoggingEvent> eventQueue;
// as an event recording logger we have no choice but to record all events
final static boolean RECORD_ALL_EVENTS = true;
public EventRecordingLogger(SubstituteLogger logger, Queue<SubstituteLoggingEvent> eventQueue) {
this.logger = logger;
this.name = logger.getName();
this.eventQueue = eventQueue;
}
public String getName() {
return name;
}
public boolean isTraceEnabled() {
return RECORD_ALL_EVENTS;
}
public boolean isDebugEnabled() {
return RECORD_ALL_EVENTS;
}
public boolean isInfoEnabled() {
return RECORD_ALL_EVENTS;
}
public boolean isWarnEnabled() {
return RECORD_ALL_EVENTS;
}
public boolean isErrorEnabled() {
return RECORD_ALL_EVENTS;
}
// WARNING: this method assumes that any throwable is properly extracted
protected void handleNormalizedLoggingCall(Level level, Marker marker, String msg, Object[] args, Throwable throwable) {
SubstituteLoggingEvent loggingEvent = new SubstituteLoggingEvent();
loggingEvent.setTimeStamp(System.currentTimeMillis());
loggingEvent.setLevel(level);
loggingEvent.setLogger(logger);
loggingEvent.setLoggerName(name);
if (marker != null) {
loggingEvent.addMarker(marker);
}
loggingEvent.setMessage(msg);
loggingEvent.setThreadName(Thread.currentThread().getName());
loggingEvent.setArgumentArray(args);
loggingEvent.setThrowable(throwable);
eventQueue.add(loggingEvent);
}
@Override
protected String getFullyQualifiedCallerName() {
return null;
}
}

View File

@ -0,0 +1,32 @@
package org.slf4j.event;
import java.util.Objects;
public class KeyValuePair {
public final String key;
public final Object value;
public KeyValuePair(String key, Object value) {
this.key = key;
this.value = value;
}
@Override
public String toString() {
return String.valueOf(key) + "=\"" + String.valueOf(value) +"\"";
}
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
KeyValuePair that = (KeyValuePair) o;
return Objects.equals(key, that.key) && Objects.equals(value, that.value);
}
@Override
public int hashCode() {
return Objects.hash(key, value);
}
}

View File

@ -7,16 +7,18 @@ import static org.slf4j.event.EventConstants.TRACE_INT;
import static org.slf4j.event.EventConstants.WARN_INT;
/**
* SLF4J's internal representation of Level.
*
* @author ceki
*
* @author Ceki G&uuml;lc&uuml;
* @since 1.7.15
*/
public enum Level {
ERROR(ERROR_INT, "ERROR"), WARN(WARN_INT, "WARN"), INFO(INFO_INT, "INFO"), DEBUG(DEBUG_INT, "DEBUG"), TRACE(TRACE_INT, "TRACE");
private int levelInt;
private String levelStr;
private final int levelInt;
private final String levelStr;
Level(int i, String s) {
levelInt = i;
@ -27,6 +29,23 @@ public enum Level {
return levelInt;
}
public static Level intToLevel(int levelInt) {
switch (levelInt) {
case (TRACE_INT):
return TRACE;
case (DEBUG_INT):
return DEBUG;
case (INFO_INT):
return INFO;
case (WARN_INT):
return WARN;
case (ERROR_INT):
return ERROR;
default:
throw new IllegalArgumentException("Level integer [" + levelInt + "] not recognized.");
}
}
/**
* Returns the string representation of this Level.
*/

View File

@ -1,28 +1,49 @@
package org.slf4j.event;
import java.util.List;
import org.slf4j.Marker;
/**
* The minimal interface sufficient for the restitution of data passed
* by the user to the SLF4J API.
*
* @author ceki
* @author Ceki G&uuml;lc&uuml;
* @since 1.7.15
*/
public interface LoggingEvent {
Level getLevel();
Marker getMarker();
String getLoggerName();
String getMessage();
String getThreadName();
List<Object> getArguments();
Object[] getArgumentArray();
long getTimeStamp();
/**
* List of markers in the event, might be null.
* @return markers in the event, might be null.
*/
List<Marker> getMarkers();
List<KeyValuePair> getKeyValuePairs();
Throwable getThrowable();
long getTimeStamp();
String getThreadName();
/**
* Returns the presumed caller boundary provided by the logging library (not the user of the library).
* Null by default.
*
* @return presumed caller, null by default.
*/
default String getCallerBoundary() {
return null;
}
}

Some files were not shown because too many files have changed in this diff Show More