logback-android


Source link: https://github.com/tony19/logback-android

logback-android

v1.1.1-6

Overview

logback-android brings the power of logback to Android. This library provides a highly configurable logging framework for Android apps, supporting multiple log destinations simultaneously:

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

Runs on Android 2.1 or higher. See Wiki for documentation.

Quick Start

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

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

    // only needed for SNAPSHOT builds repositories {
    
    maven {
     url 'https://oss.sonatype.org/content/repositories/snapshots' 
    }
     
    }
      dependencies {
    
    compile 'org.slf4j:slf4j-api:1.7.21'
    compile 'com.github.tony19:logback-android-core:1.1.1-6'
    compile('com.github.tony19:logback-android-classic:1.1.1-6') {
    
      // workaround issue #73
      exclude group: 'com.google.android', module: 'android'
    
    }
     
    }
    
  3. Create app/src/main/assets/logback.xml containing:

    <configuration>
    <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

// only needed for SNAPSHOT builds repositories {

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

compile 'org.slf4j:slf4j-api:1.7.21'
compile 'com.github.tony19:logback-android-core:1.1.1-6'
compile 'com.github.tony19:logback-android-classic:1.1.1-6' 
}

Prefer local jars?

Build

logback-android is built with Gradle 2.12. Use these commands to create the uber jar (with debug symbols).

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

The jar would be in: ./build/logback-android-1.1.1-6.jar

Resources

ActivityAnimation helper and Picture preview helper like transition on Lollipop.

ViewPager with an interesting effect.

A TODO list application with Material Design.

Features:

  • Add to-do to list with image or audio
  • Remind user in time
  • IM

Android library scanning BLE (Bluetooth Low Energy) beacons nearby with RxJava.

Like FragmentManager but for Views.

Slide down menu for Android from (old) Circle app.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes