• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Logger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中scouter.server.Logger的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Logger类属于scouter.server包,在下文中一共展示了Logger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: xlog

import scouter.server.Logger; //导入依赖的package包/类
/**
   * XLogPack 발생 시 처리
   * @param pack
   */
  @ServerPlugin(PluginConstants.PLUGIN_SERVER_XLOG)
  public void xlog(XLogPack pack) {
  	try {
   	if (serviceStatMap.get(pack.objHash) == null) {
   		serviceStatMap.put(pack.objHash, new ConcurrentHashMap<Integer, ServiceStat>());
   	}
   	
   	if (serviceStatMap.get(pack.objHash).get(pack.service) == null) {
   		serviceStatMap.get(pack.objHash).put(pack.service, new ServiceStat(pack.objHash, pack.service));
   	}

   	String serviceName = TextRD.getString(DateUtil.yyyymmdd(pack.endTime), TextTypes.SERVICE, pack.service);
  		InetAddress inetAddr = InetAddress.getByAddress(pack.ipaddr);
  		serviceStatMap.get(pack.objHash).get(pack.service).add(serviceName, pack.elapsed, pack.error != 0, inetAddr == null ? null : inetAddr.getHostAddress(), pack.userAgent, pack.sqlCount, pack.sqlTime);
} catch (Exception e) {
	Logger.printStackTrace(e);
}
  }
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:23,代码来源:ReportingPlugin.java


示例2: xlog

import scouter.server.Logger; //导入依赖的package包/类
@ServerPlugin(PluginConstants.PLUGIN_SERVER_XLOG)
  public void xlog(XLogPack pack) {
  	try {
  		int elapsedThreshold = conf.getInt("ext_plugin_elapsed_time_threshold", 0);
  		
  		if (elapsedThreshold != 0 && pack.elapsed > elapsedThreshold) {
  			String serviceName = TextRD.getString(DateUtil.yyyymmdd(pack.endTime), TextTypes.SERVICE, pack.service);
  			
  			AlertPack ap = new AlertPack();
  			
        ap.level = AlertLevel.WARN;
        ap.objHash = pack.objHash;
        ap.title = "Elapsed time exceed a threshold.";
        ap.message = "[" + AgentManager.getAgentName(pack.objHash) + "] " 
        				+ pack.service + "(" + serviceName + ") "
        				+ "elapsed time(" + pack.elapsed + " ms) exceed a threshold.";
        ap.time = System.currentTimeMillis();
        ap.objType = AgentManager.getAgent(pack.objHash).objType;
		
        alert(ap);
  		}
  		
} catch (Exception e) {
	Logger.printStackTrace(e);
}
  }
 
开发者ID:scouter-project,项目名称:scouter-plugin-server-alert-email,代码行数:27,代码来源:EmailPlugin.java


示例3: openDatagramSocket

import scouter.server.Logger; //导入依赖的package包/类
private void openDatagramSocket() {
    try {
        if (datagram != null) {
            close(datagram);
        }
        if (localUdpAddr != null) {
            datagram = new DatagramSocket(localUdpPort, InetAddress.getByName(localUdpAddr));
            Logger.println("InfluxDB Agent UDP local.addr=" + localUdpAddr + " local.port=" + localUdpPort);
        } else {
            datagram = new DatagramSocket(localUdpPort);
            Logger.println("InfluxDB Agent UDP local.port=" + localUdpPort);
        }

    } catch (Exception e) {
        if (conf._trace) {
            Logger.printStackTrace(e);
        } else {
            Logger.println(e.getMessage());
        }
    }
}
 
开发者ID:scouter-project,项目名称:scouter-plugin-server-influxdb,代码行数:22,代码来源:UdpAgent.java


示例4: deleteData

import scouter.server.Logger; //导入依赖的package包/类
private void deleteData(String yyyymmdd, Mode mode) {
	try {
		File f = null;
		if (mode == Mode.ALL) {
			f = new File(dbDir, yyyymmdd);
			deleteFiles(f);
		} else if(mode == Mode.XLOG) {
			f = new File(dbDir, yyyymmdd + XLogWR.dir());
			deleteFiles(f);
		} else if (mode == Mode.PROFILE) {
			f = new File(dbDir, yyyymmdd + XLogWR.dir() + "/xlog.profile");
			deleteFiles(f);
			f = new File(dbDir, yyyymmdd + XLogWR.dir() + "/xlog_profile.hfile");
			deleteFiles(f);
			f = new File(dbDir, yyyymmdd + XLogWR.dir() + "/xlog_profile.kfile");
			deleteFiles(f);
		} else {
			throw new IllegalArgumentException("Not expected Mode : " + mode);
		}

		Logger.println("S206", "Auto deletion... " + yyyymmdd);
	} catch (Throwable th) {
		Logger.println("S207", "Failed auto deletion... " + yyyymmdd + "  " + th.toString());
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:26,代码来源:AutoDeleteTest.java


示例5: remoteControl

import scouter.server.Logger; //导入依赖的package包/类
@ServiceHandler(RequestCmd.REMOTE_CONTROL)
public void remoteControl(DataInputX din, DataOutputX dout, boolean login) throws IOException {
	MapPack param = (MapPack) din.readPack();
	long session = param.getLong("toSession");
	RemoteControl control = new RemoteControl(//
			param.getText("command"), //
			System.currentTimeMillis(), //
			param, param.getLong("fromSession"));
	boolean result = RemoteControlManager.add(session, control);
	Logger.println("[" + RequestCmd.REMOTE_CONTROL + "]" + control.commnad() + " from "
			+ LoginManager.getUser(control.commander()).ip() + " to " + LoginManager.getUser(session).ip() + " "
			+ result);
	MapPack m = new MapPack();
	if (result) {
		m.put("success", new BooleanValue(true));
		dout.writeByte(TcpFlag.HasNEXT);
		dout.writePack(m);
	} else {
		m.put("success", new BooleanValue(false));
		dout.writeByte(TcpFlag.HasNEXT);
		dout.writePack(m);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:24,代码来源:ManageService.java


示例6: deleteData

import scouter.server.Logger; //导入依赖的package包/类
private void deleteData(String yyyymmdd, Mode mode) {
	try {
		File f = null;
		if (mode == Mode.ALL) {
			f = new File(dbDir, yyyymmdd);
			deleteFiles(f);
		} else if(mode == Mode.XLOG) {
			f = new File(dbDir, yyyymmdd + XLogWR.dir());
			deleteFiles(f);
		} else if (mode == Mode.PROFILE) {
			f = new File(dbDir, yyyymmdd + XLogWR.dir() + "/xlog.profile");
			deleteFiles(f);
			f = new File(dbDir, yyyymmdd + XLogWR.dir() + "/xlog_profile.hfile");
			deleteFiles(f);
			f = new File(dbDir, yyyymmdd + XLogWR.dir() + "/xlog_profile.kfile");
			deleteFiles(f);
		} else {
			throw new IllegalArgumentException("Not expected Mode : " + mode);
		}

		Logger.println("S206", "* Auto deletion... " + yyyymmdd + " mode : " + mode.name());

	} catch (Throwable th) {
		Logger.println("S207", "Failed auto deletion... " + yyyymmdd + " mode : " + mode.name() + "  " + th.toString());
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:27,代码来源:AutoDeleteScheduler.java


示例7: logTo

import scouter.server.Logger; //导入依赖的package包/类
public void logTo(String file, String msg) {
	PrintWriter pw = null;
	try {
		pw = new PrintWriter(new FileWriter(file, true));
		pw.write(msg);
	} catch (Exception e) {
		Logger.println("S214", e.toString());
	} finally {
		FileUtil.close(pw);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:IPlugIn.java


示例8: process

import scouter.server.Logger; //导入依赖的package包/类
public void process(Pack pack) {
    try {
        method.invoke(object, pack);
    } catch (Throwable t) {
        Logger.println("G003", "[Plugin invoke fail]" + object.getClass() + " " + method + " " + t);
        if(Configure.getInstance()._trace) {
            t.printStackTrace();
        }
    }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:11,代码来源:PluginInvocation.java


示例9: loadPlugins

import scouter.server.Logger; //导入依赖的package包/类
public static void loadPlugins() {
    Set<String> classNames = new Scanner("scouter.plugin.server").process();

    Iterator<String> itr = classNames.iterator();

    while (itr.hasNext()) {
        try {
            Class c = Class.forName(itr.next());
            if (!Modifier.isPublic(c.getModifiers()))
                continue;

            Method[] m = c.getDeclaredMethods();
            for (int i = 0; i < m.length; i++) {
                ServerPlugin annotation = m[i].getAnnotation(ServerPlugin.class);
                if (annotation == null)
                    continue;

                String pluginPoint = annotation.value();
                List<PluginInvocation> pluginList = pluginMap.get(pluginPoint);

                if(pluginList == null) {
                    pluginList = new ArrayList<PluginInvocation>();
                    pluginMap.put(pluginPoint, pluginList);
                }

                Logger.println("[BuiltInPlugin]" + c.getName() + "=>" + m[i].getName());
                pluginList.add(new PluginInvocation(c.newInstance(), m[i]));
            }
        } catch (Throwable t) {
            Logger.println("Server Plugin Load Error");
            if(Configure.getInstance()._trace) {
                t.printStackTrace();
            }
        }
    }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:37,代码来源:BuiltInPluginManager.java


示例10: xlog

import scouter.server.Logger; //导入依赖的package包/类
public static void xlog(XLogPack m) {
       BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_XLOG, m);

	if (xlog != null) {
		try {
			xlog.process(m);
		} catch (Throwable t) {
			Logger.printStackTrace("PL001", t);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:PlugInManager.java


示例11: xlogdb

import scouter.server.Logger; //导入依赖的package包/类
public static void xlogdb(XLogPack m) {
	if (xlogdb != null) {
		try {
			xlogdb.process(m);
		} catch (Throwable t) {
			Logger.printStackTrace("PL002", t);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:PlugInManager.java


示例12: profile

import scouter.server.Logger; //导入依赖的package包/类
public static void profile(XLogProfilePack m) {
       BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_PROFILE, m);

	if (xlogProfiles != null) {
		try {
			xlogProfiles.process(m);
		} catch (Throwable t) {
			Logger.printStackTrace("PL003", t);
		}
	}

}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:13,代码来源:PlugInManager.java


示例13: active

import scouter.server.Logger; //导入依赖的package包/类
public static void active(ObjectPack p) {
       BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_OBJECT, p);

	if (objects != null) {
		try {
			objects.process(p);
		} catch (Throwable t) {
			Logger.printStackTrace("PL004", t);
		}
	}

}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:13,代码来源:PlugInManager.java


示例14: alert

import scouter.server.Logger; //导入依赖的package包/类
public static void alert(AlertPack p) {
       BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_ALERT, p);

	if (alerts != null) {
		try {
			alerts.process(p);
		} catch (Throwable t) {
			Logger.printStackTrace("PL005", t);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:PlugInManager.java


示例15: counter

import scouter.server.Logger; //导入依赖的package包/类
public static void counter(PerfCounterPack p) {
	BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_COUNTER, p);

	if (counters != null) {
		try {
			counters.process(p);
		} catch (Throwable t) {
			Logger.printStackTrace("PL006", t);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:PlugInManager.java


示例16: summary

import scouter.server.Logger; //导入依赖的package包/类
public static void summary(SummaryPack p) {
       BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_SUMMARY, p);

	if (summary != null) {
		try {
			summary.process(p);
		} catch (Throwable t) {
			Logger.printStackTrace("PL007", t);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:PlugInManager.java


示例17: text

import scouter.server.Logger; //导入依赖的package包/类
public static void text(TextPack p) {
	BuiltInPluginManager.invokeAllPlugins(PluginConstants.PLUGIN_SERVER_TEXT, p);

	if (text != null) {
		try {
			text.process(p);
		} catch (Throwable t) {
			Logger.printStackTrace("PL008", t);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:PlugInManager.java


示例18: write

import scouter.server.Logger; //导入依赖的package包/类
static public void write(long time, String objName, String filename, long fileSize, InputStream in) throws IOException{
String path  = getDBPath(time, objName);
      if (Configure.getInstance().log_udp_batch) {
          Logger.println(new StringBuilder(100).append("Batch stack path: ").append(path).toString());
      }		
      File f = new File(path);
      if (!f.exists()) {
          f.mkdirs();
      }		
      if (!f.exists()) {
      	throw new IOException("can't create path:" + path);
      }

      BufferedOutputStream out = null;
      try {
      	out = new BufferedOutputStream(new FileOutputStream(new File(new StringBuilder(100).append(path).append('/').append(filename).append(".zip").toString())));
      	int totalSize = 0;
      	int readSize;
      	byte [] buffer = new byte[1024];
      	while((readSize = in.read(buffer)) != -1){
      		out.write(buffer, 0, readSize);
      		totalSize += readSize;
      		if(totalSize == fileSize){
      			break;
      		}
      	}
      }finally{
      	if(out != null){
      		try{out.close(); }catch(Exception ex){}
      	}
      }
  }
 
开发者ID:scouter-project,项目名称:scouter,代码行数:33,代码来源:BatchZipDB.java


示例19: saveBlockBytes

import scouter.server.Logger; //导入依赖的package包/类
protected static void saveBlockBytes(final File file, final byte[] block) {
	exec.execute(new Runnable() {
		public void run() {
			try {
				byte[] out = CompressUtil.doZip(block);
				FileUtil.save(file, out);
			} catch (Exception e) {
				Logger.println("S209", e.getMessage());
			}
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:13,代码来源:IOChannel.java


示例20: write

import scouter.server.Logger; //导入依赖的package包/类
public synchronized long write(String date, byte[] data, long next) throws IOException {
	DataOutputX dout = new DataOutputX();
	dout.writeLong5(next);
	dout.writeInt3(data.length);
	dout.write(data);
	byte[] saveData = dout.toByteArray();
	Block bk = (Block) writingBlockTable.get(date);
	if (bk == null) {
		bk = IOChannel.getInstance().getLastWriteBlock(date);
		if (bk != null) {
			while (writingBlockTable.size() >= conf._compress_write_buffer_block_count) {
				Block bb = writingBlockTable.removeFirst();
				IOChannel.getInstance().store(bb);
			}
			writingBlockTable.put(date, bk);
		} else {
			Logger.println("ERROR -1 : write main data");
			return -1;
		}
	}
	bk.lastAccessTime = System.currentTimeMillis();
	try {
		long pos = bk.getOffset();
		boolean ok = bk.write(saveData);
		if (ok) {
			return pos;
		}
		IOChannel.getInstance().store(bk);
		bk = bk.createNextBlock();
		writingBlockTable.put(date, bk);
		pos = bk.getOffset();
		ok = bk.write(saveData);
		return ok ? pos : -1;
	} catch (Throwable ee) {
		Logger.println("S201", 5, ee.toString() + " => " + bk, ee);
		return -1;
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:39,代码来源:GZipStore.java



注:本文中的scouter.server.Logger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Authentication类代码示例发布时间:2022-05-23
下一篇:
Java ComponentNameFunction类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap