[prev in list] [next in list] [prev in thread] [next in thread] 

List:       slf4j-user
Subject:    [slf4j-user] slf4j on Android with log4j
From:       Jeff Ishaq <jishaq () gmail ! com>
Date:       2013-09-14 3:36:30
Message-ID: CAK+zTYXAwXBtVHnuS+MvC2LuJ7o_Q_chVtotkrT6yAQBdYLqsQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hey folks,

I am about 75% of the way there, but still scratching my head - can you
please provide some guidance?

I have an Android project, and I would like our logging to appear:

1) In the Android LogCat tool (to keep our Android developers happy); and,
2) A logfile on disk

I understand that slf4j is an abstraction layer, and one must include
'bindings' to hook up the slf4j API to one or more concrete logging
components.  Furthermore, I see there is an Android-specific adaptation of
slf4j called slf4j-android-1.6.1.  The benefit of the slf4j-android
adaptation seems to be that it has a built-in binding to LogCat.

So one ancillary question I have is why this is a repackaging of the slf4j
code, when it seems like the preferred architecture would be simply to
implement a slf4j-to-Android-logcat binding -- perhaps slf4j doesn't
directly work on Android without some rejiggering.  So I can accomplish 1)
above by using slf4j-android.

Then, to accomplish 2), I suppose I should use log4j to handle this because
it's been around for a very long time and therefore it's likely to be very
stable, which is important to us.  But log4j doesn't work on Android off
the shelf, due to its requirement of some java.beans.* classes that Android
doesn't implement; so, there android-logging-log4j to the rescue!  This
basically provides an alternate means of configurating log4j without using
the missing java.beans class(es).  Works for me.  So by adding
log4j-1.2.17.jar and android-logging-log4j-1.0.3.jar, I get log4j support
in my Android app.

So here is where I'm not clear - how do I tie all of this together?  It
seems like I would need a slf4j-android to log4j-1.2 binding, and I'm not
seeing this anywhere.

Please clue me in.  Thanks very much for your help!

[Attachment #5 (text/html)]

<div dir="ltr"><span \
style="font-family:arial,sans-serif;font-size:12.727272033691406px">Hey \
folks,</span><div style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px"> I am about 75% \
of the way there, but still scratching my head - can you please provide some \
guidance?</div><div style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px"> I have an \
Android project, and I would like our logging to appear:</div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px"> 1) In the \
Android LogCat tool (to keep our Android developers happy); and,</div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px">2) A logfile on \
disk</div><div style="font-family:arial,sans-serif;font-size:12.727272033691406px"> \
<br></div><div style="font-family:arial,sans-serif;font-size:12.727272033691406px">I \
understand that slf4j is an abstraction layer, and one must include \
&#39;bindings&#39; to hook up the slf4j API to one or more concrete logging \
components.  Furthermore, I see there is an Android-specific adaptation of slf4j \
called slf4j-android-1.6.1.  The benefit of the slf4j-android adaptation seems to be \
that it has a built-in binding to LogCat.  </div> <div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px">So one ancillary \
question I have is why this is a repackaging of the slf4j code, when it seems like \
the preferred architecture would be simply to implement a slf4j-to-Android-logcat \
binding -- perhaps slf4j doesn&#39;t directly work on Android without some \
rejiggering.  So I can accomplish 1) above by using slf4j-android.</div> <div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px">Then, to \
accomplish 2), I suppose I should use log4j to handle this because it&#39;s been \
around for a very long time and therefore it&#39;s likely to be very stable, which is \
important to us.  But log4j doesn&#39;t work on Android off the shelf, due to its \
requirement of some java.beans.* classes that Android doesn&#39;t implement; so, \
there android-logging-log4j to the rescue!  This basically provides an alternate \
means of configurating log4j without using the missing java.beans class(es).  Works \
for me.  So by adding log4j-1.2.17.jar and android-logging-log4j-1.0.3.jar, I get \
log4j support in my Android app.</div> <div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px">So here is where \
I&#39;m not clear - how do I tie all of this together?  It seems like I would need a \
slf4j-android to log4j-1.2 binding, and I&#39;m not seeing this anywhere.</div> <div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></div><div \
style="font-family:arial,sans-serif;font-size:12.727272033691406px">Please clue me \
in.  Thanks very much for your help!</div></div>



_______________________________________________
slf4j-user mailing list
slf4j-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/slf4j-user

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic