My favorites | Sign in
Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 91: Simple Logging Facade - slf4j.org (was: Using Commons Logging instead of log4j).
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  T.Delenikas
Type-Other
Priority-Low
Milestone-v3.4.0
Component-SMSLib


Sign in to add a comment
 
Reported by panratownik, Jun 25, 2008
This is only proposition. SmsLib is a library designed to work only with
log4j. What do you say about using commons logging library
(http://commons.apache.org/logging) to make SmsLib independend of logging
library?


Comment 1 by T.Delenikas, Jun 25, 2008
My opinion is quite the opposite...

I think that 99% of the SMSLib logging is used for tracing, debugging and adopting
code to support new modems. I mean, its used for "internal" reasons.

To be honest, I was thinking of dropping log4j in order to reduce external
dependencies and use Java/JDK logging instead.

(?)
Status: Feedback
Owner: T.Delenikas
Comment 2 by T.Delenikas, Jun 25, 2008
(No comment was entered for this change.)
Labels: -Type-Defect Type-Other
Comment 3 by panratownik, Jun 25, 2008
I was developing many libraries and from my experience I know that the best way so
far I discovered is to write library using commons logging. This is good. Why? I
paste some info from commons logging site:
"JCL provides thin-wrapper Log implementations for other logging tools, including
Log4J, Avalon LogKit (the Avalon Framework's logging infrastructure), JDK 1.4, and an
implementation of JDK 1.4 logging APIs (JSR-47) for pre-1.4 systems"

This library is great. I'm using it everywhere. When you have in your class path
log4j.jar it uses log4j for logging. When you don't have log4j it uses JDK 1.4
logging system. I didn't use Avalon LogKit but with commons logging you are able to
plugin another logging system without recompiling the code.

What you have to do is:
get Log object from LogFactory

Log log = LogFactory.getLog(getClass());

and using this log object everywhere. You don't have to worry about initialization of
log4j or other logging systems. You can plug log4j library and configuration file,
and start aplication to show that it use log4j for logging. When you remove log4j.jar
and configuration file It will be using JDK logging system without single
modification in code and without recompiling. You can try.

--
Have a nice day...
Marcin


Comment 4 by panratownik, Jun 25, 2008
Another thing. Imagine that your library is used in some defence system that
comunicate over gsm network by sms'es. It's possible to send some gps tracing and so
on. The software must be tuned very precisely. If something go bad we should have a
option to track what was that and imagine that we have one day log and looking for
Warnings or Errors in system log. Administrator should have the way to config logging
system like he want. Don't you think? 
Comment 5 by T.Delenikas, Jun 25, 2008
OK, I'll go your way.

I am a bit worried because the Apache Commons/Logging is stalled for a pretty long
time...

Anyway, I guess I'll have to take the blame for changing the library's dependencies
one more :(
Status: Accepted
Comment 6 by tulio.arends, Aug 20, 2008
In refenrence to comment 4: you can do all that with log4j, just add the correct
appenders to the root loger, which can be done via the log4j.properties file.  Also
appender is just an interface, if you have special needs just write your own and
include it in your properties.  Read http://logging.apache.org/log4j/1.2/manual.html
if you are not familiar with log4j.  Let´s not change something that has been working
fine so far.
Comment 7 by ad...@smslib.org, Aug 31, 2008
(No comment was entered for this change.)
Status: Review
Owner: ad...@smslib.org
Labels: -Priority-Medium Priority-Low
Comment 8 by T.Delenikas, Oct 17, 2008
(No comment was entered for this change.)
Owner: T.Delenikas
Comment 9 by ad...@smslib.org, Oct 31, 2008
(No comment was entered for this change.)
Owner: admin
Comment 10 by T.Delenikas, Nov 24, 2008
(No comment was entered for this change.)
Owner: T.Delenikas
Comment 11 by GDA.Hans, Dec 30, 2008
what about slf4j? many opensource projects moved from commons-logging to slf4j. check
out at http://www.slf4j.org/
Comment 12 by T.Delenikas, Dec 30, 2008
The Logging facade is the only viable solution in my mind. I should have gone with it
in the first place...

Will reconsider in the new major release.

Thanks. :)
Comment 13 by T.Delenikas, Feb 01, 2009
r1733.

Implementation and switch from "Apache log4j" to "Simple Logging Facade for Java - 
slf4j).


Summary: Simple Logging Facade - slf4j.org (was: Using Commons Logging instead of log4j).
Status: Completed
Labels: Milestone-v3.4.0 Component-SMSLib
Comment 14 by T.Delenikas, Mar 29, 2009
(No comment was entered for this change.)
Status: Fixed
Sign in to add a comment

Hosted by Google Code