On Sep 7, 2006, at 3:00 PM, David Tonhofer wrote:

Oh noes! Things go too fast. .... But it's LGPL-licensed this time around?



Project "forking" is both an advantage and disadvantage of the open source model. It is an advantage in that somebody with a different idea, team, process, design or whatever can take start from an existing project and possibly come up with something better. It is a disadvantage since it may confuse the user base with many variants options.

The thread so far is about that same as if you asked a question on a FreeBSD user list about something and a NetBSD developer said that FreeBSD doesn't do that but a development version of NetBSD does do it. Well maybe with the differences of licenses, it might be more like a FreeBSD user list and an Linux developer.

Depending on a large variety of considerations you might consider: jumping to the other implementation, adding the desired feature to the current implementation, finding another way to achieve the objective, or decide that you can live without the feature.

With logback copyrighted by QOS.ch and under the LGPL, it is problematic for a log4j developer to look at the code and provide any guidance on the relative merits of log4j and logback.

In log4j, the creation of LocationInfo parses out the method, file and line number from a Throwable and discards it losing the rest of the stack trace. Potential options to achieve your objective in log4j include:

1. Create a private version of log4j where LocationInfo retains the Throwable. Add a custom layout that wraps PatternLayout, delegate the primary formatting to PatternLayout and have your custom layout output the stack trace.

2. Create a utility class that adds a Throwable's stack trace to the NDC if the level is enabled. Your code that currently looks like:

logger.debug("Hello, world");

would need to be changed using a regex to something like:

LogStack.debug(logger, "Hello, world");

the implementation of LogStack.debug would look like:

public class LogStack {
    private static final FQCN = LogStack.class.getName();
    private static String stackTrace() { ... }
    public void debug(Logger logger, Object msg) {
        if(logger.isDebugEnabled()) {
            NDC.put(stackTrace());
            logger.forceLog(Level.DEBUG, msg, FQCN);
            NDC.pop();
        }
    }
}

3. Propose a modification to log4j to add the feature

4. Wait for somebody else who has already solved this problem using log4j to respond.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to