Giter Club home page Giter Club logo

logback-android's Introduction

logback-android GitHub release API CircleCI Codacy Badge

Overview

logback-android is a lite version of logback that runs on Android. This library provides a highly configurable logging framework for Android apps, supporting multiple log destinations simultaneously:

  • files
  • SQLite databases
  • logcat
  • sockets
  • syslog
  • email

See Wiki for documentation.

For [email protected], see the 1.x branch.

Quick Start

  1. Create a new "Basic Activity" app in Android Studio.

  2. In app/build.gradle, add the following dependencies:

    dependencies {
      implementation 'org.slf4j:slf4j-api:2.0.7'
      implementation 'com.github.tony19:logback-android:3.0.0'
    }

    If using logback-android in unit tests, either use Robolectric, or use this config instead:

    dependencies {
      implementation 'org.slf4j:slf4j-api:2.0.7'
      implementation 'com.github.tony19:logback-android:3.0.0'
      testImplementation 'ch.qos.logback:logback-classic:1.2.11'
    }
    
    configurations.testImplementation {
      exclude module: 'logback-android'
    }
  3. Create app/src/main/assets/logback.xml containing:

    <configuration
      xmlns="https://tony19.github.io/logback-android/xml"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="https://tony19.github.io/logback-android/xml https://cdn.jsdelivr.net/gh/tony19/logback-android/logback.xsd"
    >
      <appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
        <tagEncoder>
          <pattern>%logger{12}</pattern>
        </tagEncoder>
        <encoder>
          <pattern>[%-20thread] %msg</pattern>
        </encoder>
      </appender>
    
      <root level="DEBUG">
        <appender-ref ref="logcat" />
      </root>
    </configuration>
  4. In MainActivity.java, add the following imports:

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
  5. ...and modify onOptionsItemSelected() to log "hello world":

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Logger log = LoggerFactory.getLogger(MainActivity.class);
        log.info("hello world");
        // ...
    }
  6. Build and start the app.

  7. Open logcat for your device (via the Android Monitor tab in Android Studio).

  8. Click the app menu, and select the menu-option. You should see "hello world" in logcat.

Download

Gradle release

dependencies {
  implementation 'org.slf4j:slf4j-api:2.0.7'
  implementation 'com.github.tony19:logback-android:3.0.0'
}

Gradle snapshot (unstable)

repositories {
  maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

dependencies {
  implementation 'org.slf4j:slf4j-api:2.0.7'
  implementation 'com.github.tony19:logback-android:3.0.1-SNAPSHOT'
}

Build

Use these commands to create the AAR:

git clone git://github.com/tony19/logback-android.git
cd logback-android
scripts/makejar.sh

The file is output to:

./build/logback-android-3.0.0-debug.aar

Release

  1. CD into ./scripts/release.

  2. Install deps: npm install

  3. Make sure local.properties contains the following keys, required to sign artifacts and upload to Maven Central:

    # output from `gpg --export-secret-keys <PUBKEY_LAST8> | base64`
    signing.key=
    # PUBKEY_LAST8 from `gpg --list-keys` (last 8 digits of pub key)
    signing.keyId=
    # password for key (can be empty if key has no password)
    signing.password=
    # path to secring.gpg file from `gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg`
    signing.secretKeyRingFile=/Users/tony/.gnupg/secring.gpg
    # OSS sonatype username at https://issues.sonatype.org
    ossrhUsername=
    # OSS sonatype password at https://issues.sonatype.org
    ossrhPassword=
    # profile ID from https://oss.sonatype.org/#stagingProfiles (select profile, and copy profile ID from hash in address bar)
    sonatypeStagingProfileId=b2413418ab44f
  4. Do a dry-run: npm run start --dry

  5. If everything looks good, rerun without --dry.

  6. Confirm the artifacts were uploaded in https://repo1.maven.org/maven2/com/github/tony19/logback-android/3.0.0/.

logback-android's People

Contributors

alps2006 avatar ash2k avatar ceharris avatar ceki avatar chrisdolan avatar compscidr avatar computerlove avatar diroussel avatar dwijnand avatar ericdahl avatar espinielli avatar huxi avatar ingebrigt avatar jkuipers avatar jon-ruckwood avatar kalgon avatar kovacevicm avatar motlin avatar nurkiewicz avatar pasieronen avatar renovate[bot] avatar richardfearn avatar rkapsi avatar sierragolf avatar solidjb avatar thallgren avatar timclemons avatar tony19 avatar ven1337 avatar ziesemer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logback-android's Issues

Where is the default location of log files? and how do I pull them?

It's taken me a while to confirm this works. My problem is I couldn't access/view the actual log file. I finally figured out it's (I believe) because I don't have file access privs to the directory via Eclipse File Explorer. This doesn't seem to be too big of an issue w/ an emulator because I can "adb pull data/data" and confirm the file existence. But on a real Android phone (eg. my moto XT912 Droid Razr), "adb pull data/data" doesn't work due to the above mentioned missing privs.

Any suggestions? I know this is more an Android issue than a logback issue, but I bet I'm not the first to wonder about it. To be clear, I'm already aware I could store it on external sdcard where all files can be viewed.

How would one actually use/access a logback-android log file from /data/data/com.example/blahblah?
Thank you for an excellent product!

How do I configure an AsyncAppender with code?

Please provide an example of how to configure the AsyncAppender with a FileAppender to write to the file in an async way. I am getting many StrictMode policy violations (StrictModeDiskWriteViolation) on every log write to my log file.

Thanks.

Problem Loading Configuration

I get the following:

I/dalvikvm( 866): Could not find method java.lang.String.isEmpty, referenced from method ch.qos.logback.classic.util.ContextInitializer.findConfigFileFromSD
W/dalvikvm( 866): VFY: unable to resolve virtual method 15141: Ljava/lang/String;.isEmpty ()Z
I/dalvikvm( 866): Could not find method java.lang.String.isEmpty, referenced from method ch.qos.logback.core.android.SystemPropertiesProxy.get
W/dalvikvm( 866): VFY: unable to resolve virtual method 15141: Ljava/lang/String;.isEmpty ()Z
W/System.err( 866): Failed to instantiate [ch.qos.logback.classic.LoggerContext]
W/System.err( 866): Reported exception:
W/System.err( 866): java.lang.NoSuchMethodError: java.lang.String.isEmpty
W/System.err( 866): at ch.qos.logback.core.android.SystemPropertiesProxy.get(Unknown Source)
W/System.err( 866): at ch.qos.logback.core.util.OptionHelper.getAndroidSystemProperty(Unknown Source)
W/System.err( 866): at ch.qos.logback.core.util.OptionHelper.getSystemProperty(Unknown Source)
W/System.err( 866): at ch.qos.logback.classic.util.StatusListenerConfigHelper.installIfAsked(Unknown Source)
W/System.err( 866): at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
W/System.err( 866): at org.slf4j.impl.StaticLoggerBinder.init(Unknown Source)
W/System.err( 866): at org.slf4j.impl.StaticLoggerBinder.(Unknown Source)
W/System.err( 866): at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
W/System.err( 866): at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
W/System.err( 866): at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
W/System.err( 866): at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
W/System.err( 866): at edu.vu.isis.ammo.core.provider.DistributorProvider.(DistributorProvider.java:40)

This is with a current build from the git repo.
The initiating call is something like...

static final Logger logger = LoggerFactory.getLogger("foo");

Oracle DB appender not logging into relevant columns?

If I use the standard ORACLE.SQL ddl file, I get 0 rows/data logged into the backend.
But if I modify the standard Oracle.sql I get logged yet incomplete rows :
Below is the data from the 3 Oracle tables after Logback'ing 8 logs w/ the simplified Oracle.sql ddl. Any other columns not listed are NULL.

0 rows in table LOGGING_EVENT_EXCEPTION

8 rows in table LOGGING_EVENT
TIMESTMP    REFERENCE_FLAG  EVENT_ID
1.38988E+12 1   1006
1.38988E+12 1   1010
1.38988E+12 1   1012
1.38988E+12 1   1016
1.38988E+12 1   1018
1.38988E+12 1   1004
1.38988E+12 1   1008
1.38988E+12 1   1014


8 rows in table  LOGGING_EVENT_PROPERTY
EVENT_ID
1006
1010
1012
1016
1018
1004
1008
1014

I modified the ORACLE.SQL ddl and removed all primary/foreign keys. I also made all columns NULL. These modifications insure that there is no balking/refusal on the backend side. It ensures that all data will be logged regardless of primary/foreign key data integrity:

create sequence LOGGING_EVENT_ID_SEQ
minvalue 1000
increment by 2
cache 1000;


CREATE TABLE logging_event
  (
    timestmp NUMBER(20) NULL,
    formatted_message VARCHAR2(4000) NULL,
    logger_name VARCHAR(254) NULL,
    level_string VARCHAR(254) NULL,
    thread_name VARCHAR(254) NULL,
    reference_flag SMALLINT NULL,
    arg0 VARCHAR(254) NULL,
    arg1 VARCHAR(254) NULL,
    arg2 VARCHAR(254) NULL,
    arg3 VARCHAR(254) NULL,
    caller_filename VARCHAR(254) NULL,
    caller_class VARCHAR(254) NULL,
    caller_method VARCHAR(254) NULL,
    caller_line CHAR(4) NULL,
    event_id NUMBER(10) NULL
--    event_id NUMBER(10) PRIMARY KEY
  );


-- the / suffix may or may not be needed depending on your SQL Client
-- Some SQL Clients, e.g. SQuirrel SQL has trouble with the following
-- trigger creation command, while SQLPlus (the basic SQL Client which
-- ships with Oracle) has no trouble at all.

CREATE TRIGGER logging_event_id_seq_trig
  BEFORE INSERT ON logging_event
  FOR EACH ROW
  BEGIN
    SELECT logging_event_id_seq.NEXTVAL
    INTO :NEW.event_id
    FROM DUAL;
  END;
/

CREATE TABLE logging_event_property
  (
    event_id         NUMBER(10) NULL,
    mapped_key VARCHAR2(254) NULL,
    mapped_value VARCHAR2(1024) NULL
  );

CREATE TABLE logging_event_exception
  (
    event_id NUMBER(10) NULL,
    i SMALLINT NULL,
    trace_line VARCHAR2(254) NULL
  );
/
-------------------------------------  

LOGCAT output: note the entry:

01-16 07:42:02.826: I/System.out(23786): 07:42:02,835 |-INFO in ch.qos.logback.core.db.DriverManagerConnectionSource@425d5588 - supportsGetGeneratedKeys=false


01-16 07:42:02.576: E/Trace(23786): error opening trace file: No such file or directory (2)
01-16 07:42:02.693: I/System.out(23786): 07:42:02,652 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [assets/logback.xml] at [assets/logback.xml]
01-16 07:42:02.701: I/System.out(23786): 07:42:02,707 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.db.DBAppender]
01-16 07:42:02.701: I/System.out(23786): 07:42:02,709 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [DB]
01-16 07:42:02.803: D/libc(23786): Forward DNS query to netd(h=localhost s=^)
01-16 07:42:02.826: I/System.out(23786): 07:42:02,834 |-INFO in ch.qos.logback.core.db.DriverManagerConnectionSource@425d5588 - Driver name=Oracle JDBC driver
01-16 07:42:02.826: I/System.out(23786): 07:42:02,835 |-INFO in ch.qos.logback.core.db.DriverManagerConnectionSource@425d5588 - Driver version=10.1.0.5.0
01-16 07:42:02.826: I/System.out(23786): 07:42:02,835 |-INFO in ch.qos.logback.core.db.DriverManagerConnectionSource@425d5588 - supportsGetGeneratedKeys=false
01-16 07:42:02.826: I/System.out(23786): 07:42:02,837 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.android.LogcatAppender]
01-16 07:42:02.826: I/System.out(23786): 07:42:02,838 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [logcat]
01-16 07:42:02.842: I/System.out(23786): 07:42:02,849 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
01-16 07:42:02.873: I/System.out(23786): 07:42:02,883 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ALL
01-16 07:42:02.873: I/System.out(23786): 07:42:02,884 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [DB] to Logger[ROOT]
01-16 07:42:02.873: I/System.out(23786): 07:42:02,885 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [logcat] to Logger[ROOT]
01-16 07:42:02.873: I/System.out(23786): 07:42:02,885 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
01-16 07:42:02.881: I/System.out(23786): 07:42:02,886 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@42561688 - Registering current configuration as safe fallback point
01-16 07:42:03.076: D/dalvikvm(23786): GC_CONCURRENT freed 1251K, 14% free 8668K/10019K, paused 12ms+13ms, total 48ms
01-16 07:42:03.170: V/com.ntier.android.jdbctest.MainActivity(23786): 07:42:02.888 14.01.16 [main]  TRACE   c.n.android.jdbctest.MainActivity - onCreate
01-16 07:42:03.287: V/com.ntier.android.util.AndroidConnectDB(23786): 07:42:03.214 14.01.16 [main]  TRACE   c.n.android.util.AndroidConnectDB - :onPreExecute()
01-16 07:42:03.381: V/com.ntier.android.jdbctest.MainActivity(23786): 07:42:03.300 14.01.16 [main]  TRACE   c.n.android.jdbctest.MainActivity - com.ntier.android.util.AndroidConnectDB@42580310
01-16 07:42:03.443: D/libEGL(23786): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
01-16 07:42:03.498: D/libEGL(23786): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
01-16 07:42:03.506: D/libEGL(23786): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
01-16 07:42:03.897: D/OpenGLRenderer(23786): Enabling debug mode 0
01-16 07:42:04.162: V/com.ntier.android.util.AndroidConnectDB(23786): 07:42:03.306 14.01.16 [AsyncTask #1]  TRACE   c.n.android.util.AndroidConnectDB - doInBackground()
01-16 07:42:04.357: V/com.ntier.android.util.AndroidConnectDB(23786): 07:42:04.170 14.01.16 [AsyncTask #1]  TRACE   c.n.android.util.AndroidConnectDB - network detected
01-16 07:42:04.443: V/com.ntier.android.util.AndroidConnectDB(23786): 07:42:04.363 14.01.16 [AsyncTask #1]  TRACE   c.n.android.util.AndroidConnectDB - network connected
01-16 07:42:04.545: V/com.ntier.android.util.AndroidConnectDB(23786): 07:42:04.454 14.01.16 [AsyncTask #1]  TRACE   c.n.android.util.AndroidConnectDB - ConnectOra constructor
01-16 07:42:04.693: V/com.ntier.android.util.AndroidConnectDB(23786): 07:42:04.626 14.01.16 [main]  TRACE   c.n.android.util.AndroidConnectDB - :onPostExecute()!

I'm using Eclipse ADT latest ,
logback-android-1.0.10-2.jar ,
slf4j-api-1.7.5.jar

LOGBACK image attached.

Model: Droid RAZR
Android version: 4.1.2

If there is a better way to attach a text file I'd like to know. It seems as if this Github only allows images to be attached and not text files?

Exception in TimeBasedRollingPolicy Java configured

I need to configure a TimeBasedRollingPolicy in Java.

The problem is that I always get an error at runtime:
java.lang.IllegalStateException: FileNamePattern [logback.%d.log] does not contain a valid DateToken

Here is my code:

TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new TimeBasedRollingPolicy<ILoggingEvent>();
rollingPolicy.setMaxHistory(10);
rollingPolicy.setFileNamePattern("logback.%d.log");
rollingPolicy.start();

LogcatAppender appends stack trace to tags when logging throwable

The <tagEncoder> for LogcatAppender was appending %xThrowable to the pattern (as would be done for the regular <encoder>. This caused the exception to be appended to the tag when logging a throwable/exception. This can be very confusing, as shown below. The log tag is not meant to contain many characters, so the %nopex conversion word should be automatically appended to the <tagEncoder> pattern.

W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1foojava.lang.RuntimeException: null
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:18) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.app.Activity.performCreate(Activity.java:5104) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.app.ActivityThread.access$600(ActivityThread.java:141) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.os.Handler.dispatchMessage(Handler.java:99) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.os.Looper.loop(Looper.java:137) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at android.app.ActivityThread.main(ActivityThread.java:5039) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at java.lang.reflect.Method.invokeNative(Native Method) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at java.lang.reflect.Method.invoke(Method.java:511) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) ~[na:0.0]
W/TEST.MainActivityjava.lang.RuntimeException: null
    at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:1  at dalvik.system.NativeStart.main(Native Method) ~[na:0.0]

The workaround is to manually append %nopex to the <tagEncoder> pattern:

<tagEncoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
    <pattern>TEST.%logger{0}%nopex</pattern>
</tagEncoder>

which would yield:

W/TEST.MainActivity( 1007): foojava.lang.RuntimeException: null
W/TEST.MainActivity( 1007):     at com.example.helloandroidsdk17.MainActivity.onCreate(MainActivity.java:18) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.app.Activity.performCreate(Activity.java:5104) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.app.ActivityThread.access$600(ActivityThread.java:141) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.os.Handler.dispatchMessage(Handler.java:99) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.os.Looper.loop(Looper.java:137) ~[na:0.0]
W/TEST.MainActivity( 1007):     at android.app.ActivityThread.main(ActivityThread.java:5039) ~[na:0.0]
W/TEST.MainActivity( 1007):     at java.lang.reflect.Method.invokeNative(Native Method) ~[na:0.0]
W/TEST.MainActivity( 1007):     at java.lang.reflect.Method.invoke(Method.java:511) ~[na:0.0]
W/TEST.MainActivity( 1007):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) ~[na:0.0]
W/TEST.MainActivity( 1007):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) ~[na:0.0]
W/TEST.MainActivity( 1007):     at dalvik.system.NativeStart.main(Native Method) ~[na:0.0]

Strictmode using syslog

Does syslog work ok with strict mode. I got this mesg when creating the logger. But no mesg when the mesg is send.
Not done extensive testing so asking if someone has experience with it.
Thanks

D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)
D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)
D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)
D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)
D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)
D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)
D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)
D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)
D/StrictMode( 3942): at com.syslog.logback.SyslogLogbackActivity.onCreate(SyslogLogbackActivity.java:26)

[SMTPAppender] Java Mail API and JavaBeans Activation Framework for Android not working

Hello,

I am trying to use logback SMTPAppender in Android 4.0.3 application.

I have added Java Mail API and JavaBeans Activation Framework in class path as well. But, I am getting following exception. I have googled as well but no useful solution found.

Some people are referring that I should be using following jar files, customized for Android but they also gave same error.

http://code.google.com/p/javamail-android/

I will appreciate any feedback.

Thanks & Regards,
Owais

MyActivity.java

package com.example.logbackandroid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.util.ContextInitializer;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.util.StatusPrinter;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        ContextInitializer ci = new ContextInitializer(lc);
        lc.reset();
        try
        {
                // I prefer autoConfig() over JoranConfigurator.doConfigure() so I
                // wouldn't need to find the file myself.
                ci.autoConfig();
        }
        catch (JoranException e)
        {
                // StatusPrinter will try to log this
                e.printStackTrace();
        }

        Logger logger = LoggerFactory.getLogger(MainActivity.class);


                        for (int i = 1; i <= 1000; i++) {
                            if ((i % 10) < 9) {
                                logger.debug("This is a debug message. Message number: " + i);
                            } else {
                                logger.warn("This is a warning message. Message number: " + i);
                            }
                        }

                        logger.error("At last an error.", new Exception("Just testing"));

                        StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

logback.xml

<configuration>
    <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
        <SMTPHost>smtp.gmail.com</SMTPHost>
        <SMTPPort>465</SMTPPort>
        <SSL>true</SSL>
        <Username>[email protected]</Username>
        <Password>password</Password>
        <To>[email protected]</To>
        <From>[email protected]</From>
        <Subject>TESTING: %logger{20} - %m</Subject>
        <layout class="ch.qos.logback.classic.PatternLayout">
            <Pattern>%date %-5level %logger - %message%n</Pattern>
        </layout>       
    </appender>
    <root level="debug">
        <appender-ref ref="EMAIL" />
    </root>  
</configuration>

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.logbackandroid"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-sdk
                android:minSdkVersion="15"
                android:targetSdkVersion="15" />

        <application
                android:allowBackup="true"
                android:icon="@drawable/ic_launcher"
                android:label="@string/app_name"
                android:theme="@style/AppTheme" >
                <activity
                        android:name="com.example.logbackandroid.MainActivity"
                        android:label="@string/app_name" >
                        <intent-filter>
                                <action android:name="android.intent.action.MAIN" />

                                <category android:name="android.intent.category.LAUNCHER" />
                        </intent-filter>
                </activity>
        </application>
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <uses-permission android:name="android.permission.INTERNET" />
</manifest>

Logcat Output

11-23 02:43:58.433: W/ActivityThread(1292): Application com.example.logbackandroid is waiting for the debugger on port 8100...
11-23 02:43:58.564: I/System.out(1292): Sending WAIT chunk
11-23 02:43:58.574: I/dalvikvm(1292): Debugger is active
11-23 02:43:58.764: I/System.out(1292): Debugger has connected
11-23 02:43:58.764: I/System.out(1292): waiting for debugger to settle...
11-23 02:43:58.844: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:43:58.854: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:43:58.965: I/System.out(1292): waiting for debugger to settle...
11-23 02:43:59.164: I/System.out(1292): waiting for debugger to settle...
11-23 02:43:59.363: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:43:59.463: I/System.out(1292): waiting for debugger to settle...
11-23 02:43:59.483: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:43:59.664: I/System.out(1292): waiting for debugger to settle...
11-23 02:43:59.867: I/System.out(1292): waiting for debugger to settle...
11-23 02:43:59.874: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:43:59.884: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:00.074: I/System.out(1292): waiting for debugger to settle...
11-23 02:44:00.274: I/System.out(1292): waiting for debugger to settle...
11-23 02:44:00.384: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:00.394: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:00.474: I/System.out(1292): waiting for debugger to settle...
11-23 02:44:00.678: I/System.out(1292): waiting for debugger to settle...
11-23 02:44:00.874: I/System.out(1292): debugger has settled (1358)
11-23 02:44:00.884: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:00.894: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:01.384: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:01.404: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:01.894: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:01.904: D/dalvikvm(1292): threadid=1: still suspended after undo (sc=1 dc=1)
11-23 02:44:01.904: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:02.394: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:02.404: D/dalvikvm(1292): threadid=1: still suspended after undo (sc=1 dc=1)
11-23 02:44:02.414: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:02.893: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:02.904: D/dalvikvm(1292): threadid=1: still suspended after undo (sc=1 dc=1)
11-23 02:44:02.904: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:03.394: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:03.414: D/dalvikvm(1292): threadid=1: still suspended after undo (sc=1 dc=1)
11-23 02:44:03.414: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:04.127: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:04.143: D/dalvikvm(1292): threadid=1: still suspended after undo (sc=1 dc=1)
11-23 02:44:04.143: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:04.394: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:04.404: D/dalvikvm(1292): threadid=1: still suspended after undo (sc=1 dc=1)
11-23 02:44:04.404: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:04.893: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:04.924: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:05.394: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:05.434: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:05.893: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:05.923: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:05.974: D/dalvikvm(1292): GC_CONCURRENT freed 234K, 4% free 9243K/9607K, paused 5ms+4ms
11-23 02:44:06.394: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:06.414: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:06.664: E/dalvikvm(1292): Could not find class 'javax.naming.InitialContext', referenced from method ch.qos.logback.core.net.SMTPAppenderBase.lookupSessionInJNDI
11-23 02:44:06.664: W/dalvikvm(1292): VFY: unable to resolve new-instance 1405 (Ljavax/naming/InitialContext;) in Lch/qos/logback/core/net/SMTPAppenderBase;
11-23 02:44:06.664: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x001e
11-23 02:44:06.703: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x25a6 at 0x20 in Lch/qos/logback/core/net/SMTPAppenderBase;.lookupSessionInJNDI
11-23 02:44:06.893: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:06.923: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:07.394: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:07.414: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:07.893: I/dalvikvm(1292): threadid=3: reacting to signal 3
11-23 02:44:07.913: I/dalvikvm(1292): Wrote stack traces to '/data/anr/traces.txt'
11-23 02:44:08.174: D/dalvikvm(1292): GC_CONCURRENT freed 386K, 6% free 9291K/9799K, paused 4ms+4ms
11-23 02:44:11.504: D/dalvikvm(1292): GC_CONCURRENT freed 450K, 6% free 9290K/9863K, paused 5ms+4ms
11-23 02:44:14.074: D/dalvikvm(1292): GC_CONCURRENT freed 418K, 6% free 9318K/9863K, paused 5ms+3ms
11-23 02:44:15.343: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.343: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.343: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:15.353: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.353: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.353: I/dalvikvm(1292): Could not find method javax.activation.DataHandler.getContent, referenced from method javax.mail.internet.MimeMessage.getContent
11-23 02:44:15.353: W/dalvikvm(1292): VFY: unable to resolve virtual method 8434: Ljavax/activation/DataHandler;.getContent ()Ljava/lang/Object;
11-23 02:44:15.353: D/dalvikvm(1292): VFY: replacing opcode 0x6e at 0x000b
11-23 02:44:15.373: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.373: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.383: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.383: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.383: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeMessage.getDataHandler
11-23 02:44:15.383: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeMessage;
11-23 02:44:15.383: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x0005
11-23 02:44:15.393: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.393: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.393: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.393: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.393: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:15.404: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.404: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.404: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:15.413: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.413: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.413: I/dalvikvm(1292): Could not find method javax.activation.DataHandler.getInputStream, referenced from method javax.mail.internet.MimeMessage.getInputStream
11-23 02:44:15.413: W/dalvikvm(1292): VFY: unable to resolve virtual method 8438: Ljavax/activation/DataHandler;.getInputStream ()Ljava/io/InputStream;
11-23 02:44:15.413: D/dalvikvm(1292): VFY: replacing opcode 0x6e at 0x0004
11-23 02:44:15.433: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.433: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.433: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeMessage.setContent
11-23 02:44:15.433: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeMessage;
11-23 02:44:15.433: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x000a
11-23 02:44:15.443: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.443: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.443: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeMessage.setContent
11-23 02:44:15.443: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeMessage;
11-23 02:44:15.443: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x0000
11-23 02:44:15.454: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.454: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.454: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:15.454: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.454: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.474: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.474: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.474: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeMessage.updateHeaders
11-23 02:44:15.474: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeMessage;
11-23 02:44:15.474: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x0012
11-23 02:44:15.484: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.484: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.494: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20ea at 0x0c in Ljavax/mail/internet/MimeMessage;.getDataHandler
11-23 02:44:15.494: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.494: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.494: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20e8 at 0x0c in Ljavax/mail/internet/MimeMessage;.setContent
11-23 02:44:15.504: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.504: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.504: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20e8 at 0x06 in Ljavax/mail/internet/MimeMessage;.setContent
11-23 02:44:15.514: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:15.514: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:15.514: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20e8 at 0x1a in Ljavax/mail/internet/MimeMessage;.updateHeaders
11-23 02:44:15.774: I/System.out(1292): 02:44:04,538 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
11-23 02:44:15.774: I/System.out(1292): 02:44:04,559 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.example.logbackandroid-2.apk!/AndroidManifest.xml]
11-23 02:44:15.774: I/System.out(1292): 02:44:05,563 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [assets/logback-test.xml]
11-23 02:44:15.774: I/System.out(1292): 02:44:05,576 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [assets/logback.xml] at [jar:file:/data/app/com.example.logbackandroid-2.apk!/assets/logback.xml]
11-23 02:44:15.774: I/System.out(1292): 02:44:05,599 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@412f0888 - URL [jar:file:/data/app/com.example.logbackandroid-2.apk!/assets/logback.xml] is not of type file
11-23 02:44:15.774: I/System.out(1292): 02:44:06,643 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
11-23 02:44:15.774: I/System.out(1292): 02:44:06,649 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender]
11-23 02:44:15.774: I/System.out(1292): 02:44:06,731 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [EMAIL]
11-23 02:44:15.784: I/System.out(1292): 02:44:15,600 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
11-23 02:44:15.784: I/System.out(1292): 02:44:15,610 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [EMAIL] to Logger[ROOT]
11-23 02:44:15.784: I/System.out(1292): 02:44:15,615 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11-23 02:44:15.784: I/System.out(1292): 02:44:15,623 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@412f0160 - Registering current configuration as safe fallback point
11-23 02:44:16.134: D/dalvikvm(1292): GC_CONCURRENT freed 368K, 5% free 9377K/9863K, paused 5ms+4ms
11-23 02:44:18.664: D/dalvikvm(1292): GC_CONCURRENT freed 322K, 5% free 9491K/9927K, paused 4ms+5ms
11-23 02:44:21.474: D/dalvikvm(1292): GC_CONCURRENT freed 477K, 7% free 9452K/10055K, paused 5ms+4ms
11-23 02:44:24.014: D/dalvikvm(1292): GC_CONCURRENT freed 395K, 7% free 9443K/10055K, paused 4ms+3ms
11-23 02:44:26.923: D/dalvikvm(1292): GC_CONCURRENT freed 333K, 6% free 9497K/10055K, paused 4ms+4ms
11-23 02:44:28.894: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:28.894: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:28.894: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:28.914: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:28.914: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:28.914: I/dalvikvm(1292): Could not find method javax.activation.DataHandler.getContentType, referenced from method javax.mail.internet.MimeBodyPart.updateHeaders
11-23 02:44:28.914: W/dalvikvm(1292): VFY: unable to resolve virtual method 8435: Ljavax/activation/DataHandler;.getContentType ()Ljava/lang/String;
11-23 02:44:28.914: D/dalvikvm(1292): VFY: replacing opcode 0x6e at 0x0007
11-23 02:44:28.914: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:28.924: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:28.933: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:28.933: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:28.933: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:28.943: I/dalvikvm(1292): Could not find method javax.activation.DataHandler.writeTo, referenced from method javax.mail.internet.MimeBodyPart.writeTo
11-23 02:44:28.943: W/dalvikvm(1292): VFY: unable to resolve virtual method 8447: Ljavax/activation/DataHandler;.writeTo (Ljava/io/OutputStream;)V
11-23 02:44:28.943: D/dalvikvm(1292): VFY: replacing opcode 0x6e at 0x0021
11-23 02:44:28.963: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:28.963: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:28.963: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.attachFile
11-23 02:44:28.963: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeBodyPart;
11-23 02:44:28.963: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x0005
11-23 02:44:28.983: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:28.983: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:28.983: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:28.983: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:28.983: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:28.993: I/dalvikvm(1292): Could not find method javax.activation.DataHandler.getContent, referenced from method javax.mail.internet.MimeBodyPart.getContent
11-23 02:44:28.993: W/dalvikvm(1292): VFY: unable to resolve virtual method 8434: Ljavax/activation/DataHandler;.getContent ()Ljava/lang/Object;
11-23 02:44:28.993: D/dalvikvm(1292): VFY: replacing opcode 0x6e at 0x000b
11-23 02:44:29.004: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.004: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.023: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.023: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.023: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.getDataHandler
11-23 02:44:29.023: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeBodyPart;
11-23 02:44:29.023: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x0004
11-23 02:44:29.033: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.033: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.043: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.053: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.053: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:29.063: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.063: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.073: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:29.073: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.073: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.073: I/dalvikvm(1292): Could not find method javax.activation.DataHandler.getInputStream, referenced from method javax.mail.internet.MimeBodyPart.getInputStream
11-23 02:44:29.083: W/dalvikvm(1292): VFY: unable to resolve virtual method 8438: Ljavax/activation/DataHandler;.getInputStream ()Ljava/io/InputStream;
11-23 02:44:29.083: D/dalvikvm(1292): VFY: replacing opcode 0x6e at 0x0004
11-23 02:44:29.093: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.103: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.103: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.setContent
11-23 02:44:29.103: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeBodyPart;
11-23 02:44:29.103: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x000a
11-23 02:44:29.103: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.113: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.113: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.setContent
11-23 02:44:29.113: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeBodyPart;
11-23 02:44:29.113: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x0000
11-23 02:44:29.124: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.124: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.133: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:29.133: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.143: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.153: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.153: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.153: E/dalvikvm(1292): Could not find class 'javax.activation.DataHandler', referenced from method javax.mail.internet.MimeBodyPart.updateHeaders
11-23 02:44:29.164: W/dalvikvm(1292): VFY: unable to resolve new-instance 1255 (Ljavax/activation/DataHandler;) in Ljavax/mail/internet/MimeBodyPart;
11-23 02:44:29.164: D/dalvikvm(1292): VFY: replacing opcode 0x22 at 0x0008
11-23 02:44:29.173: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.173: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.173: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20ea at 0x07 in Ljavax/mail/internet/MimeBodyPart;.attachFile
11-23 02:44:29.184: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.184: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.194: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20ea at 0x0b in Ljavax/mail/internet/MimeBodyPart;.getDataHandler
11-23 02:44:29.194: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.204: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.204: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20e8 at 0x0c in Ljavax/mail/internet/MimeBodyPart;.setContent
11-23 02:44:29.204: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.214: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.214: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20e8 at 0x06 in Ljavax/mail/internet/MimeBodyPart;.setContent
11-23 02:44:29.214: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:29.224: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:29.224: D/dalvikvm(1292): DexOpt: unable to opt direct call 0x20e8 at 0x10 in Ljavax/mail/internet/MimeBodyPart;.updateHeaders
11-23 02:44:29.594: I/System.out(1292): 02:44:04,538 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
11-23 02:44:29.604: I/System.out(1292): 02:44:04,559 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.example.logbackandroid-2.apk!/AndroidManifest.xml]
11-23 02:44:29.604: I/System.out(1292): 02:44:05,563 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [assets/logback-test.xml]
11-23 02:44:29.604: I/System.out(1292): 02:44:05,576 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [assets/logback.xml] at [jar:file:/data/app/com.example.logbackandroid-2.apk!/assets/logback.xml]
11-23 02:44:29.604: I/System.out(1292): 02:44:05,599 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@412f0888 - URL [jar:file:/data/app/com.example.logbackandroid-2.apk!/assets/logback.xml] is not of type file
11-23 02:44:29.614: I/System.out(1292): 02:44:06,643 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
11-23 02:44:29.614: I/System.out(1292): 02:44:06,649 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender]
11-23 02:44:29.614: I/System.out(1292): 02:44:06,731 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [EMAIL]
11-23 02:44:29.614: I/System.out(1292): 02:44:15,600 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
11-23 02:44:29.614: I/System.out(1292): 02:44:15,610 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [EMAIL] to Logger[ROOT]
11-23 02:44:29.614: I/System.out(1292): 02:44:15,615 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11-23 02:44:29.614: I/System.out(1292): 02:44:15,623 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@412f0160 - Registering current configuration as safe fallback point
11-23 02:44:29.614: I/System.out(1292): 02:44:15,799 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
11-23 02:44:29.614: I/System.out(1292): 02:44:15,813 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.example.logbackandroid-2.apk!/AndroidManifest.xml]
11-23 02:44:29.614: I/System.out(1292): 02:44:16,685 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [assets/logback-test.xml]
11-23 02:44:29.624: I/System.out(1292): 02:44:16,699 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [assets/logback.xml] at [jar:file:/data/app/com.example.logbackandroid-2.apk!/assets/logback.xml]
11-23 02:44:29.624: I/System.out(1292): 02:44:16,717 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@412a27d8 - URL [jar:file:/data/app/com.example.logbackandroid-2.apk!/assets/logback.xml] is not of type file
11-23 02:44:29.624: I/System.out(1292): 02:44:17,544 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
11-23 02:44:29.624: I/System.out(1292): 02:44:17,549 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender]
11-23 02:44:29.634: I/System.out(1292): 02:44:17,554 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [EMAIL]
11-23 02:44:29.634: I/System.out(1292): 02:44:25,334 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
11-23 02:44:29.634: I/System.out(1292): 02:44:25,343 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [EMAIL] to Logger[ROOT]
11-23 02:44:29.634: I/System.out(1292): 02:44:25,346 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11-23 02:44:29.634: I/System.out(1292): 02:44:25,355 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@412a27b8 - Registering current configuration as safe fallback point
11-23 02:44:29.634: I/System.out(1292): 02:44:25,376 |-INFO in ch.qos.logback.classic.net.SMTPAppender[EMAIL] - SMTPAppender [EMAIL] is tracking [1] buffers
11-23 02:44:30.153: D/gralloc_goldfish(1292): Emulator without GPU emulation detected.
11-23 02:44:30.604: D/dalvikvm(1292): GC_CONCURRENT freed 399K, 6% free 9527K/10055K, paused 4ms+4ms
11-23 02:44:33.404: D/dalvikvm(1292): GC_CONCURRENT freed 389K, 6% free 9536K/10119K, paused 4ms+3ms
11-23 02:44:34.394: D/dalvikvm(1292): GC_FOR_ALLOC freed 106K, 6% free 9527K/10119K, paused 40ms
11-23 02:44:34.403: I/dalvikvm-heap(1292): Grow heap (frag case) to 9.458MB for 92468-byte allocation
11-23 02:44:34.445: D/dalvikvm(1292): GC_FOR_ALLOC freed 62K, 7% free 9554K/10247K, paused 43ms
11-23 02:44:34.484: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:34.484: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:34.494: W/dalvikvm(1292): VFY: unable to find class referenced in signature (Ljavax/activation/DataHandler;)
11-23 02:44:34.494: I/dalvikvm(1292): Failed resolving Ljavax/activation/DataHandler; interface 1419 'Lmyjava/awt/datatransfer/Transferable;'
11-23 02:44:34.494: W/dalvikvm(1292): Link of class 'Ljavax/activation/DataHandler;' failed
11-23 02:44:34.494: I/dalvikvm(1292): Could not find method javax.activation.DataHandler.getName, referenced from method javax.mail.internet.MimeUtility.getEncoding
11-23 02:44:34.494: W/dalvikvm(1292): VFY: unable to resolve virtual method 8439: Ljavax/activation/DataHandler;.getName ()Ljava/lang/String;
11-23 02:44:34.504: D/dalvikvm(1292): VFY: replacing opcode 0x6e at 0x0004

"no applicable action for" happens when using Proguard

I got messages below when testing my Proguard-ed apk:

I/System.out( 1326): 16:39:02,536 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LOGCAT]
I/System.out( 1326): 16:39:02,598 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@0:0 - no applicable action for [tagEncoder], current pattern is [[configuration][appender][tagEncoder]]
I/System.out( 1326): 16:39:02,614 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@0:0 - no applicable action for [pattern], current pattern is [[configuration][appender][tagEncoder][pattern]]
I/System.out( 1326): 16:39:02,631 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@0:0 - no applicable action for [encoder], current pattern is [[configuration][appender][encoder]]
I/System.out( 1326): 16:39:02,647 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@0:0 - no applicable action for [pattern], current pattern is [[configuration][appender][encoder][pattern]]
I/System.out( 1326): 16:39:02,647 |-ERROR in ch.qos.logback.classic.android.LogcatAppender[LOGCAT] - No layout set for the appender named [LOGCAT].

However, the debug version seems fine:

I/System.out( 1274): 16:36:59,445 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
I/System.out( 1274): 16:36:59,446 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.android.LogcatAppender]
I/System.out( 1274): 16:36:59,447 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LOGCAT]
I/System.out( 1274): 16:36:59,510 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [tagEncoder] property
I/System.out( 1274): 16:36:59,603 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
I/System.out( 1274): 16:36:59,652 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
I/System.out( 1274): 16:36:59,653 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [LOGCAT] to Logger[ROOT]
I/System.out( 1274): 16:36:59,654 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.

I think this is because Joran uses reflection to do its job, so I wonder what Proguard excluding rules should be included in my proguard.cfg file.

LogcatAppender tagEncoder

It appears that the tagEncoder is only fired when classes are supplied to the LoggerFactory and not when strings are supplied.

Presume we have the following two loggers defined:

private static final Logger flogger = LoggerFactory.getLogger("flog");
private static final Logger clogger = LoggerFactory.getLogger(Clog.class);

And the logcat appender is configured so....

<appender name="LOGCAT" class="ch.qos.logback.classic.android.LogcatAppender">
    <checkLoggable>false</checkLoggable>
    <tagEncoder>
        <pattern>acme.%logger{15}</pattern>
    </tagEncoder>
    <encoder>
        <pattern>[%method] %msg%n</pattern>
    </encoder>
</appender>

The clogger messages dutifully print out the name with 'acme' prepended 'acme.Clog' but not the flogger.
Is this the correct behavior?

Update documentation

The user manual specific to logback-android (i.e., not already covered by the original logback manual) is lacking. The following features need to be documented:

  • new properties for 1.0.8-1 ($EXT_DIR, etc.)
  • how to use SMTPAppender (with javamail-android)
  • Proguard settings for a release (see notes from Issues)
  • improved examples (currently, the code config example on the site is confusing because it shows hard-coded config and file-based config in one program)
  • the default configuration-load order (TODO: make this configurable)
  • new Android SDK r21 warns about attributes in AndroidManifest.xml that are not prefixed with android:...worked around by disabling lint warning in Eclipse settings (TODO: try alternatives...allow <logback> outside of <manifest>?)
  • how to use SQLite DBAppender (TODO: consider moving this -- and most other non-essential appenders from classic -- into logback-extensions...keep the popular appenders: FileAppender, RollingFileAppender, and LogcatAppender)

How to configure logs directory

Am getting this error while giving the path as '/data/data/com.example/files/log/foo.log
Am having FileNotFoundException

'01-03 16:08:02.466: I/System.out(16808): 16:08:02,459 |-ERROR in ch.qos.logback.core.FileAppender[file] - Failed to create parent directories for [/data/data/com.example/files/log/foo.log]

01-03 16:08:02.466: I/System.out(16808): 16:08:02,460 |-ERROR in ch.qos.logback.core.FileAppender[file] - openFile(/data/data/com.example/files/log/foo.log,true) failed java.io.FileNotFoundException: /data/data/com.example/files/log/foo.log: open failed: ENOENT (No such file or directory)

dom4j dependency causing compiler warnings

logback-android-classic-1.0.7-1.jar depends on dom4j-1.6.1.jar but logback-classic-1.0.7.jar does not. dom4j-1.6.1.jar causes the following compiler warnings:

warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.dom4j.dom.DOMNodeHelper$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.dom4j.io.DocumentInputSource$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.dom4j.rule.RuleManager$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.dom4j.swing.BranchTreeNode$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.dom4j.swing.LeafTreeNode$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.dom4j.xpath.DefaultXPath$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

Therefore I'd like to know:

  1. Why are we depending on dom4j?
  2. Is there a way to correct this problem?

Initialization performance

I keep logback configuration in file assets/logback.xml.
First invocation of LoggerFactory.getLogger() lasts 2 seconds (!). It's definitely too much.
Almost all this time application spends in ContextInitializer.configureByManifest() method.

Logback-android version: 1.0.7-1
Android: 2.3.3
Device: HTC Wildfire S (CPU: 600 MHz)
Application size: ~7 MB

Versions 1.0.7-2-SNAPSHOT and 1.0.8-1-SNAPSHOT do not log

The following configuration logs to Logcat correctly:

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.2</version>
        </dependency>
        <dependency>
            <groupId>com.github.tony19</groupId>
            <artifactId>logback-android-classic</artifactId>
            <version>1.0.7-1</version>
            <exclusions>
                <exclusion>
                    <artifactId>android</artifactId>
                    <groupId>com.google.android</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

However, if I change the version of logback-android-classic to 1.0.7-2-SNAPSHOT or 1.0.8.1-SNAPSHOT I don't get any output on Logcat from logback. Something major is broken.

Can you reproduce this on your end?

xpp3 and xmlParserAPIs dependencies causing compiler errors

As a follow-up to issue #26 I now get compiler errors due to the xpp3 and xmlParserAPIs dependencies.

xpp3:

trouble processing "javax/xml/namespace/QName.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

xmlParserAPIs:

trouble processing "javax/xml/parsers/DocumentBuilder.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

Excluding these two results in a clean compilation.

Unable to dex when using maven

I'm using the following pom.xml,
when I run mvn install it fails "Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:dex"

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.roisagiv.logback</groupId>
    <artifactId>LogbackTester</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>LogbackTester</name>

    <properties>
        <platform.version>2.2.1</platform.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>com.github.tony19</groupId>
            <artifactId>logback-android-core</artifactId>
            <version>1.0.7-1</version>
        </dependency>

        <dependency>
            <groupId>com.github.tony19</groupId>
            <artifactId>logback-android-classic</artifactId>
            <version>1.0.7-1</version>
        </dependency>

<!--
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
-->

        <dependency>
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>2.2_r3</version>
            <scope>provided</scope>
        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>8</platform>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Thanks!

Strict Mode - Resource leak with logback.xml

This issue pertains to Logback 1.08.

With strict mode enabled, I'm seeing an error which causes the application to crash. The error only occurs when attempting to pull logback configuration from the logback.xml file in our assets directory.

From what I gather, it's because the stream that reads the XML file is not properly closed.

We did not have this with Logback 1.07.

Here's the stack trace:

05-07 18:51:33.563: E/StrictMode(10832): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
05-07 18:51:33.563: E/StrictMode(10832): java.lang.Throwable: Explicit termination method 'end' not called
05-07 18:51:33.563: E/StrictMode(10832): at dalvik.system.CloseGuard.open(CloseGuard.java:184)
05-07 18:51:33.563: E/StrictMode(10832): at java.util.zip.Inflater.(Inflater.java:82)
05-07 18:51:33.563: E/StrictMode(10832): at java.util.zip.ZipFile.getInputStream(ZipFile.java:270)
05-07 18:51:33.563: E/StrictMode(10832): at java.util.jar.JarFile.getInputStream(JarFile.java:388)
05-07 18:51:33.563: E/StrictMode(10832): at libcore.net.url.JarURLConnectionImpl.getInputStream(JarURLConnectionImpl.java:226)
05-07 18:51:33.563: E/StrictMode(10832): at java.net.URL.openStream(URL.java:462)
05-07 18:51:33.563: E/StrictMode(10832): at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:436)
05-07 18:51:33.563: E/StrictMode(10832): at ch.qos.logback.classic.util.ContextInitializer.getResource(Unknown Source)
05-07 18:51:33.563: E/StrictMode(10832): at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromAssets(Unknown Source)
05-07 18:51:33.563: E/StrictMode(10832): at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
05-07 18:51:33.563: E/StrictMode(10832): at org.slf4j.impl.StaticLoggerBinder.init(Unknown Source)
05-07 18:51:33.563: E/StrictMode(10832): at org.slf4j.impl.StaticLoggerBinder.(Unknown Source)
05-07 18:51:33.563: E/StrictMode(10832): at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
05-07 18:51:33.563: E/StrictMode(10832): at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
05-07 18:51:33.563: E/StrictMode(10832): at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
05-07 18:51:33.563: E/StrictMode(10832): at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
05-07 18:51:33.563: E/StrictMode(10832): at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
05-07 18:51:33.563: E/StrictMode(10832): at c.a.v.a.a.AndroidApplication.(AndroidApplication.java:12)
05-07 18:51:33.563: E/StrictMode(10832): at java.lang.Class.newInstanceImpl(Native Method)
05-07 18:51:33.563: E/StrictMode(10832): at java.lang.Class.newInstance(Class.java:1319)
05-07 18:51:33.563: E/StrictMode(10832): at android.app.Instrumentation.newApplication(Instrumentation.java:957)
05-07 18:51:33.563: E/StrictMode(10832): at android.app.Instrumentation.newApplication(Instrumentation.java:942)
05-07 18:51:33.563: E/StrictMode(10832): at android.app.LoadedApk.makeApplication(LoadedApk.java:556)
05-07 18:51:33.563: E/StrictMode(10832): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4101)
05-07 18:51:33.563: E/StrictMode(10832): at android.app.ActivityThread.access$1300(ActivityThread.java:126)
05-07 18:51:33.563: E/StrictMode(10832): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
05-07 18:51:33.563: E/StrictMode(10832): at android.os.Handler.dispatchMessage(Handler.java:99)
05-07 18:51:33.563: E/StrictMode(10832): at android.os.Looper.loop(Looper.java:137)
05-07 18:51:33.563: E/StrictMode(10832): at android.app.ActivityThread.main(ActivityThread.java:4586)
05-07 18:51:33.563: E/StrictMode(10832): at java.lang.reflect.Method.invokeNative(Native Method)
05-07 18:51:33.563: E/StrictMode(10832): at java.lang.reflect.Method.invoke(Method.java:511)
05-07 18:51:33.563: E/StrictMode(10832): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-07 18:51:33.563: E/StrictMode(10832): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-07 18:51:33.563: E/StrictMode(10832): at dalvik.system.NativeStart.main(Native Method)
05-07 18:51:33.563: W/System.err(10832): StrictMode VmPolicy violation with POLICY_DEATH; shutting down.

java.io.FileNotFoundException (Read-only file system) happens before reconfiguration

My config is below:

