From 8f6bd37fce99bf90bae81c970903adbdf3db43bc Mon Sep 17 00:00:00 2001 From: hyperthing Date: Sat, 7 May 2011 20:33:07 -0300 Subject: [PATCH] * BnacLog.java: changed logger class from org.apache.log4j.Logger to org.slf4j.Logger * README: changes to reflect the change in logging mechanism --- README | 18 +++++++++++++++++- src/cl.uchile.dcc.bnac/BnacLog.java | 9 +++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README b/README index ad9fb03..c8968b1 100644 --- a/README +++ b/README @@ -8,7 +8,7 @@ Software requirements ===================== Library dependencies: -- log4j >= 1.2 +- slf4j >= 1.6 - libvecmath >= 1.5.2 The corresponding JAR files must be either put or symlinked from the directory @@ -32,3 +32,19 @@ $ ant That's it ;-) As this is just a library, the generated JAR is in the `dist' directory. + +Testing +======= + +There is a test class which right now which tests parsing Meml and Info files. + +There is a testing directory called (suitably) `test'. To build, simply call, + $ ant test + +Then call, + $ java -cp lib/*:build:test/build:test Test ( meml | info ) file.xml + +To view logs, JARs for both log4j and the slf4j adapter must be put in the `lib' +directory, the same way as other required JARs. To change logging rules, alter +the file `test/log4j.properties'. + diff --git a/src/cl.uchile.dcc.bnac/BnacLog.java b/src/cl.uchile.dcc.bnac/BnacLog.java index 3ed7239..59d65db 100644 --- a/src/cl.uchile.dcc.bnac/BnacLog.java +++ b/src/cl.uchile.dcc.bnac/BnacLog.java @@ -18,14 +18,15 @@ package cl.uchile.dcc.bnac; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class BnacLog { static protected Logger l; static { - l = Logger.getLogger("cl.uchile.dcc.bnac"); + l = LoggerFactory.getLogger("cl.uchile.dcc.bnac"); } static public void trace (String s) { l.trace(s); } @@ -53,10 +54,10 @@ public class BnacLog { l.error(String.format(s, args)); } - static public void fatal (String s) { l.fatal(s); } + static public void fatal (String s) { fatal("FATAL %s", s); } static public void fatal (String s, Object... args) { - l.fatal(String.format(s, args)); + l.error(String.format(s, args)); } protected BnacLog () { } -- 2.11.4.GIT