On Mon, 04 Aug 2008 09:24:02 +0200 Ceki Gulcu <[EMAIL PROTECTED]> wrote: > Hi Jacob, > > The slf4j-ext module requires JDK 1.5+. It's a brand new module with no > preexisting client base. In principle, we should be able to choose whatever >JDK > dependency we want. > > The rest of SLF4J of course still requires JDK 1.3+, that has not changed. I > guess the documentation needs to make the distinction between slf4j-ext > requirements and the rest of slf4j requirements clear(er). > > Jacob, does this make sense or do you think slf4j-ext needs to support JDK >1.3+? >
Yes, it doesn't make sense and no, it doesn't need to support JDK 1.3. I just thought because the rest of SLF4J uses JDK 1.3 as its target JVM, then this one would be no different. Plus I've seen a few incidents of mistakenly checking in JDK1.5 code. I thought this was yet another mistake. I guess my point is that before checking anything in, you should be compiling with the target JDK to validate. You'd never make a checkin mistake again if you did that. I do that with another open source project I develop and have yet to make such a mistake. It's essentially impossible. Jake > Cheers, > > Jacob Kjome wrote: >> Is this stuff supposed to work with JDK1.3+? You're using varargs. You >>really >> need to validate this stuff by compiling under the lowest JDK you claim to >>support. >> >> Jake >> >> [EMAIL PROTECTED] wrote: >>> Author: ceki >>> Date: Fri Aug 1 23:52:22 2008 >>> New Revision: 1089 >>> >>> Added: >>> slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/LoggerX.java >>> slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/LoggerXTest.java >>> >>> Log: >>> started work on bug 86, http://bugzilla.slf4j.org/show_bug.cgi?id=86 >>> >>> Added: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/LoggerX.java >>> ============================================================================== >>> --- (empty file) >>> +++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/LoggerX.java Fri Aug >>> 1 >>>23:52:22 2008 >>> @@ -0,0 +1,61 @@ >>> +package org.slf4j; >>> + >>> +import org.slf4j.helpers.MessageFormatter; >>> +import org.slf4j.spi.LocationAwareLogger; >>> + >>> +/** >>> + * A utility that provides standard mechanisms for logging certain kinds of >>> + * activities. >>> + * >>> + * @author Ralph Goers >>> + * @author Ceki Gulcu >>> + */ >>> +public class LoggerX { >>> + >>> + private static final String FQCN = LoggerX.class.getName(); >>> + static Marker FLOW_MARKER = MarkerFactory.getMarker("FLOW"); >>> + static Marker ENTRY_MARKER = MarkerFactory.getMarker("ENTER"); >>> + static Marker EXIT_MARKER = MarkerFactory.getMarker("EXIT"); >>> + >>> + static Marker EXCEPTION_MARKER = MarkerFactory.getMarker("EXCEPTION"); >>> + static Marker DIAG_MARKER = MarkerFactory.getMarker("DIAG"); >>> + >>> + static String ENTRY_MESSAGE_0 = "entry"; >>> + static String ENTRY_MESSAGE_1 = "entry with params ({})"; >>> + static String ENTRY_MESSAGE_2 = "entry with params ({}, {})"; >>> + static String ENTRY_MESSAGE_3 = "entry with params ({}, {}, {})"; >>> + static String ENTRY_MESSAGE_4 = "entry with params ({}, {}, {}, {})"; >>> + static int ENTRY_MESSAGE_ARRAY_LEN = 5; >>> + static String[] ENTRY_MESSAGE_ARRAY = new >>>String[ENTRY_MESSAGE_ARRAY_LEN]; >>> + static { >>> + ENTRY_MARKER.add(FLOW_MARKER); >>> + EXIT_MARKER.add(FLOW_MARKER); >>> + ENTRY_MESSAGE_ARRAY[0] = ENTRY_MESSAGE_0; >>> + ENTRY_MESSAGE_ARRAY[1] = ENTRY_MESSAGE_1; >>> + ENTRY_MESSAGE_ARRAY[2] = ENTRY_MESSAGE_2; >>> + ENTRY_MESSAGE_ARRAY[3] = ENTRY_MESSAGE_3; >>> + ENTRY_MESSAGE_ARRAY[4] = ENTRY_MESSAGE_4; >>> + } >>> + >>> + /** >>> + * Log entry to a method >>> + * >>> + * @param logger >>> + * the Logger to log with. >>> + */ >>> + public static void entering(Logger logger, Object... argArray) { >>> + if (logger.isDebugEnabled(ENTRY_MARKER) >>> + && logger instanceof LocationAwareLogger) { >>> + String messagePattern = ""; >>> + if(argArray.length <= ENTRY_MESSAGE_ARRAY_LEN) { >>> + messagePattern = ENTRY_MESSAGE_ARRAY[argArray.length]; >>> + } >>> + >>> + String msg = MessageFormatter.arrayFormat(messagePattern, argArray); >>> + >>> + ((LocationAwareLogger) logger).log(ENTRY_MARKER, FQCN, >>> + LocationAwareLogger.ERROR_INT, msg, null); >>> + } >>> + } >>> + >>> +} >>> >>> Added: slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/LoggerXTest.java >>> ============================================================================== >>> --- (empty file) >>> +++ slf4j/trunk/slf4j-ext/src/test/java/org/slf4j/LoggerXTest.java Fri Aug >>> 1 23:52:22 2008 >>> @@ -0,0 +1,12 @@ >>> +package org.slf4j; >>> + >>> +import junit.framework.TestCase; >>> + >>> +public class LoggerXTest extends TestCase { >>> + >>> + Logger logger = LoggerFactory.getLogger(this.getClass()); >>> + >>> + public void testSmoke() { >>> + LoggerX.entering(logger); >>> + } >>> +} >>> _______________________________________________ >>> dev mailing list >>> [email protected] >>> http://www.slf4j.org/mailman/listinfo/dev >>> >>> >>> >> _______________________________________________ >> dev mailing list >> [email protected] >> http://www.slf4j.org/mailman/listinfo/dev >> > > -- > Ceki Gülcü > > QOS.ch is looking to hire talented developers located in Switzerland > to work on cutting-edge software projects. If you think you are > qualified, then please contact [EMAIL PROTECTED] > _______________________________________________ > dev mailing list > [email protected] > http://www.slf4j.org/mailman/listinfo/dev > _______________________________________________ dev mailing list [email protected] http://www.slf4j.org/mailman/listinfo/dev
