This page has also been translated into Serbo-Croatian, by Anja Skrba.
Introduction
AVSL is a very simple logger, written in Scala. AVSL implements the Simple Logging Facade for Java (SLF4J) API, allowing applications to be written to the SLF4J API. (This, of course, includes Java applications.) Because it implements SLF4J, AVSL can easily be swapped for another SLF4J-compatible logging framework (or the other way around), without any changes to the calling application. Also, because it supports SLF4J, AVSL can be used in conjunction with Scala SLF4J wrappers, such as Grizzled-SLF4J.
“AVSL” stands for “A Very Simple Logger”, and AVSL strives for simplicity in several ways.
- AVSL is simple to configure, using a non-XML, INI-style configuration file that’s reminiscent of the Python logging module’s configuration. This simpler configuration file is easier to read and edit than the XML configuration files used by logging frameworks such as Logback. (Since I dislike XML configuration files, this is big win for me.)
- AVSL is a lightweight logging framework. It is intended to be used primarily in standalone programs, not enterprise applications. It may work fine for your enterprise application, of course; but, if it doesn’t, you can easily switch to something else.
- The default message formatter uses a simpler, more compact syntax than Java’s
SimpleDateFormat, relying onstrftime-like escapes. - You can specify the configuration file via an environment variable (
AVSL_CONFIG) or a Java system property. If neither is present, AVSL looks for resourceavsl.confsomewhere in the classpath. - The built-in logging handlers are thread-safe.
- AVSL does not monitor and reload its configuration file.
- AVSL does not implement the SLF4J marker or MDC capabilities.
- AVSL does not wrap other logging frameworks.
- AVSL does not let programmers define their own log levels.
In short, AVSL is a perfectly serviceable, simple logging framework that can easily be swapped out for something with more features.
Installation
AVSL is published to the oss.sonatype.org repository and automatically sync’d with the Maven Central Repository.
- Version 1.0.1 supports Scala 2.10.0-RC1
- Version 1.0 supports Scala 2.10.0-M7
- Version 0.4 supports Scala 2.9.2, 2.9.1-1, 2.9.1, 2.9.0-1, 2.9.0, 2.8.2, 2.8.1 and 2.8.0.
Installing for Maven
If you’re using Maven, just give it the artifact, and Maven will do the rest:
- Group ID:
clapper.org - Artifact ID:
avsl_2.9.2oravsl_2.10 - Version:
0.4or1.0.1 - Type:
jar
For example:
<dependency>
<groupId>org.clapper</groupId>
<artifactId>avsl_2.10</artifactId>
<version>1.0.1</version>
</dependency>
For more information on using Maven and Scala, see Josh Suereth’s Scala Maven Guide.
Using with SBT
0.7.x
If you’re using SBT 0.7.x to compile your code, you can place the following line in your project file (i.e., the Scala file in your project/build/ directory):
val javaNetRepo = "Java.net Maven 2 Repo" at
"http://download.java.net/maven/2"
val avsl = "org.clapper" %% "avsl" % "0.4"
0.11.x/0.12.x
If you’re using SBT 0.11.x or 0.12.x to compile your code, you can use the following line in your build.sbt file (for Quick Configuration). If you’re using an SBT 0.11.x Full Configuration, you’re obviously smart enough to figure out what to do, on your own.
If you’re using Scala 2.9.2 or earlier:
libraryDependencies += "org.clapper" %% "avsl" % "0.4"
If you’re using Scala 2.10:
libraryDependencies += "org.clapper" % "avsl_2.10" % "1.0"
AVSL is also registered with Doug Tangren’s excellent ls.implicit.ly catalog. If you use the ls SBT plugin, you can install AVSL with
sbt> ls-install avsl
Source Code Repository
The source code for AVSL is maintained on GitHub. To clone the repository, run this command:
$ git clone git://github.com/bmc/avsl.git
Note: That gets you the trunk, which supports Scala 2.10 and later. If you want the code for Scala 2.9, switch to the pre-scala-2.10-fixes branch:
$ cd avsl
$ git co pre-scala-2.10-fixes
Building from Source
Building the library requires SBT 0.12.0 for Scala 2.10, and 0.11.x for Scala 2.9 or earlier. Install SBT, as described at the SBT web site. Then, assuming you have an sbt shell script (or .BAT file, for Windows), run:
sbt compile package
The resulting jar file will be in the top-level target directory.
Documentation
Please consult the User’s Guide for details on how to use and configure AVSL.
Change log
The change log for all releases is here.
Author
Brian M. Clapper, bmc@clapper.org
Copyright and License
AVSL is copyright © 2010 Brian M. Clapper and is released under a BSD License.
Patches
I gladly accept patches from their original authors. Feel free to email patches to me or to fork the GitHub repository and send me a pull request. Along with any patch you send:
- Please state that the patch is your original work.
- Please indicate that you license the work to the AVSL project under a BSD License.