<logback>
    <configuration debug="true">
        <appender
            name="LOGCAT"
            class="ch.qos.logback.classic.android.LogcatAppender" >
            <tagEncoder>
                <pattern>%logger{0}</pattern>
            </tagEncoder>
            <encoder>
                <pattern>%d{HH:mm:ss} - %msg %n</pattern>
            </encoder>
        </appender>
        <appender
            name="File"
            class="ch.qos.logback.core.rolling.RollingFileAppender" >
            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                    <pattern>%d{HH:mm:ss} [%thread] [%.-1level] - %msg %n</pattern>
            </encoder>

            <File>${log_path:-}agent.log</File>

            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy" >
                <FileNamePattern>${log_path:-}agent.%d{yyyy-MM-dd}.zip</FileNamePattern>
                <!-- keep 7 days' worth of history -->
                <MaxHistory>7</MaxHistory>

                <TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP" >
                    <MaxFileSize>10MB</MaxFileSize><!-- MaxFileSize should be just above daily log size -->
                </TimeBasedFileNamingAndTriggeringPolicy>
            </rollingPolicy>
        </appender>

        <root level="TRACE" >
            <!-- <appender-ref ref="LOGCAT" />  -->
            <appender-ref ref="File" />
        </root>
    </configuration>
</logback>

And I set ${log_path:-} during Log class initialization like below:

    static {
        init();
    }

    public static void init() {
        Log.d("MDMLog","Log init starts!");

        System.setProperty("log_path", Environment.getExternalStorageDirectory() + "/neusoft/mdm/log/");

        //Reload:
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        ContextInitializer ci = new ContextInitializer(lc);
        lc.reset();
        try {
          //I prefer autoConfig() over JoranConfigurator.doConfigure() so I wouldn't need to find the file myself.
          ci.autoConfig(); 
        } catch (JoranException e) {
          // StatusPrinter will try to log this
            Log.d(TAG,"Exception happened during configuring!",e);
        }
        Log.d(TAG,"Print logback status-------------------------start");
        StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
        Log.d(TAG,"Print logback status-------------------------end");
    }

I got twice java.io.FileNotFoundException

