Last active
August 29, 2015 23:35
-
-
Save thaniaclair/60031 to your computer and use it in GitHub Desktop.
Log4j, Teste
This file contains 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
import org.apache.log4j.Logger; | |
import org.apache.log4j.Level; | |
import org.apache.log4j.BasicConfigurator; | |
public class LoggingTest { | |
static Logger logger = Logger.getLogger(LoggingTest.class); | |
public static void main(String[] args) { | |
BasicConfigurator.configure(); | |
logger.setLevel(Level.INFO); | |
logger.debug("Isso nao vai aparecer..."); | |
logger.info("Inicializando..."); | |
try { | |
throw new Exception("Loga esse, Log4J!?"); | |
} catch (Exception e) { | |
logger.error("Oops, deu erro: " + e.getMessage()); | |
} | |
logger.info("Finalizando..."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment