use of org.nutz.log.impl.Log4jLogAdapter in project nutz by nutzam.
the class Logs method init.
/**
* 初始化NutLog,检查全部Log的可用性,选择可用的Log适配器
* <p/>
* <b>加载本类时,该方法已经在静态构造函数中调用,用户无需主动调用.</b>
* <p/>
* <b>除非迫不得已,请不要调用本方法<b/>
* <p/>
*/
public static void init() {
try {
String packageName = Logs.class.getPackage().getName() + ".impl.";
adapter = new SimplePluginManager<LogAdapter>(packageName + "CustomLogAdapter", packageName + "Slf4jLogAdapter", packageName + "Log4jLogAdapter", packageName + "SystemLogAdapter").get();
} catch (Throwable e) {
try {
Log4jLogAdapter tmp = new Log4jLogAdapter();
if (tmp.canWork())
adapter = tmp;
else
adapter = new SystemLogAdapter();
} catch (Throwable _e) {
adapter = new SystemLogAdapter();
}
}
}
Aggregations