本文整理汇总了Java中com.alibaba.dubbo.common.logger.LoggerFactory.getLevel方法的典型用法代码示例。如果您正苦于以下问题:Java LoggerFactory.getLevel方法的具体用法?Java LoggerFactory.getLevel怎么用?Java LoggerFactory.getLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.common.logger.LoggerFactory
的用法示例。
在下文中一共展示了LoggerFactory.getLevel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: change
import com.alibaba.dubbo.common.logger.LoggerFactory; //导入方法依赖的package包/类
public boolean change(Map<String, Object> context) throws Exception {
String contextLevel = (String)context.get("level");
if (contextLevel == null || contextLevel.length() == 0) {
context.put("message", getMessage("MissRequestParameters", "level"));
return false;
}
if (! User.ROOT.equals(role)) {
context.put("message", getMessage("HaveNoRootPrivilege"));
return false;
}
Level level = Level.valueOf(contextLevel);
if (level != LoggerFactory.getLevel()) {
LoggerFactory.setLevel(level);
}
context.put("redirect", "/sysinfo/logs");
return true;
}
示例2: change
import com.alibaba.dubbo.common.logger.LoggerFactory; //导入方法依赖的package包/类
public boolean change(Map<String, Object> context) throws Exception {
String contextLevel = (String) context.get("level");
if (contextLevel == null || contextLevel.length() == 0) {
context.put("message", getMessage("MissRequestParameters", "level"));
return false;
}
if (!User.ROOT.equals(role)) {
context.put("message", getMessage("HaveNoRootPrivilege"));
return false;
}
Level level = Level.valueOf(contextLevel);
if (level != LoggerFactory.getLevel()) {
LoggerFactory.setLevel(level);
}
context.put("redirect", "/sysinfo/logs");
return true;
}
示例3: index
import com.alibaba.dubbo.common.logger.LoggerFactory; //导入方法依赖的package包/类
public void index(Map<String, Object> context) throws Exception {
long size;
String content;
String modified;
File file = LoggerFactory.getFile();
if (file != null && file.exists()) {
FileInputStream fis = new FileInputStream(file);
FileChannel channel = fis.getChannel();
size = channel.size();
ByteBuffer bb;
if (size <= SHOW_LOG_LENGTH) {
bb = ByteBuffer.allocate((int) size);
channel.read(bb, 0);
} else {
int pos = (int) (size - SHOW_LOG_LENGTH);
bb = ByteBuffer.allocate(SHOW_LOG_LENGTH);
channel.read(bb, pos);
}
bb.flip();
content = new String(bb.array()).replace("<", "<").replace(">", ">");
modified = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(file.lastModified()));
} else {
size = 0;
content = "";
modified = "Not exist";
}
Level level = LoggerFactory.getLevel();
context.put("name", file == null ? "" : file.getAbsoluteFile());
context.put("size", String.valueOf(size));
context.put("level", level == null ? "" : level);
context.put("modified", modified);
context.put("content", content);
}