Created
January 2, 2020 07:06
-
-
Save BooookStore/f77eac18f47bfbe0e76fa983cc507587 to your computer and use it in GitHub Desktop.
SLF4J output pattern
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
package com.example.slf4j; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
public class GettingStartedSLF4J { | |
public static void main(String[] args) { | |
Logger logger = LoggerFactory.getLogger(GettingStartedSLF4J.class); | |
// [main] INFO com.example.slf4j.GettingStartedSLF4J - Hello, SLF4J! | |
logger.info("Hello, SLF4J!"); | |
// [main] INFO com.example.slf4j.GettingStartedSLF4J - Hello, SLF4J with exception | |
// java.lang.Exception: failed message | |
// at com.example.slf4j.GettingStartedSLF4J.main(GettingStartedSLF4J.java:12) | |
logger.info("Hello, SLF4J with exception", new Exception("failed message")); | |
// [main] INFO com.example.slf4j.GettingStartedSLF4J - Hello, SLF4J with argument Arg1, Arg2 | |
logger.info("Hello, SLF4J with argument {}, {}", "Arg1", "Arg2"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment