Last active
December 27, 2022 14:36
-
-
Save RicardoMurad/8571104 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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