Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.

Need to agree on logging solution for Android #48

Open
yaronyg opened this issue Jul 24, 2015 · 2 comments
Open

Need to agree on logging solution for Android #48

yaronyg opened this issue Jul 24, 2015 · 2 comments
Assignees
Milestone

Comments

@yaronyg
Copy link
Member

yaronyg commented Jul 24, 2015

We need to be able to configure our logging on Android using a framework like log4j or the built in Android logging. We specifically need support for:

  • Setting different levels of logging
  • Being able to set different levels of logging for different components
  • Being able to log to rotating local files where we can delete old files
  • Being able to log to a remote server for when we run tests in the testing lab
@yaronyg yaronyg assigned tompaana and unassigned DrJukka Dec 1, 2015
@yaronyg yaronyg added this to the New Infra milestone Jan 11, 2016
@tompaana
Copy link
Member

tompaana commented Mar 16, 2016

jodamoblog, licensed under MIT, provides FileLogger that can be used for writing rotating log files. In addition, you can combine the logging, for instance: Log.initLogger(new FileLogger(context, new LogCatLogger())) writes to files + console.

@tompaana
Copy link
Member

tompaana commented Mar 16, 2016

If we want to enable the file logging only in debug builds, we can use Gradle build script to set a Java constant:

android {
    buildTypes {
        debug {
            buildConfigField "boolean", "ENABLE_FILE_LOGGER", "true"
        }
        release {
            buildConfigField "boolean", "ENABLE_FILE_LOGGER", "false"
        }
    }
}

Then in Java code:

if (BuildConfig.ENABLE_FILE_LOGGER) {
    Log.initLogger(new FileLogger(context, new LogCatLogger()));
} else {
    Log.initLogger(new LogCatLogger());
}

@yaronyg yaronyg removed this from the New Infra milestone Apr 6, 2016
@yaronyg yaronyg added this to the V1 milestone Aug 3, 2016
@yaronyg yaronyg added the Android label Sep 1, 2016
@yaronyg yaronyg added bug and removed 1 - Backlog labels Oct 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants