|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase<ILoggingEvent>
ch.qos.logback.classic.android.LogcatAppender
public class LogcatAppender
An appender that wraps the native Android logging mechanism (logcat); redirects all logging requests to logcat
Note:
By default, this appender pushes all messages to logcat regardless
of logcat's own filter settings (i.e., everything is printed). To disable this
behavior and enable filter-checking, use setCheckLoggable(boolean)
.
See the Android Developer Guide for details on adjusting the logcat filter.
http://developer.android.com/guide/developing/tools/adb.html#filteringoutput
Field Summary |
---|
Fields inherited from class ch.qos.logback.core.AppenderBase |
---|
name, started |
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase |
---|
context |
Constructor Summary | |
---|---|
LogcatAppender()
As in most cases, the default constructor does nothing. |
Method Summary | |
---|---|
void |
append(ILoggingEvent event)
Writes an event to Android's logging mechanism (logcat) |
boolean |
getCheckLoggable()
Gets the enable status of the isLoggable() -check
that is called before logging |
PatternLayoutEncoder |
getEncoder()
Gets the pattern-layout encoder for this appender's logcat message |
PatternLayoutEncoder |
getTagEncoder()
Gets the pattern-layout encoder for this appender's logcat tag |
void |
setCheckLoggable(boolean enable)
Sets whether to ask Android before logging a message with a specific tag and priority (i.e., calls isLoggable() ). |
void |
setEncoder(PatternLayoutEncoder encoder)
Sets the pattern-layout encoder for this appender's logcat message |
void |
setTagEncoder(PatternLayoutEncoder encoder)
Sets the pattern-layout encoder for this appender's logcat tag |
void |
start()
Checks that required parameters are set, and if everything is in order, activates this appender. |
Methods inherited from class ch.qos.logback.core.AppenderBase |
---|
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, stop, toString |
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase |
---|
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ch.qos.logback.core.spi.ContextAware |
---|
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext |
Constructor Detail |
---|
public LogcatAppender()
Method Detail |
---|
public void start()
start
in interface LifeCycle
start
in class AppenderBase<ILoggingEvent>
public void append(ILoggingEvent event)
append
in class AppenderBase<ILoggingEvent>
event
- the event to be loggedpublic PatternLayoutEncoder getEncoder()
public void setEncoder(PatternLayoutEncoder encoder)
encoder
- the pattern-layout encoderpublic PatternLayoutEncoder getTagEncoder()
public void setTagEncoder(PatternLayoutEncoder encoder)
The expanded text of the pattern must be less than 23 characters as limited by Android. Layouts that exceed this limit are truncated, and a star is appended to the tag to indicate this.
The tagEncoder
result is limited to 22 characters plus a star to
indicate truncation (%logger{0}
has no length limit in logback,
but LogcatAppender
limits the length internally). For example,
if the tagEncoder
evaluated to foo.foo.foo.foo.foo.bar.Test
,
the tag seen in Logcat would be: foo.foo.foo.foo.foo.ba*
.
Note that %logger{23}
yields more useful results
(in this case: f.f.foo.foo.bar.Test
).
encoder
- the pattern-layout encoder; specify null
to
automatically use the logger's name as the tagpublic void setCheckLoggable(boolean enable)
isLoggable()
).
enable
- true
to enable; false
to disablepublic boolean getCheckLoggable()
isLoggable()
-check
that is called before logging
true
if enabled; false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |