There are basically two big concerns regarding logging in fred:

- Readability and code clutter, which was my original questioning;
- Raw throughput, as raised by toad.

Point 1 could mostly be solved by removing any traces of logMINOR and logDEBUG on all but the few places where generating messages to be logged brings noticeable slowdown. That'd be enough, but, personally, the mess that the logging backend is does warrant a replacement. According to toad, the current system needs log{MINOR,DEBUG} to function in a timely manner. Based on this, I think we all agree a replacement is desirable.

Logging has a few additional requirements:

- Log rotation (possibly live);
- Reentrant;
- Per-class filtering;
- Specific information in log (class-name, for example).

Now, _any_ library which fits would make me happy, as long as they agree to two points:

- Either lightweight or with optional features. Else, it would only transfer bloat to freenet-ext.jar. For example: log2socket, config management and multiple logging instances; - Implementable in a few LoC. Specially, it shouldn't need specialized Formatter and Writer.

Plus, it should be fast.

From the quick research I made (yep, too many lists):

- SLF4J already fails on point one: it is simply a wrapper;
- The Java logging API fails on point two: specialized classes would have to be written to deal with log rotation, per-class filtering and formatting, plus a wrapper for Logger.{info,warning,...}() methods. Exactly the same as a custom logger, with one more dependency and using more LoC; - Log4J seems to fail on point one - it only lacks a button that brings back the dead. It seems interesting, and I haven't dropped this yet.

In either case (custom or external), log* would be banished. Forever.

On 21-03-2012 13:47, Ian Clarke wrote:
Is there a good reason to roll our own logging framework? What about http://www.slf4j.org/ or one of the many other alternatives?

Ian.

On Sun, Mar 18, 2012 at 6:40 PM, Marco Schulze <[email protected] <mailto:[email protected]>> wrote:

    One thing has been bothering me: those 'if (logMINOR)
    Logger.minor(...', and the mess that logging is inside fred. I've
    written a very simple replacement for Logger + associated classes
    with the following changes:

    - Log level (renamed to severity) filtering is done by Logging.log();
    - Specific writer classes are replaced by a simple OutputStream,
    which defaults to System.err. Formatting is also unified;
    - Severity cases are broadened (FATAL, ERROR, WARNING, INFO, DEBUG
    and TRACE), MINOR is mapped to DEBUG, and NORMAL is mapped to INFO;
    - No logging method accepts an Object parameter - hashCode() is
    not exactly useful.

    Additionally, log rotation will be moved outside (possibly inside
    Node).

    Currently, the log format is '<severity>\t<message>'.
    _______________________________________________
    Devl mailing list
    [email protected] <mailto:[email protected]>
    https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl




--
Ian Clarke
Personal blog: http://blog.locut.us/


_______________________________________________
Devl mailing list
[email protected]
https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
_______________________________________________
Devl mailing list
[email protected]
https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to