I/ActivityManager( 94): Start proc com.neusoft.mdm for activity com.neusoft.mdm/.MDMAgentMain: pid=975 uid=10036 gids={3003, 3002, 3001, 1015}
I/ActivityThread( 975): Pub com.neusoft.mdm.database.mdmbaseproivder: com.neusoft.mdm.database.MDMContentProvider
D/DBParts ( 975): create DBParts.
V/RenderScript_jni( 190): surfaceDestroyed
I/System.out( 975): 01:50:24,948 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.android.LogcatAppender]
I/System.out( 975): 01:50:24,951 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LOGCAT]
I/System.out( 975): 01:50:24,960 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [tagEncoder] property
I/System.out( 975): 01:50:24,977 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
I/System.out( 975): 01:50:24,983 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
I/System.out( 975): 01:50:24,985 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [File]
I/System.out( 975): 01:50:25,031 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use zip compression
I/System.out( 975): 01:50:25,033 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern agent.%d{yyyy-MM-dd} for the active file
I/System.out( 975): 01:50:25,042 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - The date pattern is 'yyyy-MM-dd' from file name pattern 'agent.%d{yyyy-MM-dd}.zip'.
I/System.out( 975): 01:50:25,042 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - Roll-over at midnight.
I/System.out( 975): 01:50:25,043 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - Setting initial period to Sat Jan 28 01:50:25 ๆ ผๆž—ๅฐผๆฒปๆ ‡ๅ‡†ๆ—ถ้—ด+0000 2012
I/System.out( 975): 01:50:25,046 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - Active log file name: agent.log
I/System.out( 975): 01:50:25,047 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - File property is set to [agent.log]
I/System.out( 975): 01:50:25,049 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[File] - openFile(agent.log,true) call failed. java.io.FileNotFoundException: /agent.log (Read-only file system)
I/System.out( 975): at java.io.FileNotFoundException: /agent.log (Read-only file system)
I/System.out( 975): at at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
I/System.out( 975): at at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
I/System.out( 975): at at java.io.FileOutputStream.(FileOutputStream.java:94)
I/System.out( 975): at at ch.qos.logback.core.recovery.ResilientFileOutputStream.(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.FileAppender.openFile(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.FileAppender.start(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.rolling.RollingFileAppender.start(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.action.AppenderAction.end(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
I/System.out( 975): at at ch.qos.logback.classic.util.ContextInitializer.configureByManifest(Unknown Source)
I/System.out( 975): at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
I/System.out( 975): at at org.slf4j.impl.StaticLoggerBinder.init(Unknown Source)
I/System.out( 975): at at org.slf4j.impl.StaticLoggerBinder.(Unknown Source)
I/System.out( 975): at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
I/System.out( 975): at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
I/System.out( 975): at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
I/System.out( 975): at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
I/System.out( 975): at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
I/System.out( 975): at at com.neusoft.mdm.util.MDMLog.(MDMLog.java:15)
I/System.out( 975): at at com.neusoft.mdm.MDMAgentMain.onCreate(MDMAgentMain.java:17)
I/System.out( 975): at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
I/System.out( 975): at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
I/System.out( 975): at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
I/System.out( 975): at at android.app.ActivityThread.access$1500(ActivityThread.java:117)
I/System.out( 975): at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
I/System.out( 975): at at android.os.Handler.dispatchMessage(Handler.java:99)
I/System.out( 975): at at android.os.Looper.loop(Looper.java:123)
I/System.out( 975): at at android.app.ActivityThread.main(ActivityThread.java:3683)
I/System.out( 975): at at java.lang.reflect.Method.invokeNative(Native Method)
I/System.out( 975): at at java.lang.reflect.Method.invoke(Method.java:507)
I/System.out( 975): at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
I/System.out( 975): at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
I/System.out( 975): at at dalvik.system.NativeStart.main(Native Method)
I/System.out( 975): 01:50:25,059 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
I/System.out( 975): 01:50:25,060 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [File] to Logger[ROOT]
I/System.out( 975): 01:50:25,062 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
I/System.out( 975): 01:50:24,633 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
I/System.out( 975): 01:50:24,635 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.neusoft.mdm-2.apk!/AndroidManifest.xml]
I/System.out( 975): 01:50:24,948 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.android.LogcatAppender]
I/System.out( 975): 01:50:24,951 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LOGCAT]
I/System.out( 975): 01:50:24,960 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [tagEncoder] property
I/System.out( 975): 01:50:24,977 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
I/System.out( 975): 01:50:24,983 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
I/System.out( 975): 01:50:24,985 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [File]
I/System.out( 975): 01:50:25,031 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use zip compression
I/System.out( 975): 01:50:25,033 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern agent.%d{yyyy-MM-dd} for the active file
I/System.out( 975): 01:50:25,042 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - The date pattern is 'yyyy-MM-dd' from file name pattern 'agent.%d{yyyy-MM-dd}.zip'.
I/System.out( 975): 01:50:25,042 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - Roll-over at midnight.
I/System.out( 975): 01:50:25,043 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - Setting initial period to Sat Jan 28 01:50:25 ๆ ผๆž—ๅฐผๆฒปๆ ‡ๅ‡†ๆ—ถ้—ด+0000 2012
I/System.out( 975): 01:50:25,046 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - Active log file name: agent.log
I/System.out( 975): 01:50:25,047 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - File property is set to [agent.log]
I/System.out( 975): 01:50:25,049 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[File] - openFile(agent.log,true) call failed. java.io.FileNotFoundException: /agent.log (Read-only file system)
I/System.out( 975): at java.io.FileNotFoundException: /agent.log (Read-only file system)
I/System.out( 975): at at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
I/System.out( 975): at at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
I/System.out( 975): at at java.io.FileOutputStream.(FileOutputStream.java:94)
I/System.out( 975): at at ch.qos.logback.core.recovery.ResilientFileOutputStream.(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.FileAppender.openFile(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.FileAppender.start(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.rolling.RollingFileAppender.start(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.action.AppenderAction.end(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
I/System.out( 975): at at ch.qos.logback.classic.util.ContextInitializer.configureByManifest(Unknown Source)
I/System.out( 975): at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
I/System.out( 975): at at org.slf4j.impl.StaticLoggerBinder.init(Unknown Source)
I/System.out( 975): at at org.slf4j.impl.StaticLoggerBinder.(Unknown Source)
I/System.out( 975): at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
I/System.out( 975): at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
I/System.out( 975): at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
I/System.out( 975): at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
I/System.out( 975): at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
I/System.out( 975): at at com.neusoft.mdm.util.MDMLog.(MDMLog.java:15)
I/System.out( 975): at at com.neusoft.mdm.MDMAgentMain.onCreate(MDMAgentMain.java:17)
I/System.out( 975): at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
I/System.out( 975): at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
I/System.out( 975): at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
I/System.out( 975): at at android.app.ActivityThread.access$1500(ActivityThread.java:117)
I/System.out( 975): at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
I/System.out( 975): at at android.os.Handler.dispatchMessage(Handler.java:99)
I/System.out( 975): at at android.os.Looper.loop(Looper.java:123)
I/System.out( 975): at at android.app.ActivityThread.main(ActivityThread.java:3683)
I/System.out( 975): at at java.lang.reflect.Method.invokeNative(Native Method)
I/System.out( 975): at at java.lang.reflect.Method.invoke(Method.java:507)
I/System.out( 975): at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
I/System.out( 975): at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
I/System.out( 975): at at dalvik.system.NativeStart.main(Native Method)
I/System.out( 975): 01:50:25,059 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
I/System.out( 975): 01:50:25,060 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [File] to Logger[ROOT]
I/System.out( 975): 01:50:25,062 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
D/MDMLog ( 975): Log init starts!
D/dalvikvm( 975): GC_CONCURRENT freed 1164K, 57% free 2959K/6727K, external 1625K/2137K, paused 4ms+3ms
I/System.out( 975): 01:50:25,031 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use zip compression
I/System.out( 975): 01:50:25,033 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern agent.%d{yyyy-MM-dd} for the active file
I/System.out( 975): 01:50:25,042 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - The date pattern is 'yyyy-MM-dd' from file name pattern 'agent.%d{yyyy-MM-dd}.zip'.
I/System.out( 975): 01:50:25,042 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - Roll-over at midnight.
I/System.out( 975): 01:50:25,043 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - Setting initial period to Sat Jan 28 01:50:25 ๆ ผๆž—ๅฐผๆฒปๆ ‡ๅ‡†ๆ—ถ้—ด+0000 2012
I/System.out( 975): 01:50:25,046 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - Active log file name: agent.log
I/System.out( 975): 01:50:25,047 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - File property is set to [agent.log]
I/System.out( 975): 01:50:25,049 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[File] - openFile(agent.log,true) call failed. java.io.FileNotFoundException: /agent.log (Read-only file system)
I/System.out( 975): at java.io.FileNotFoundException: /agent.log (Read-only file system)
I/System.out( 975): at at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
I/System.out( 975): at at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
I/System.out( 975): at at java.io.FileOutputStream.(FileOutputStream.java:94)
I/System.out( 975): at at ch.qos.logback.core.recovery.ResilientFileOutputStream.(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.FileAppender.openFile(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.FileAppender.start(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.rolling.RollingFileAppender.start(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.action.AppenderAction.end(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
I/System.out( 975): at at ch.qos.logback.classic.util.ContextInitializer.configureByManifest(Unknown Source)
I/System.out( 975): at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
I/System.out( 975): at at org.slf4j.impl.StaticLoggerBinder.init(Unknown Source)
I/System.out( 975): at at org.slf4j.impl.StaticLoggerBinder.(Unknown Source)
I/System.out( 975): at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
I/System.out( 975): at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
I/System.out( 975): at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
I/System.out( 975): at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
I/System.out( 975): at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
I/System.out( 975): at at com.neusoft.mdm.util.MDMLog.(MDMLog.java:15)
I/System.out( 975): at at com.neusoft.mdm.MDMAgentMain.onCreate(MDMAgentMain.java:17)
I/System.out( 975): at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
I/System.out( 975): at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
I/System.out( 975): at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
I/System.out( 975): at at android.app.ActivityThread.access$1500(ActivityThread.java:117)
I/System.out( 975): at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
I/System.out( 975): at at android.os.Handler.dispatchMessage(Handler.java:99)
I/System.out( 975): at at android.os.Looper.loop(Looper.java:123)
I/System.out( 975): at at android.app.ActivityThread.main(ActivityThread.java:3683)
I/System.out( 975): at at java.lang.reflect.Method.invokeNative(Native Method)
I/System.out( 975): at at java.lang.reflect.Method.invoke(Method.java:507)
I/System.out( 975): at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
I/System.out( 975): at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
I/System.out( 975): at at dalvik.system.NativeStart.main(Native Method)
I/System.out( 975): 01:50:25,059 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
I/System.out( 975): 01:50:25,060 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [File] to Logger[ROOT]
I/System.out( 975): 01:50:25,062 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
I/System.out( 975): 01:50:25,086 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
I/System.out( 975): 01:50:25,087 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.neusoft.mdm-2.apk!/AndroidManifest.xml]
I/System.out( 975): 01:50:25,336 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.android.LogcatAppender]
I/System.out( 975): 01:50:25,338 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LOGCAT]
I/System.out( 975): 01:50:25,342 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [tagEncoder] property
I/System.out( 975): 01:50:25,350 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
I/System.out( 975): 01:50:25,357 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
I/System.out( 975): 01:50:25,358 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [File]
I/System.out( 975): 01:50:25,423 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use zip compression
I/System.out( 975): 01:50:25,424 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern /mnt/sdcard/neusoft/mdm/log/agent.%d{yyyy-MM-dd} for the active file
D/dalvikvm( 975): GC_CONCURRENT freed 738K, 57% free 2911K/6727K, external 1625K/2137K, paused 2ms+4ms
I/System.out( 975): 01:50:25,452 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@405c11d0 - The date pattern is 'yyyy-MM-dd' from file name pattern '/mnt/sdcard/neusoft/mdm/log/agent.%d{yyyy-MM-dd}.zip'.
I/System.out( 975): 01:50:25,453 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@405c11d0 - Roll-over at midnight.
I/System.out( 975): 01:50:25,455 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@405c11d0 - Setting initial period to Sat Jan 28 01:45:28 ๆ ผๆž—ๅฐผๆฒปๆ ‡ๅ‡†ๆ—ถ้—ด+0000 2012
I/System.out( 975): 01:50:25,458 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - Active log file name: /mnt/sdcard/neusoft/mdm/log/agent.log
I/System.out( 975): 01:50:25,460 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - File property is set to [/mnt/sdcard/neusoft/mdm/log/agent.log]
I/System.out( 975): 01:50:25,461 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
I/System.out( 975): 01:50:25,462 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [File] to Logger[ROOT]
I/System.out( 975): 01:50:25,463 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
D/MDMLog ( 975): Print logback status-------------------------start
I/System.out( 975): 01:50:24,633 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
I/System.out( 975): 01:50:24,635 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.neusoft.mdm-2.apk!/AndroidManifest.xml]
I/System.out( 975): 01:50:24,948 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.android.LogcatAppender]
I/System.out( 975): 01:50:24,951 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LOGCAT]
I/System.out( 975): 01:50:24,960 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [tagEncoder] property
I/System.out( 975): 01:50:24,977 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
I/System.out( 975): 01:50:24,983 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
I/System.out( 975): 01:50:24,985 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [File]
I/System.out( 975): 01:50:25,031 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use zip compression
I/System.out( 975): 01:50:25,033 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern agent.%d{yyyy-MM-dd} for the active file
I/System.out( 975): 01:50:25,042 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - The date pattern is 'yyyy-MM-dd' from file name pattern 'agent.%d{yyyy-MM-dd}.zip'.
I/System.out( 975): 01:50:25,042 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - Roll-over at midnight.
I/System.out( 975): 01:50:25,043 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@40620f60 - Setting initial period to Sat Jan 28 01:50:25 ๆ ผๆž—ๅฐผๆฒปๆ ‡ๅ‡†ๆ—ถ้—ด+0000 2012
I/System.out( 975): 01:50:25,046 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - Active log file name: agent.log
I/System.out( 975): 01:50:25,047 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - File property is set to [agent.log]
I/System.out( 975): 01:50:25,049 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[File] - openFile(agent.log,true) call failed. java.io.FileNotFoundException: /agent.log (Read-only file system)
I/System.out( 975): at java.io.FileNotFoundException: /agent.log (Read-only file system)
I/System.out( 975): at at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
I/System.out( 975): at at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:232)
I/System.out( 975): at at java.io.FileOutputStream.(FileOutputStream.java:94)
I/System.out( 975): at at ch.qos.logback.core.recovery.ResilientFileOutputStream.(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.FileAppender.openFile(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.FileAppender.start(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.rolling.RollingFileAppender.start(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.action.AppenderAction.end(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
I/System.out( 975): at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
I/System.out( 975): at at ch.qos.logback.classic.util.ContextInitializer.configureByManifest(Unknown Source)
I/System.out( 975): at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
I/System.out( 975): at at org.slf4j.impl.StaticLoggerBinder.init(Unknown Source)
I/System.out( 975): at at org.slf4j.impl.StaticLoggerBinder.(Unknown Source)
I/System.out( 975): at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
I/System.out( 975): at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
I/System.out( 975): at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
I/System.out( 975): at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
I/System.out( 975): at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
I/System.out( 975): at at com.neusoft.mdm.util.MDMLog.(MDMLog.java:15)
I/System.out( 975): at at com.neusoft.mdm.MDMAgentMain.onCreate(MDMAgentMain.java:17)
I/System.out( 975): at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
I/System.out( 975): at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
I/System.out( 975): at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
I/System.out( 975): at at android.app.ActivityThread.access$1500(ActivityThread.java:117)
I/System.out( 975): at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
I/System.out( 975): at at android.os.Handler.dispatchMessage(Handler.java:99)
I/System.out( 975): at at android.os.Looper.loop(Looper.java:123)
I/System.out( 975): at at android.app.ActivityThread.main(ActivityThread.java:3683)
I/System.out( 975): at at java.lang.reflect.Method.invokeNative(Native Method)
I/System.out( 975): at at java.lang.reflect.Method.invoke(Method.java:507)
I/System.out( 975): at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
I/System.out( 975): at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
I/System.out( 975): at at dalvik.system.NativeStart.main(Native Method)
I/System.out( 975): 01:50:25,059 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
I/System.out( 975): 01:50:25,060 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [File] to Logger[ROOT]
I/System.out( 975): 01:50:25,062 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
I/System.out( 975): 01:50:25,086 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
I/System.out( 975): 01:50:25,087 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.neusoft.mdm-2.apk!/AndroidManifest.xml]
I/System.out( 975): 01:50:25,336 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.android.LogcatAppender]
I/System.out( 975): 01:50:25,338 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LOGCAT]
I/System.out( 975): 01:50:25,342 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [tagEncoder] property
I/System.out( 975): 01:50:25,350 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
I/System.out( 975): 01:50:25,357 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
I/System.out( 975): 01:50:25,358 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [File]
I/System.out( 975): 01:50:25,423 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use zip compression
I/System.out( 975): 01:50:25,424 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern /mnt/sdcard/neusoft/mdm/log/agent.%d{yyyy-MM-dd} for the active file
I/System.out( 975): 01:50:25,452 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@405c11d0 - The date pattern is 'yyyy-MM-dd' from file name pattern '/mnt/sdcard/neusoft/mdm/log/agent.%d{yyyy-MM-dd}.zip'.
I/System.out( 975): 01:50:25,453 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@405c11d0 - Roll-over at midnight.
I/System.out( 975): 01:50:25,455 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@405c11d0 - Setting initial period to Sat Jan 28 01:45:28 ๆ ผๆž—ๅฐผๆฒปๆ ‡ๅ‡†ๆ—ถ้—ด+0000 2012
I/System.out( 975): 01:50:25,458 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - Active log file name: /mnt/sdcard/neusoft/mdm/log/agent.log
I/System.out( 975): 01:50:25,460 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[File] - File property is set to [/mnt/sdcard/neusoft/mdm/log/agent.log]
I/System.out( 975): 01:50:25,461 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
I/System.out( 975): 01:50:25,462 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [File] to Logger[ROOT]
I/System.out( 975): 01:50:25,463 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
D/MDMLog ( 975): Print logback status-------------------------end

I wonder how can I prevent the exception happening.

LogcatAppender filtering

Not a bug, more user "gotcha".
The LogcatAppender is a wrapper around the android logger.
The android logger performs filtering using the system properties.
The issue is how the two filtering mechanism should interact.
Suppose there is a logger called "foo", the corresponding system
property has been set log.tag.foo DEBUG and the logback
config is filtering 'foo' to ERROR.
What should happen to, say, a WARN message?

My thought is that, if specified, the logback config should win
but there should be an unambiguous "pass" flag that
lets the underlying mechanism do its thing.

Cannot write to file owned by another app

If a shared library logs into a file through different application(using a FIleAppender), the file is owned by the first application to log. The second application has thus a permission issue (because of UID owning) to write into the log file.

java.lang.ArrayIndexOutOfBoundsException happens when old log files exits

I got below exception when I start my app

D/MDMLog  (  581): Log init starts!
I/System.out(  581): 00:56:46,432 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
I/System.out(  581): 00:56:46,432 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.neusoft.mdm-1.apk!/AndroidManifest.xml]
I/System.out(  581): 00:56:46,602 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.android.LogcatAppender]
I/System.out(  581): 00:56:46,603 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [LOGCAT]
I/System.out(  581): 00:56:46,607 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [tagEncoder] property
I/System.out(  581): 00:56:46,618 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
I/System.out(  581): 00:56:46,648 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
I/System.out(  581): 00:56:46,649 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [File]
D/dalvikvm(  581): GC_CONCURRENT freed 598K, 57% free 2920K/6727K, external 1625K/2137K, paused 2ms+4ms
I/System.out(  581): 00:56:46,708 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use zip compression
I/System.out(  581): 00:56:46,710 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern /mnt/sdcard/neusoft/mdm/log/agent.%d{yyyy-MM-dd} for the active file
I/System.out(  581): 00:56:46,716 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4052cb48 - The date pattern is 'yyyy-MM-dd' from file name pattern '/mnt/sdcard/neusoft/mdm/log/agent.%d{yyyy-MM-dd}.zip'.
I/System.out(  581): 00:56:46,717 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4052cb48 - Roll-over at midnight.
I/System.out(  581): 00:56:46,719 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4052cb48 - Setting initial period to Fri Jan 27 21:50:02 ๆ ผๆž—ๅฐผๆฒปๆ ‡ๅ‡†ๆ—ถ้—ด+0000 2012
I/System.out(  581): 00:56:46,724 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@0:0 - RuntimeException in Action for tag [rollingPolicy] java.lang.ArrayIndexOutOfBoundsException
I/System.out(  581):     at java.lang.ArrayIndexOutOfBoundsException
I/System.out(  581):     at     at java.util.regex.Matcher.group(Matcher.java:359)
I/System.out(  581):     at     at ch.qos.logback.core.rolling.helper.FileFilterUtil.extractCounter(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.rolling.helper.FileFilterUtil.findHighestCounter(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.computeCurrentPeriodsHighestCounterValue(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.start(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.start(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.classic.util.ContextInitializer.configureByManifest(Unknown Source)
I/System.out(  581):     at     at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source)
I/System.out(  581):     at     at com.neusoft.mdm.util.MDMLog.init(MDMLog.java:53)
I/System.out(  581):     at     at com.neusoft.mdm.MDMApplication.onCreate(MDMApplication.java:24)
I/System.out(  581):     at     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
I/System.out(  581):     at     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3272)
I/System.out(  581):     at     at android.app.ActivityThread.access$2200(ActivityThread.java:117)
I/System.out(  581):     at     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
I/System.out(  581):     at     at android.os.Handler.dispatchMessage(Handler.java:99)
I/System.out(  581):     at     at android.os.Looper.loop(Looper.java:123)
I/System.out(  581):     at     at android.app.ActivityThread.main(ActivityThread.java:3683)
I/System.out(  581):     at     at java.lang.reflect.Method.invokeNative(Native Method)
I/System.out(  581):     at     at java.lang.reflect.Method.invoke(Method.java:507)
I/System.out(  581):     at     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
I/System.out(  581):     at     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
I/System.out(  581):     at     at dalvik.system.NativeStart.main(Native Method)
I/System.out(  581): 00:56:46,740 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[File] - No TriggeringPolicy was set for the RollingFileAppender named File
I/System.out(  581): 00:56:46,741 |-WARN in ch.qos.logback.core.rolling.RollingFileAppender[File] - For more information, please visit http://logback.qos.ch/codes.html#rfa_no_tp
I/System.out(  581): 00:56:46,743 |-WARN in ch.qos.logback.core.joran.action.AppenderAction - The object at the of the stack is not the appender named [File] pushed earlier.
I/System.out(  581): 00:56:46,745 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to TRACE
I/System.out(  581): 00:56:46,746 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [File] to Logger[ROOT]
I/System.out(  581): 00:56:46,750 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
I

I got my log files like below

$ adb shell ls -l /sdcard/neusoft/mdm/log
----rwxr-x system   sdcard_rw  4885747 2012-01-27 21:50 agent.log
----rwxr-x system   sdcard_rw   549863 2012-01-27 00:38 agent.2012-01-26.zip
----rwxr-x system   sdcard_rw   593444 2012-01-27 19:55 agent.2012-01-27.zip

And my configuration is below:

<logback>
    <configuration debug="true">
        <appender
            name="LOGCAT"
            class="ch.qos.logback.classic.android.LogcatAppender" >
            <tagEncoder>
                <pattern>%logger{0}</pattern>
            </tagEncoder>
            <encoder>
                <pattern>%d{HH:mm:ss} - %msg %n</pattern>
            </encoder>
        </appender>
        <appender
            name="File"
            class="ch.qos.logback.core.rolling.RollingFileAppender" >
            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                    <pattern>%d{HH:mm:ss} [%thread] [%.-1level] - %msg %n</pattern>
            </encoder>

            <File>${log_path:-}agent.log</File>

            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy" >
                <FileNamePattern>${log_path:-}agent.%d{yyyy-MM-dd}.zip</FileNamePattern>
                <!-- keep 7 days' worth of history -->
                <MaxHistory>7</MaxHistory>

                <TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP" >
                    <MaxFileSize>10MB</MaxFileSize><!-- MaxFileSize should be just above daily log size -->
                </TimeBasedFileNamingAndTriggeringPolicy>
            </rollingPolicy>
        </appender>

        <root level="TRACE" >
            <!-- <appender-ref ref="LOGCAT" />  -->
            <appender-ref ref="File" />
        </root>
    </configuration>
</logback>

logging file to sdcard failed

reproduce steps:

  1. logback.xml is defined like this:
<configuration debug="true">
    <appender
        name="LOGCAT"
        class="ch.qos.logback.classic.android.LogcatAppender">
        <tagEncoder>
            <pattern>%logger{0}</pattern>
        </tagEncoder>
        <encoder>
            <pattern>%message at \(%file:%line\) %n</pattern>
        </encoder>
    </appender>

    <appender
        name="FILE"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/mnt/sdcard/log/ttt.log</file>
        <rollingPolicy
            class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>5</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>[%d] [%-5level] - %message %n</pattern>
        </encoder>
    </appender>

    <root level="TRACE">
        <appender-ref ref="LOGCAT" />
        <appender-ref ref="FILE" />
    </root>
</configuration>
  1. switch USB storage to on (I can use this sdcard as removable driver in my Windows PC)
  2. switch USB storage to off, do some operations in android app

expected result:
the log can be printed to /mnt/sdcard/log/ttt.log

real result:
the log was dropped for file appender; only output to logcat

<lazy>true</lazy> results in no log file or log dir being created

Prob: When using "lazy" in logback-android, the log files and dir is NEVER created. But LOGCAT still works fine.
When commenting out "lazy" (toggling off) then everything works fine.

I'm using Eclipse ADT latest ,
logback-android-1.0.10-2.jar ,
slf4j-api-1.7.5.jar

LOGBACK image attached.

Model: Droid RAZR
Android version: 4.1.2

FileAppender not working when exporting with Proguard

I am using Logback library for logging in my android application and it works great. However, when I export the application and obfuscate the code using Proguard, it does not work correctly (I'm using CustomFileAppender, and the file is not created).

I tried to skip the class CustomFileAppender and the whole packages of logback in the proguard config file as follows:

-keep class org.slf4j.** { *; }
-keep class ch.qos.** { *; }
-keep class com.CustomFileAppender.** { *; }

Logback built-in FileAppender also not working after exported with Proguard.

The reason is in timeBasedFileNamingAndTriggeringPolicy (Logback starts to work if these lines are taken out):

  <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP" >
                maxFileSize>1MB</maxFileSize
  </timeBasedFileNamingAndTriggeringPolicy

LOGCAT:
|-ERROR in ch.qos.logback.core.joran.spi.Interpreter@0:0 - RuntimeException in Action for tag [timeBasedFileNamingAndTriggeringPolicy] java.lang.NullPointerException 03-14 16:50:18.240: I/System.out(2551): at java.lang.NullPointerException 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase.start(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.start(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.classic.util.ContextInitializer.configureByManifest(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at org.slf4j.impl.StaticLoggerBinder.init(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at org.slf4j.impl.StaticLoggerBinder.<clinit>(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at org.slf4j.LoggerFactory.bind(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at org.slf4j.LoggerFactory.performInitialization(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at org.slf4j.LoggerFactory.getILoggerFactory(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at org.slf4j.LoggerFactory.getLogger(Unknown Source) 03-14 16:50:18.240: I/System.out(2551): at at org.slf4j.LoggerFactory.getLogger(Unknown Source)

NetworkOnMainThreadException during initialization

Running on Android emulator, API level 14, logback-android throws this exception during its initialization because it accesses the network. The exception can be prevented by manually configuring StrictMode to allow networking, but it is slightly annoying that you have to do that.

Thanks a lot for this package! It takes a lot of work away from my project!
Hartmut

11-22 12:38:03.670: I/System.out(1528): 12:38:03,579 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@3:16 - RuntimeException in Action for tag [configuration] android.os.NetworkOnMainThreadException
11-22 12:38:03.670: I/System.out(1528):     at android.os.NetworkOnMainThreadException
11-22 12:38:03.670: I/System.out(1528):     at  at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1084)
11-22 12:38:03.670: I/System.out(1528):     at  at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
11-22 12:38:03.670: I/System.out(1528):     at  at java.net.InetAddress.getLocalHost(InetAddress.java:371)
11-22 12:38:03.670: I/System.out(1528):     at  at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:32)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:41)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:48)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:130)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:147)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:133)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:96)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:55)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:85)
11-22 12:38:03.681: I/System.out(1528):     at  at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:158)
11-22 12:38:03.681: I/System.out(1528):     at  at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
11-22 12:38:03.681: I/System.out(1528):     at  at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54)
11-22 12:38:03.681: I/System.out(1528):     at  at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
11-22 12:38:03.690: I/System.out(1528):     at  at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
11-22 12:38:03.690: I/System.out(1528):     at  at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
11-22 12:38:03.690: I/System.out(1528):     at  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
11-22 12:38:03.690: I/System.out(1528):     at  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
...

"No config in SD card" warning causes config log output

The configuration log output is only supposed to be printed when:

  • an error/warning occurred in processing the config XML
  • the library user explicitly requested it (e.g., via a debug flag)

When a logback config file was not found on the SD card (at /sdcard/logback/logback.xml), a warning status was issued, which resulted in the configuration log printing to System.out. logcat shows something like this:

10-30 20:52:54.448: I/System.out(804): 20:52:54,311 |-WARN in ch.qos.logback.classic.LoggerContext[default] - No config in SD card
10-30 20:52:54.448: I/System.out(804): 20:52:54,314 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [AndroidManifest.xml] at [jar:file:/data/app/com.example.helloandroid-2.apk!/AndroidManifest.xml]
10-30 20:52:54.448: I/System.out(804): 20:52:54,444 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
10-30 20:52:54.458: I/System.out(804): 20:52:54,445 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.

logback initialization is normally silent.

Provide default logback configuration

How/where to set the initial logger configuration?
The code sample shows the configuration happening upon the open of an Activity.
I would like the configuration file read from the android device before the first activity is started.

How to select an alternate logback.xml?

When running a ServiceTestCase (for example) the default android context is that of the application being tested and not that of the test application itself. Apparently Joran doesn't use the android context but rather, the apk is examined directly. The result is as if the android test context were used. For testing this is what I want.

Should logback be using an Android Context and the getAssets() with selectable Android context?
I am also having getting the configurator.doConfigure("logback-alt.xml") call to find the configuration in the assets directory. I also tried configurator.doConfigure("assets/logback-alt.xml"). I'm not sure if this is a bug or if I am just doing it wrong.

Incidentally the configurator.doConfigure() approach works fine.

Maven2 build and Repository

I have a project which uses Maven and the other participants would like to pull logback-android from a Maven repository.
I see an earlier email where you seemed to indicate that you would eventually have a maven build.
Should I do a pom.xml in my fork?

Changed ant build.xml

The README indicates that the build is to be performed using ant.
There seem to be a bunch of Maven build files lying about.
The android sdk uses a different style of build than previously.
What is the proper way to build?
Should there be a new build.xml for the new sdk?

File Appender not using timestamp correctly

According to logback the following configuration;

<configuration>

  <!-- Insert the current time formatted as "yyyyMMdd'T'HHmmss" under
       the key "bySecond" into the logger context. This value will be
       available to all subsequent configuration elements. -->
  <timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"/>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <!-- use the previously created timestamp to create a uniquely
         named log file -->
    <file>log-${bySecond}.txt</file>
    <encoder>
      <pattern>%logger{35} - %msg%n</pattern>
    </encoder>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="FILE" />
  </root>
</configuration>

Will create a new file with the given timestamp. Thus,

<configuration>

  <!-- Insert the current time formatted as "yyyyMMdd'T'HHmmss" under
       the key "bySecond" into the logger context. This value will be
       available to all subsequent configuration elements. -->
  <timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"/>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <!-- use the previously created timestamp to create a uniquely
         named log file -->
    <file>log-${bySecond}.txt</file>
    <append>false</append>
    <encoder>
      <pattern>%logger{35} - %msg%n</pattern>
    </encoder>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="FILE" />
  </root>
</configuration>

Should create a new file for ever logged message if the timestamp is updated each time the statement is logged. If the timestamp does not update each time, then this is not a bug.

Relative file paths are relative to root directory

When relative file paths are specified for the FileAppender, the files are created relative to the root directory, which is typically non-writable in Android, leading to a FileNotFoundException when the appender tries to open the file for writing. The workaround is to use absolute paths, pointing to somewhere writable for the app.

The default destination for writing out files in Android (via [openFileOutput()](http://developer.android.com/reference/android/content/Context.html#openFileOutput%28java.lang.String, int%29) is the app's "files" directory (getFilesDir(), where the app always has write-permission -- all things being equal.

This is an enhancement request to prepend that default to the relative path so that the file is created successfully for logging. This allows an app to write logs to a path that does not require special permissions (e.g., WRITE_EXTERNAL_STORAGE for writing to SD).

This is based on a recent StackOverflow question.

Maven test failing & Maven Central Repository

Currently, when building logback-android from the issue7 branch with Maven, the following test fails:

14:33:27,095 |-ERROR in ch.qos.logback.core.joran.action.IncludeAction - Failed to open [file:/home/nick/Development/logback-android/logback-core/toto] java.io.FileNotFoundException: /home/nick/Development/logback-android/logback-core/toto (No such file or directory)
    at java.io.FileNotFoundException: /home/nick/Development/logback-android/logback-core/toto (No such file or directory)
    at  at java.io.FileInputStream.open(Native Method)
    at  at java.io.FileInputStream.<init>(FileInputStream.java:137)
    at  at java.io.FileInputStream.<init>(FileInputStream.java:96)
    at  at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:87)
    at  at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:178)
    at  at java.net.URL.openStream(URL.java:1029)
    at  at ch.qos.logback.core.joran.action.IncludeAction.openURL(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.getInputStream(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.begin(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeActionTest.noFileFound(Unknown Source)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at  at java.lang.reflect.Method.invoke(Method.java:616)
    at  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at  at org.apache.maven.surefire.junitcore.ClassDemarcatingRunner.run(ClassDemarcatingRunner.java:58)
    at  at org.junit.runners.Suite.runChild(Suite.java:128)
    at  at org.junit.runners.Suite.runChild(Suite.java:24)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at  at java.lang.Thread.run(Thread.java:679)
14:33:27,095 |-INFO in ch.qos.logback.core.joran.TrivialConfigurator@979e8b - Registering current configuration as safe fallback point

14:33:27,098 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@16614e7 - Adding [file:/home/nick/Development/logback-android/logback-core/target/test-output/out1619802052] to configuration watch list.
14:33:27,099 |-ERROR in ch.qos.logback.core.joran.event.SaxEventRecorder@7bc899 - no more data available START_DOCUMENT seen  ... @1:1 org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; no more data available START_DOCUMENT seen  ... @1:1
    at org.xml.sax.SAXParseException: no more data available START_DOCUMENT seen  ... @1:1
    at  at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(Unknown Source)
    at  at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.parseAndRecord(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.begin(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeActionTest.withCorruptFile(Unknown Source)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at  at java.lang.reflect.Method.invoke(Method.java:616)
    at  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at  at org.apache.maven.surefire.junitcore.ClassDemarcatingRunner.run(ClassDemarcatingRunner.java:58)
    at  at org.junit.runners.Suite.runChild(Suite.java:128)
    at  at org.junit.runners.Suite.runChild(Suite.java:24)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at  at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.EOFException: no more data available START_DOCUMENT seen  ... @1:1
    at  at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
    at  at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
    at  at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1523)
    at  at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
    at  at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at  at org.xmlpull.v1.sax2.Driver.parse(Driver.java:321)
    at  ... 43 common frames omitted
14:33:27,099 |-ERROR in ch.qos.logback.core.joran.action.IncludeAction - Error while parsing  target/test-output/out1619802052 ch.qos.logback.core.joran.spi.JoranException: no more data available START_DOCUMENT seen  ... @1:1
    at ch.qos.logback.core.joran.spi.JoranException: no more data available START_DOCUMENT seen  ... @1:1
    at  at ch.qos.logback.core.joran.event.SaxEventRecorder.handleError(Unknown Source)
    at  at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(Unknown Source)
    at  at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.parseAndRecord(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.begin(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeActionTest.withCorruptFile(Unknown Source)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at  at java.lang.reflect.Method.invoke(Method.java:616)
    at  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at  at org.apache.maven.surefire.junitcore.ClassDemarcatingRunner.run(ClassDemarcatingRunner.java:58)
    at  at org.junit.runners.Suite.runChild(Suite.java:128)
    at  at org.junit.runners.Suite.runChild(Suite.java:24)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at  at java.lang.Thread.run(Thread.java:679)
Caused by: org.xml.sax.SAXParseException: no more data available START_DOCUMENT seen  ... @1:1
    at  ... 43 common frames omitted
Caused by: java.io.EOFException: no more data available START_DOCUMENT seen  ... @1:1
    at  at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
    at  at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
    at  at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1523)
    at  at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
    at  at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at  at org.xmlpull.v1.sax2.Driver.parse(Driver.java:321)
    at  ... 43 common frames omitted
14:33:27,099 |-INFO in ch.qos.logback.core.joran.TrivialConfigurator@19eda2c - Registering current configuration as safe fallback point

14:33:27,127 |-ERROR in ch.qos.logback.core.joran.action.IncludeAction - URL [htp://logback.qos.ch] is not well formed. java.net.MalformedURLException: unknown protocol: htp
    at java.net.MalformedURLException: unknown protocol: htp
    at  at java.net.URL.<init>(URL.java:590)
    at  at java.net.URL.<init>(URL.java:480)
    at  at java.net.URL.<init>(URL.java:429)
    at  at ch.qos.logback.core.joran.action.IncludeAction.attributeToURL(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.getInputURL(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.getInputStream(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.begin(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeActionTest.malformedURL(Unknown Source)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at  at java.lang.reflect.Method.invoke(Method.java:616)
    at  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at  at org.apache.maven.surefire.junitcore.ClassDemarcatingRunner.run(ClassDemarcatingRunner.java:58)
    at  at org.junit.runners.Suite.runChild(Suite.java:128)
    at  at org.junit.runners.Suite.runChild(Suite.java:24)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at  at java.lang.Thread.run(Thread.java:679)
14:33:27,127 |-INFO in ch.qos.logback.core.joran.TrivialConfigurator@15356d5 - Registering current configuration as safe fallback point

org.xmlpull.v1.XmlPullParserException: unexpected character in markup   (position: START_TAG seen ...ffsetWidth;\n                }\n                for (var n = 0; n < ... @42:37)    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1261)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at org.xmlpull.v1.sax2.Driver.parseSubTree(Driver.java:448)
    at org.xmlpull.v1.sax2.Driver.parse(Driver.java:340)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(Unknown Source)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(Unknown Source)
    at ch.qos.logback.core.joran.action.IncludeAction.parseAndRecord(Unknown Source)
    at ch.qos.logback.core.joran.action.IncludeAction.begin(Unknown Source)
    at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Unknown Source)
    at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at ch.qos.logback.core.joran.action.IncludeActionTest.unknownURL(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.apache.maven.surefire.junitcore.ClassDemarcatingRunner.run(ClassDemarcatingRunner.java:58)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:24)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)
14:33:27,130 |-INFO in ch.qos.logback.core.joran.util.ConfigurationWatchListUtil@16614e7 - Adding [http://logback2345.qos.ch] to configuration watch list.
14:33:27,130 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@19fdbcb - URL [http://logback2345.qos.ch] is not of type file
14:33:32,133 |-ERROR in ch.qos.logback.core.joran.event.SaxEventRecorder@16fdac - XML_PARSING - Parsing fatal error on line 42 and column 37 org.xml.sax.SAXParseException; lineNumber: 42; columnNumber: 37; parsing error: org.xmlpull.v1.XmlPullParserException: unexpected character in markup   (position: START_TAG seen ...ffsetWidth;\n                }\n                for (var n = 0; n < ... @42:37) 
    at org.xml.sax.SAXParseException: parsing error: org.xmlpull.v1.XmlPullParserException: unexpected character in markup   (position: START_TAG seen ...ffsetWidth;\n                }\n                for (var n = 0; n < ... @42:37) 
    at  at org.xmlpull.v1.sax2.Driver.parseSubTree(Driver.java:451)
    at  at org.xmlpull.v1.sax2.Driver.parse(Driver.java:340)
    at  at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(Unknown Source)
    at  at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.parseAndRecord(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeAction.begin(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.Interpreter.startElement(Unknown Source)
    at  at ch.qos.logback.core.joran.spi.EventPlayer.play(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(Unknown Source)
    at  at ch.qos.logback.core.joran.action.IncludeActionTest.unknownURL(Unknown Source)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at  at java.lang.reflect.Method.invoke(Method.java:616)
    at  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at  at org.apache.maven.surefire.junitcore.ClassDemarcatingRunner.run(ClassDemarcatingRunner.java:58)
    at  at org.junit.runners.Suite.runChild(Suite.java:128)
    at  at org.junit.runners.Suite.runChild(Suite.java:24)
    at  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at  at java.lang.Thread.run(Thread.java:679)
Caused by: org.xmlpull.v1.XmlPullParserException: unexpected character in markup   (position: START_TAG seen ...ffsetWidth;\n                }\n                for (var n = 0; n < ... @42:37) 
    at  at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1261)
    at  at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at  at org.xmlpull.v1.sax2.Driver.parseSubTree(Driver.java:448)
    at  ... 44 common frames omitted
14:33:32,133 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@1:6 - no applicable action for [html], current pattern is [[x][html]]
14:33:32,133 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@2:11 - no applicable action for [head], current pattern is [[x][html][head]]
14:33:32,133 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@3:16 - no applicable action for [title], current pattern is [[x][html][head][title]]
14:33:32,133 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:40 - no applicable action for [script], current pattern is [[x][html][head][script]]

Tests run: 9, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 5.076 sec <<< FAILURE!
Running ch.qos.logback.core.FileAppenderResilienceTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 1.15 sec
Running ch.qos.logback.core.pattern.parser.TokenStreamTest
Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.065 sec
Running ch.qos.logback.core.encoder.ByteArrayUtilTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.193 sec
Running ch.qos.logback.core.pattern.parser.ParserTest
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 sec
Running ch.qos.logback.core.sift.ScenarioBasedAppenderTrackerTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.61 sec
Running ch.qos.logback.core.joran.action.PropertyActionTest
Tests run: 11, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0.13 sec
Running ch.qos.logback.core.joran.util.PropertySetterTest
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.174 sec
Running ch.qos.logback.core.spi.ScenarioBasedCyclicBufferTrackerTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.004 sec

Results :

Failed tests:   unknownURL(ch.qos.logback.core.joran.action.IncludeActionTest)

Tests run: 277, Failures: 1, Errors: 0, Skipped: 6

However, the build does succeed if tests are disabled with -DskipTests.

It would also be great if, once the Maven builds are working well, logback-android could be included on the Maven Central Repository. Currently, in order to build my project which has logback-android as a dependency, I have to first build logback-android with Maven to install it in my local repository. Having logback-android on Central would make Maven builds much more convenient for projects that depend on it.

Android Testing with Incomplete Classes

I have been using logback-android in the context of android tests.
I get the following error in the logcat when running the test.

W/dalvikvm(15841): Unable to resolve superclass of Lch/qos/logback/core/net/LoginAuthenticator; (987)
W/dalvikvm(15841): Link of class 'Lch/qos/logback/core/net/LoginAuthenticator;' failed
W/dalvikvm(15841): Unable to resolve superclass of Lch/qos/logback/core/net/LoginAuthenticator; (1760)
W/dalvikvm(15841): Link of class 'Lch/qos/logback/core/net/LoginAuthenticator;' failed
W/ClassPathPackageInfoSource(15841): Cannot load class. Make sure it is in your apk. Class name: 'ch.qos.logback.core.net.LoginAuthenticator'. Message: ch.qos.logback.core.net.LoginAuthenticator
W/ClassPathPackageInfoSource(15841): java.lang.ClassNotFoundException: ch.qos.logback.core.net.LoginAuthenticator
W/ClassPathPackageInfoSource(15841): at java.lang.Class.classForName(Native Method)
W/ClassPathPackageInfoSource(15841): at java.lang.Class.forName(Class.java:235)

I think that the test framework loads all the classes whether they are used or not.
In this case the super class of LoginAuthenticator, i.e. javax.mail.Authenticator, doesn't exist in android land.

Possible solutions:

Android version requirement

The documentation says API 2.1+ (version 7+) but the ant builds with API 2.3 (version 10).
What impact does this have on an application using logback-android?
My API 2.2 (version 8) application seems to work correctly.

support Android-specific variables

I think logback-android should support some Android specific variables, namely:

PACKAGE_NAME
VERSION_CODE
VERSION_NAME

I would like to use them in logback.xml for example like this:

/data/data/${PACKAGE_NAME}/files/my.log

That way, I would not need to use programmatic configuration. (I am switching package names quite often for app variants.)

Publishing Android App With Logback, SLF4J, and Ecplise Export

Hi Tony (et.al.)

Okie dokie ... so I've made the most fabulous Android application ever! ... Ha! ... But, at least it runs and I'm ready to publish it ... However ...

I'm using slf4j for android and logback-android. Works like a charm (although built in color coding of message levels would be nice ... I have a note to self to try Jeff Sharkey's colorizor ... after I get this app published).

At any rate, when I turn on ProGuard and do an Export in eclipse, I receive the following error (bunch of the same so here's one of them)

[blah blah] Proguard returned with error code 1. See console
[blah blah] Warning: ch.qos.logback.core.net.LoginAuthenticator: can't find superclass or interface javax.mail.Authenticator
[blah blah] Warning: ch.qos.logback.core.net.LoginAuthenticator: can't find referenced class javax.mail.Authenticator
... 37 similar errors follow

I am not using any of the things Proguard complains of not finding. And I believe it is a result of its optimization code stripping, etc.

I've tried the following

  • Compiled with logback library still in the project
    -- ... generates errors above
  • Removed logback and kept slf4j-api (v1.6.6 I believe)
    -- This application runs in debug but only because SLF4J reverts to a NOP if it doesn't find a logger to bind with (such as logback)
    -- exporting with proguard generates different errors (namely missing something like logback)
  • attempted to use the slf4j-nop ... same story different errors

I've googled and googled and googled. And I've been all through the slf4j documentation, slf4j-android documentation, logback documentation, and logback-android documentation.

What am I not doing that needs to be done?

Perhaps the documentation could have a "What to do when publishing your Android App"

Objective:

  • I do not need logging in the exported, signed, published application
  • Ideally, calls to SLF4J log.debug, etc, would be compiled out altogether (stripped by Proguard in this case)

Thanks for your assistance.

Support logback-test.xml like the original logback?

for the original logback, it allows the use of a logback-test.xml that define a different set of configuration for unit testing. logback-android doesn't seem to support that.

Without logback-test.xml, how you guys output the log of a class run by JUnit runner?

Unable to resolve parent when using maven central repo

The two modules on the central repository have a parent defined in their poms. However, the parent wasn't uploaded to central, so when I attempt to set the core or classic modules as dependencies the build fails as they can't find their parent anywhere. Is there any way you could also upload the parent project to maven central repository?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.