Last active
October 11, 2019 11:25
-
-
Save alex-ber/fd29de51599f8098ad0184d668130a7c to your computer and use it in GitHub Desktop.
Scary log definiton and usage
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
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
public class SomeClass { | |
private static final Logger log = LoggerFactory.getLogger(new Object() { | |
}.getClass().getEnclosingClass()); | |
public void foo(){ | |
class Local {}; | |
String name = Local.class.getEnclosingMethod().getName(); | |
log.debug("name"+"()") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment