Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Labels
Milestone

Comments

@yaronyg
Copy link
Member

@yaronyg 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 added the 1 - Backlog label Nov 18, 2015
@yaronyg yaronyg assigned tompaana and unassigned DrJukka Dec 1, 2015
@yaronyg yaronyg added this to the New Infra milestone Jan 11, 2016
@yaronyg yaronyg added 2 - Ready and removed 1 - Backlog labels Mar 14, 2016
@tompaana
Copy link
Member

@tompaana 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 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());
}
@tompaana tompaana added 3 - Working and removed 2 - Ready labels Mar 16, 2016
@yaronyg yaronyg added 2 - Ready and removed 3 - Working labels Mar 17, 2016
@yaronyg yaronyg removed this from the New Infra milestone Apr 6, 2016
@yaronyg yaronyg added 0 - Icebox and removed 2 - Ready labels Apr 6, 2016
@yaronyg yaronyg added this to the V1 milestone Aug 3, 2016
@yaronyg yaronyg added 1 - Backlog and removed 0 - Icebox labels Aug 4, 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 join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.