📅  最后修改于: 2020-11-11 05:11:20             🧑  作者: Mango
在本章中,我们将讨论本教程后续各章中将使用的类和方法。
org.slf4j包的记录器接口是SLF4J API的入口点。下面列出了此接口的重要方法。
Sr.No. | Methods and Description |
---|---|
1 |
void debug(String msg) This method logs a message at the DEBUG level. |
2 |
void error(String msg) This method logs a message at the ERROR level. |
3 |
void info(String msg) This method logs a message at the INFO level. |
4 |
void trace(String msg) This method logs a message at the TRACE level. |
5 |
void warn(String msg) This method logs a message at the WARN level. |
org.slf4j软件包的LoggerFactory类是一个实用程序类,用于为各种日志记录API(例如log4j,JUL,NOP和简单记录器)生成记录器。
Sr.No. | Method and Description |
---|---|
1 |
Logger getLogger(String name) This method accepts a string value representing a name and returns a Logger object with the specified name. |
此类属于包org.slf4j ,它用于配置文件目的,被称为穷人分析器。使用此功能,程序员可以找出执行长时间任务所需的时间。
以下是此类的重要方法。
Sr.No. | Methods and Description |
---|---|
1 |
void start(String name) This method will start a new child stop watch (named) and, stops the earlier child stopwatches (or, time instruments). |
2 |
TimeInstrument stop() This method will stop the recent child stopwatch and the global stopwatch and return the current Time Instrument. |
3 |
void setLogger(Logger logger) This method accepts a Logger object and associates the specified logger to the current Profiler. |
4 |
void log() Logs the contents of the current time instrument that is associated with a logger. |
5 |
void print() Prints the contents of the current time instrument. |