Skip to content

Instantly share code, notes, and snippets.

@RicardoMurad
Last active December 27, 2022 14:36
Show Gist options
  • Select an option

  • Save RicardoMurad/8571104 to your computer and use it in GitHub Desktop.

Select an option

Save RicardoMurad/8571104 to your computer and use it in GitHub Desktop.
package br.com.appproblmatica;
import java.io.File;
import org.apache.log4j.Level;
import android.os.Environment;
import de.mindpipe.android.logging.log4j.LogConfigurator;
/**
* Call {@link #configure()} from your application's activity.
*/
public class ConfigureLog4J
{
private static int maxBackupSize = 2000;
public static void configure()
{
final LogConfigurator logConfigurator = new LogConfigurator();
logConfigurator.setMaxBackupSize( maxBackupSize );
logConfigurator.setFileName( Environment.getExternalStorageDirectory() + File.separator
+ "nome-do-arquivo-de-log.log" );
logConfigurator.setRootLevel( Level.DEBUG );
// Set log level of a specific logger
logConfigurator.setLevel( "org.apache", Level.ERROR );
logConfigurator.configure();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment