[slf4j-user] AVSL

Brian Clapper bmc at clapper.org
Tue Apr 27 20:52:30 CEST 2010


cowwoc wrote:

>     I tend to agree. XML is fine for machines, not for humans. The only
> change I would make is rename the .ini file to .properties.

AVSL uses an INI-like file, because organizing things in sections makes more
sense (to me). Since I wrote AVSL, I got to choose. ;-) But the default file
is "avsl.conf", and there are no constraints on what you call the thing. The
API doesn't care what the file is called, just what it contains.

I don't think a regular Java properties file is a good choice for a logging
API, either. Recall that Log4J permits both XML and properties configuration.
But the properties configuration simulates individual namespaces clumsily,
because it's stuck with the flat properties file syntax. For instance:

    log4j.appender.Mail=org.apache.log4j.net.SMTPAppender
    log4j.appender.Mail.BufferSize=4096
    log4j.appender.Mail.From=Brian Clapper <bmc at clapper.org>
    log4j.appender.Mail.To=bmc at clapper.org

    ...

    log4j.appender.File.file=${user.home}/foo.log
    log4j.appender.File.append=false
    log4j.appender.File.layout.ConversionPattern=%d %-5p %t (%c{1}): %m%n

    # Log levels for specific classes.

    log4j.logger.org.clapper.foo=INFO
    log4j.logger.org.clapper.util=warn
    log4j.logger.org.clapper.util.classutil=warn

You really do have sections there, but they're implemented as common prefixes.
In this particular case, an INI-style file cleans a lot of that up. If Log4J
had supported an INI-style config, it might've looked more like the Python
logging module's configuration (or, for that matter, AVSL's, which I
deliberately chose to be similar to the Python logging module's).

I don't think that an INI-style file is always the best choice for a
configuration. It happens to fit a logging framework reasonably well, though,
I think; the resulting file expresses what needs to be expressed, without a
lot of "line noise" getting in the way of reading it. But that's just my opinion.
-- 
-Brian

Brian Clapper, http://www.clapper.org/bmc/


More information about the slf4j-user mailing list