What the difference in LoggerFactory.getLogger "root" vs "class" name?

Viewed 1463

I'm trying to find the answer about the differences between:

class MyClass {
    private static Logger logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
}

and:

class MyClass {
    private static Logger logger = LoggerFactory.getLogger(MyClass.class);
}

Is it only useful with you are planning to do a fine logging setup? Like separate the log of the class in a different file, print more/less informations for each one, etc.

I have this doubt because most of my classes I use LoggerFactory.getLogger(MyClass.class) but I think the LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME) is enough in the most of the cases.

Thanks!

1 Answers
Related