General log interface

xiaoxiao2021-04-08  294

Common-logging

Common-logging application programming interface is mainly in org.apache.commons.logging.log interface

Definition, this interface mainly defines two types of operations:

A class is a level judgment that reduces the parameters calculation of unnecessary log operations to improve performance, function name

And parameters are as follows:

Log.IndebugeNabled ();

Log.IstraceNabled ();

The following code can explain well:

IF (log.Indebugeload ()) {

... some high cost operation ...

Log.debug (theresult);

}

If the level of log facilities are defined above Debug, these high cost operations can avoid running.

Another category is log registration, follow the level registration log information, the function name, and parameters as follows:

Log.debug (Object Message);

Log.debug (Object Message, Throwable T);

Log.Trace (Object Message);

Log.Trace (Object Message, Throwable T);

Log registration operation is also two small classes: a parameter log information registration operation and two parameters log information

Interest registration operation. The former applies to three types of users, the latter used to print the error stack information of the log registration office,

So more applicable to developers and maintenance

转载请注明原文地址:https://www.9cbs.com/read-132712.html

New Post(0)