logback-android/src/main/java/ch/qos/logback/classic/android/SQLiteAppender.java
@Override
  public void start() {
    this.started = false;

    File dbfile = getDatabaseFile(this.filename);
    if (dbfile == null) {
      addError("Cannot determine database filename");
      return;
    }

    boolean dbOpened = false;
    try {
      dbfile.getParentFile().mkdirs();
      addInfo("db path: " + dbfile.getAbsolutePath());
      this.db = SQLiteDatabase.openOrCreateDatabase(dbfile.getPath(), null);
      dbOpened = true;
    } catch (SQLiteException e) {
      addError("Cannot open database", e);
    }

    if (dbOpened) {
      if (dbNameResolver == null) {
        dbNameResolver = new DefaultDBNameResolver();
      }

      insertExceptionSQL = SQLBuilder.buildInsertExceptionSQL(dbNameResolver);
      insertPropertiesSQL = SQLBuilder.buildInsertPropertiesSQL(dbNameResolver);
      insertSQL = SQLBuilder.buildInsertSQL(dbNameResolver);

      try {
        this.db.execSQL(SQLBuilder.buildCreateLoggingEventTableSQL(dbNameResolver));
        this.db.execSQL(SQLBuilder.buildCreatePropertyTableSQL(dbNameResolver));
        this.db.execSQL(SQLBuilder.buildCreateExceptionTableSQL(dbNameResolver));

        clearExpiredLogs(this.db);

        super.start();

        this.started = true;
      } catch (SQLiteException e) {
        addError("Cannot create database tables", e);
      }
    }
  }
@Override
  public void start() {
    this.started = false;

    File dbfile = getDatabaseFile(this.filename);
    if (dbfile == null) {
      addError("Cannot determine database filename");
      return;
    }

    boolean dbOpened = false;
    try {
      dbfile.getParentFile().mkdirs();
      addInfo("db path: " + dbfile.getAbsolutePath());
      this.db = SQLiteDatabase.openOrCreateDatabase(dbfile.getPath(), null);
      dbOpened = true;
    } catch (SQLiteException e) {
      addError("Cannot open database", e);
    }

    if (dbOpened) {
      if (dbNameResolver == null) {
        dbNameResolver = new DefaultDBNameResolver();
      }

      insertExceptionSQL = SQLBuilder.buildInsertExceptionSQL(dbNameResolver);
      insertPropertiesSQL = SQLBuilder.buildInsertPropertiesSQL(dbNameResolver);
      insertSQL = SQLBuilder.buildInsertSQL(dbNameResolver);

      try {
        this.db.execSQL(SQLBuilder.buildCreateLoggingEventTableSQL(dbNameResolver));
        this.db.execSQL(SQLBuilder.buildCreatePropertyTableSQL(dbNameResolver));
        this.db.execSQL(SQLBuilder.buildCreateExceptionTableSQL(dbNameResolver));

        clearExpiredLogs(this.db);

        super.start();

        this.started = true;
      } catch (SQLiteException e) {
        addError("Cannot create database tables", e);
      }
    }
  }
@ Override public void start ( ) { this . started = false ; File dbfile = getDatabaseFile ( this . filename ) ; if ( dbfile == null ) { addError ( "Cannot determine database filename" ) ; return ; } boolean dbOpened = false ; try { dbfile . getParentFile ( ) . mkdirs ( ) ; addInfo ( "db path: " + dbfile . getAbsolutePath ( ) ) ; this . db = SQLiteDatabase . openOrCreateDatabase ( dbfile . getPath ( ) , null ) ; dbOpened = true ; } catch ( SQLiteException e ) { addError ( "Cannot open database" , e ) ; } if ( dbOpened ) { if ( dbNameResolver == null ) { dbNameResolver = new DefaultDBNameResolver ( ) ; } insertExceptionSQL = SQLBuilder . buildInsertExceptionSQL ( dbNameResolver ) ; insertPropertiesSQL = SQLBuilder . buildInsertPropertiesSQL ( dbNameResolver ) ; insertSQL = SQLBuilder . buildInsertSQL ( dbNameResolver ) ; try { this . db . execSQL ( SQLBuilder . buildCreateLoggingEventTableSQL ( dbNameResolver ) ) ; this . db . execSQL ( SQLBuilder . buildCreatePropertyTableSQL ( dbNameResolver ) ) ; this . db . execSQL ( SQLBuilder . buildCreateExceptionTableSQL ( dbNameResolver ) ) ; clearExpiredLogs ( this . db ) ; super . start ( ) ; this . started = true ; } catch ( SQLiteException e ) { addError ( "Cannot create database tables" , e ) ; } } }
/*
(non-Javadoc)
@see ch.qos.logback.core.UnsynchronizedAppenderBase#start()
/ * ( non - Javadoc )