(1) For the consideration of resource utilization, Logger's construction method parameter is class, which determines that logger is based on class structure to distinguish log, so a class as long as a logger can be, so static
(2) final represents a programming habit, indicating that the logger of the class only records the information of the class, otherwise the log will not be able to provide a convincing record
By the way, stick to one of your own log4j.properties:
Log4j.rootlogger=info,console
Log4j.appender.console=org.apache.log4j.consoleappender
Log4j.appender.console.target=system.out
log4j.appender.console.layout=org.apache.log4j.patternlayout
LOG4J.APPENDER.CONSOLE.LAYOUT.CONVERSIONPATTERN=[%P][%D{YYYY-MM-DD Hh\:mm\:ss,sss}][%c{1}:%l]%m%n
Log4j.appender.onefile=org.apache.log4j.rollingfileappender
log4j.appender.onefile.file=. /test.log
log4j.appender.onefile.maxfilesize=10mb
log4j.appender.onefile.threshold=all
Log4j.appender.onefile.layout=org.apache.log4j.patternlayout
LOG4J.APPENDER.ONEFILE.LAYOUT.CONVERSIONPATTERN=[%P][%D{YYYY-MM-DD hh\:mm\:ss,sss}] [%c{1}:%L]%m%n