[slf4j-user] Java 5 version of SLF4J?

Joern Huxhorn jhuxhorn at bpinteractive.com
Thu Apr 24 16:04:54 CEST 2008


Hi guys.

My patch available at http://bugzilla.slf4j.org/show_bug.cgi?id=31 
supports varargs without changing the slf4j API at all.

It would be included in maven like this

<dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api-jdk15</artifactId>
         <version>1.5.0</version>
         <scope>compile</scope>
         <!--
         replacement for slf4j-api below
         -->
</dependency>
<dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <version>1.5.0</version>
         <scope>provided</scope>
         <!--
         overrides transitive dependencies,
         replaced by slf4j-api-jdk15 above
         -->
</dependency>

It is possible that
<dependency>
	<groupId>org.slf4j</groupId>
	<artifactId>slf4j-api-jdk15</artifactId>
	<version>1.5.0</version>
	<scope>compile</scope>
	<exclusions>
		<exclusion>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</exclusion>
	</exclusions>
</dependency>
would work, too, but I never tried that...

slf4j-api-jdk15 is an *additional* artifact that contains the slf4j API 
using varargs instead of Object[].

That's why slf4j-api is *not* changed/polluted at all!

Modules/libraries compiled against slf4j-api will just work with 
slf4j-api-jdk15.

Obviously, the opposite is not the case:

Modules/libraries compiled against slf4j-api-jdk15 will require 
slf4j-api-jdk15 and can not be switched back to slf4j-api because they 
use jdk15 specific code.
I can't see *any* problem with this fact since, well, they are jdk15 
dependent - otherwise they couldn't (slf4j-api-jdk15 *requires* jdk15) 
and wouldn't (you don't *have* to use slf4j-api-jdk15 if you use 
jdk15... you can still use slf4j-api if you don't care about varargs) 
use slf4j-api-jdk15.

Greetings,
Joern.

Ceki Gulcu wrote:
> Hello Christopher,
> 
> Users keep asking for varagrs [1]. However, as I stated at the time,
> given that SLF4J is intended used by all sorts of libraries, the
> dependency graph between libraries and SLF4J can be surprisingly
> complex. In particular, it would not be unusual for the dependency
> graph to have multiple dependencies on SLF4J with *different*
> versions. Thus, we have to be extra-careful and conservative when
> changing the SLF4J API.
> 
> I regret to disappoint our users but except for bug fixes, do not
> expect any changes to the SLF4J API.
> 
> [1] http://www.slf4j.org/pipermail/user/2008-January/000468.html
> 
> 
> Christopher.White at bbh.com wrote:
>> Has there been any more discussion lately about updating the API to 
>> support varargs and perhaps printf?
> 
> 





More information about the slf4j-user mailing list