de.mindpipe.android.logging.log4j.LogConfigurator Java Examples

The following examples show how to use de.mindpipe.android.logging.log4j.LogConfigurator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyApplication.java    From OpenWeatherPlus-Android with Apache License 2.0 6 votes vote down vote up
public void configLog() {
    try {
        final LogConfigurator logConfigurator = new LogConfigurator();

        logConfigurator.setFileName(Environment.getExternalStorageDirectory() + File.separator + "crifanli_log4j.log");
        // Set the root log level
        logConfigurator.setRootLevel(Level.DEBUG);
        // Set log level of a specific logger
        logConfigurator.setLevel("org.apache", Level.ERROR);
        logConfigurator.configure();
        CrashHandler catchHandler = CrashHandler.getInstance();
        catchHandler.init(getApplicationContext());
    } catch (Exception e) {
        String TAG = "sky";
        Log.i(TAG, "configLog: " + e);
    }

    //gLogger = Logger.getLogger(this.getClass());
    log = Logger.getLogger("CrifanLiLog4jTest");
}
 
Example #2
Source File: SdsBasicDemo.java    From galaxy-sdk-java with Apache License 2.0 5 votes vote down vote up
public static void configure() {
  final LogConfigurator logConfigurator = new LogConfigurator();
  logConfigurator
      .setFileName(Environment.getExternalStorageDirectory() + File.separator + "SdsBasicDemo.log");
  logConfigurator.setRootLevel(Level.INFO);
  logConfigurator.configure();
}
 
Example #3
Source File: ConfigureLog4j.java    From android-opensource-library-56 with Apache License 2.0 5 votes vote down vote up
public static void configure(Context context) {
    final LogConfigurator logConfigurator = new LogConfigurator();
    logConfigurator
            .setLogCatPattern("%d{yyyy-MM-dd HH:mm:ss.SSS} %p:%r:%c:%m%n");
    logConfigurator.setRootLevel(Level.DEBUG);

    // logConfigurator.setUseFileAppender(false);
    // logConfigurator.setUseLogCatAppender(false);
    File logFileDir = context.getExternalFilesDir(null);
    String logFilePath = new File(logFileDir, "myapp.log")
            .getAbsolutePath();
    logConfigurator.setFileName(logFilePath);

    logConfigurator.configure();
}