[jsword-devel] Loggers

DM Smith dmsmith at crosswire.org
Mon Feb 25 13:49:46 MST 2013


OK, it's all there. We need to merge this in fairly quickly as it prevents lots of other development/fixes.

The changes were fairly simple. Basically a few global search and replace operations:
Replace
import org.crosswire.common.util.Logger;
with:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Replace
Logger.getLogger
with
LoggerFactory.getLogger
.

Replace
log.fatal
with
log.error.

I've marked the old implementation, which is no longer used by JSword, as deprecated. If you are using it, this will help you find where to change your code as described above.

To change to using formats, looked for every log statement that had + (concatenation) of strings.
Used {} as a placeholder for what was concatenated and put the arguments at the end.
Note: the last argument can be an exception that doesn't pair with a {}. It will then produce a stack trace.

I also changed ivy.xml to bring in the library, to bring in a plugin for writing to Java Logging and another to redirect apache commons logging to SLF4J. If you use ant to build and you don't want to use Java logging, please change your local copy to bring in the plugin you want.

Working together in His Service,
	DM

On Feb 25, 2013, at 9:51 AM, DM Smith <dmsmith at crosswire.org> wrote:

> I'm working to use slf4j.
> 
> It will be a series of commits.
> The first is to make o.c.c.util.Logger be a facade for slf4j 1.7.2 and bind to Java Logging. Lots is deprecated as it is not in the slf4j API.
> The second will be to remove the binding to Java Logging and mark o.c.c.util.Logger as deprecated.
> The third will be to replace o.c.c.util.Logger with org.slf4j.Logger and org.slf4j.LoggerFactory.
> 
> Once this is done, we can look at eliminating concatenation in the calls to logger, using formats instead.
> 
> I'll put a pull request up shortly for the first.
> 
> On Feb 12, 2013, at 12:55 PM, Douglas Campos <qmx at qmx.me> wrote:
> 
>> On Wed, Feb 06, 2013 at 01:46:03PM +0000, Chris Burrell wrote:
>>> Hi Martin / DM
>>> 
>>> What about looking at replacing the JSword logging framework with SLF4j.
>>> For android, all you'd do is include the Android bindings:
>>> http://www.slf4j.org/android/
>> +9001 for using slf4j - it's one of the best logging façades out there :)
>> 
>> -- 
>> qmx
>> 
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
> 
> 
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel




More information about the jsword-devel mailing list