亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? syslog.java

?? 與 unix 上相似的 syslog 沒有log4j 複雜 用戶端 syslog
?? JAVA
字號:
package com.ice.syslog;import java.io.*;import java.net.*;import java.util.Calendar;import java.util.Date;import java.util.Locale;import java.util.TimeZone;import java.text.SimpleDateFormat;/** * The Syslog class implements the UNIX syslog protocol allowing Java * to log messages to a specified UNIX host. Care has been taken to * preserve as much of the UNIX implementation as possible. * <br> * To use Syslog, simply create an instance, and use the Syslog() method * to log your message. The class provides all the expected syslog constants. * For example, LOG_ERR is Syslog.LOG_ERR. * <br> * Version: 1.2 - July 27, 1998<br> * Version: 1.0 - August 14, 1996<br> * HomePage: <a href="http://www.ice.com/java/syslog/index.shtml">Syslog.java</a> * * @author <a href="http://www.ice.com/~time/">Tim Endres</a><br> * @see DatagramSocket * @see	InetAddress */public class Syslog extends Object	{	// CLASS CONSTANTS	// CLASS VARIABLES		static private Syslog	logger = null;		// INSTANCE VARIABLES		private String			logName;	private String			hostName;	private int				portNum;	private int				flags;	private boolean			includeDate;	private InetAddress		boundAddress;	private DatagramSocket	socket;	private SimpleDateFormat	date1Format;	private SimpleDateFormat	date2Format;	// CLASS METHODS		/**	 * Binds the Syslog class to a specified host for further logging.	 * See the Syslog constructor for details on the parameters.	 */	static public void	open( String hostname, String name, int flags )		throws SyslogException		{		try {			Syslog.logger =				new Syslog					( hostname, SyslogDefs.DEFAULT_PORT, name, flags );			// Why do we provide this flag?			// Because catching exceptions from 'log()' would be			// too onerous for the programmer. By using this flag			// the programmer can catch any possible exceptions that			// might come up during logging, except for the syslog			// server going away during execution.			if ( (flags & SyslogDefs.LOG_START) != 0 )				{				Syslog.logger.syslog					( SyslogDefs.LOG_SYSLOG, SyslogDefs.LOG_INFO,						"syslog opened" );				}			}		catch ( SyslogException ex )			{			throw ex;			}		}		/**	 * Performs a syslog to the currently bound syslog host.	 */	static public void	log( int fac, int lvl, String msg )		{		try {			Syslog.logger.syslog( fac, lvl, msg );			}		catch ( SyslogException ex )			{			if ( (Syslog.logger.flags & SyslogDefs.LOG_PERROR) != 0 )				ex.printStackTrace( System.err );			}		}		/**	 * Unbinds the current syslog host.	 */	static public void	close()		{		logger = null;		}		/**	 * Creates a Syslog object instance, targeted for the UNIX host	 * with the hostname 'hostname' on the syslog port 'port'.	 * The only flags recognized are 'LOG_PERROR', which will log the	 * message to Java's 'System.err'.	 */	public	Syslog( String name, int flags )		throws SyslogException		{		super();				this.logName = name;		this.hostName = null;		this.portNum = SyslogDefs.DEFAULT_PORT;		this.flags = flags;		this.initialize();		}			/**	 * Creates a Syslog object instance, targeted for the UNIX host	 * with the hostname 'hostname' on the syslog port 'port'.	 * The only flags recognized are 'LOG_PERROR', which will log the	 * message to Java's 'System.err'.	 */	public	Syslog( String hostname, int port, String name, int flags )		throws SyslogException		{		super();				this.logName = name;		this.hostName = hostname;		this.portNum = port;		this.flags = flags;		try {			this.boundAddress = InetAddress.getByName( hostname );			}		catch ( UnknownHostException ex )			{			String message =				"error locating host named '" + hostname					+ "': " + ex.getMessage();						throw new SyslogException( message );			}		this.initialize();		}		private void	initialize()		throws SyslogException		{		try {			this.socket = new DatagramSocket();			}		catch ( SocketException ex )			{			String message =				"error creating syslog udp socket: "					+ ex.getMessage();			throw new SyslogException( message );			}		// This determines if the timestamp is added to the message		// in this, the client, or if it is left off for the server		// to fill in. Adding it in the client is the "standard" way,		// but most servers support the "old style" (no timestamp)		// messages as well. I leave this choice, since some servers		// may not work without it, and because some JDK's may not		// support SimpleDateFormat or TimeZone correctly.		this.includeDate = true;		if ( this.includeDate )			{			// We need two separate formatters here, since there is			// no way to get the single digit date (day of month) to			// pad with a space instead of a zero.			this.date1Format =				new SimpleDateFormat					( "MMM  d HH:mm:ss ", Locale.US );			this.date2Format =				new SimpleDateFormat					( "MMM dd HH:mm:ss ", Locale.US );			this.date1Format.setTimeZone				( TimeZone.getDefault() );			this.date2Format.setTimeZone				( TimeZone.getDefault() );			}		}	/**	 * Use this method to log your syslog messages. The facility and	 * level are the same as their UNIX counterparts, and the Syslog	 * class provides constants for these fields. The msg is what is	 * actually logged.	 */	public void	syslog( int fac, int pri, String msg )		throws SyslogException		{		this.syslog( this.boundAddress, this.portNum, fac, pri, msg );		}	/**	 * Use this method to log your syslog messages. The facility and	 * level are the same as their UNIX counterparts, and the Syslog	 * class provides constants for these fields. The msg is what is	 * actually logged.	 */	public void	syslog( InetAddress addr, int fac, int pri, String msg )		throws SyslogException		{		this.syslog( addr, this.portNum, fac, pri, msg );		}	/**	 * Use this method to log your syslog messages. The facility and	 * level are the same as their UNIX counterparts, and the Syslog	 * class provides constants for these fields. The msg is what is	 * actually logged.	 */	public void	syslog( String hostname, int fac, int pri, String msg )		throws SyslogException		{		try {			InetAddress address = InetAddress.getByName( hostname );			this.syslog( address, this.portNum, fac, pri, msg );			}		catch ( UnknownHostException ex )			{			String message =				"error locating host named '" + hostname					+ "': " + ex.getMessage();						throw new SyslogException( message );			}		}	/**	 * Use this method to log your syslog messages. The facility and	 * level are the same as their UNIX counterparts, and the Syslog	 * class provides constants for these fields. The msg is what is	 * actually logged.	 */	public void	syslog( String hostname, int port, int fac, int pri, String msg )		throws SyslogException		{		try {			InetAddress address = InetAddress.getByName( hostname );			this.syslog( address, port, fac, pri, msg );			}		catch ( UnknownHostException ex )			{			String message =				"error locating host named '" + hostname					+ "': " + ex.getMessage();						throw new SyslogException( message );			}		}	/**	 * Use this method to log your syslog messages. The facility and	 * level are the same as their UNIX counterparts, and the Syslog	 * class provides constants for these fields. The msg is what is	 * actually logged.	 */	public void	syslog( InetAddress addr, int port, int fac, int pri, String msg )		throws SyslogException		{		int				pricode;		int				length;		int				idx, sidx, nidx;		StringBuffer	buffer;		byte[]			data;		byte[]			sBytes;		byte[]			numbuf = new byte[32];		String			nmObj;		String			strObj;				pricode = SyslogDefs.computeCode( fac, pri );		Integer priObj = new Integer( pricode );				if ( this.logName != null )			{			nmObj = new String( this.logName );			}		else			{			nmObj = new String( Thread.currentThread().getName() );			}		length = 4 + nmObj.length() + msg.length() + 1;		length += (pricode > 99) ? 3 : ( (pricode > 9) ? 2 : 1 );		String dStr = null;		if ( this.includeDate )			{			// See note above on why we have two formats...			Calendar now = Calendar.getInstance();			if ( now.get( Calendar.DAY_OF_MONTH ) < 10 )				dStr = this.date1Format.format( now.getTime() );			else				dStr = this.date2Format.format( now.getTime() );			length += dStr.length();			}		data = new byte[length];				idx = 0;		data[idx++] = (byte)'<';				strObj = priObj.toString( priObj.intValue() );		sBytes = strObj.getBytes();		System.arraycopy			( sBytes, 0, data, idx, sBytes.length );		idx += sBytes.length;				data[idx++] = (byte)'>';		if ( this.includeDate )			{			sBytes = dStr.getBytes();			System.arraycopy				( sBytes, 0, data, idx, sBytes.length );			idx += sBytes.length;			}		sBytes = nmObj.getBytes();		System.arraycopy			( sBytes, 0, data, idx, sBytes.length );		idx += sBytes.length;				data[idx++] = (byte)':';		data[idx++] = (byte)' ';		sBytes = msg.getBytes();		System.arraycopy			( sBytes, 0, data, idx, sBytes.length );		idx += sBytes.length;				data[idx] = 0;		DatagramPacket packet =			new DatagramPacket( data, length, addr, port );				try {			socket.send( packet );			}		catch ( IOException ex )			{			String message =				"error sending message: '" + ex.getMessage() + "'";			System.err.println( message );			throw new SyslogException( message );			}		if ( (this.flags & SyslogDefs.LOG_PERROR) != 0 )			{			if ( this.logName != null )				{				System.err.print( this.logName + ": " );				}			else				{				System.err.print					( Thread.currentThread().getName() + ": " );				}			System.err.println( msg );			}		}	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
9人人澡人人爽人人精品| 国产午夜精品一区二区| 91在线小视频| 成av人片一区二区| 成人av综合一区| 91免费看片在线观看| 91老师国产黑色丝袜在线| 91美女精品福利| 在线视频你懂得一区二区三区| 一本色道a无线码一区v| 日本电影欧美片| 欧美三级电影在线看| 宅男在线国产精品| 精品免费日韩av| 亚洲国产精品成人综合色在线婷婷 | 久久综合九色综合97婷婷女人| 日韩欧美的一区二区| 国产亚洲婷婷免费| 亚洲日本va在线观看| 亚洲一区二区在线视频| 日本不卡的三区四区五区| 男人的天堂亚洲一区| 国产激情视频一区二区三区欧美 | 亚洲国产成人av好男人在线观看| 亚洲资源中文字幕| 美女爽到高潮91| 高清久久久久久| 91久久久免费一区二区| 欧美一区二视频| 国产精品久久久久久久久免费丝袜| 亚洲免费观看在线视频| 美国精品在线观看| www.性欧美| 欧美成人a视频| 亚洲视频在线一区观看| 蜜桃av噜噜一区二区三区小说| 国产成人无遮挡在线视频| 欧美亚洲国产bt| 久久久久国色av免费看影院| 一区二区成人在线| 国产永久精品大片wwwapp| 91久久精品午夜一区二区| 精品久久久久久久久久久久久久久| 亚洲欧美偷拍三级| 久久不见久久见免费视频1| 一本大道久久a久久综合婷婷| 欧美xxxxxxxx| 亚洲一区二区av电影| 国产69精品久久777的优势| 欧美日韩一区二区三区免费看| 久久综合九色综合97婷婷| 亚洲综合在线视频| 成人av电影免费在线播放| 欧美一区二区久久| 亚洲无人区一区| 96av麻豆蜜桃一区二区| 久久综合色8888| 日韩av一区二区三区| 91蝌蚪porny| 国产精品免费丝袜| 国产激情一区二区三区四区| 欧美变态凌虐bdsm| 日本中文字幕一区二区有限公司| 色94色欧美sute亚洲13| 国产精品美女视频| 国产成人精品亚洲午夜麻豆| 日韩欧美一级精品久久| 欧美aaa在线| 日韩午夜激情电影| 免费欧美高清视频| 91精品国产综合久久小美女| 丝袜亚洲另类欧美| 911国产精品| 性做久久久久久久免费看| 欧美日韩久久不卡| 婷婷六月综合网| 91精品国产乱码久久蜜臀| 婷婷国产在线综合| 欧美一区二区三区小说| 午夜精品视频一区| 欧美一区二区视频观看视频| 日韩电影在线免费观看| 日韩欧美综合一区| 国产一区二区三区免费在线观看| 精品国产乱码久久久久久蜜臀| 精品一区二区三区视频| 亚洲精品一区二区三区在线观看 | 国内精品在线播放| 国产调教视频一区| 99久久伊人网影院| 亚洲精品免费电影| 欧美剧在线免费观看网站| 日韩和欧美一区二区三区| 日韩免费性生活视频播放| 国模无码大尺度一区二区三区| 国产三级欧美三级日产三级99 | 一本大道av一区二区在线播放| 一区二区激情视频| 在线不卡a资源高清| 成年人国产精品| 亚洲成人激情综合网| 精品日韩一区二区三区免费视频| 国产一区在线看| 一区二区三区高清在线| 日韩一区二区在线免费观看| 国产成人精品影视| 亚洲综合视频在线观看| 久久久亚洲欧洲日产国码αv| 成人黄色国产精品网站大全在线免费观看 | 丁香婷婷综合五月| 一区二区成人在线| 26uuu久久天堂性欧美| 99久久精品国产一区二区三区| 五月天视频一区| 国产精品久久三| 欧美人动与zoxxxx乱| 春色校园综合激情亚洲| 日韩精品一二三| 中文字幕五月欧美| 欧美精品一区二区三区四区 | 欧美亚洲图片小说| 国产91精品入口| 日本欧美在线观看| 亚洲美女免费视频| 国产清纯美女被跳蛋高潮一区二区久久w | 麻豆成人91精品二区三区| 亚洲色图视频网| 亚洲精品在线一区二区| 欧美人伦禁忌dvd放荡欲情| 成人免费视频一区二区| 精品在线一区二区| 首页综合国产亚洲丝袜| 自拍偷拍亚洲欧美日韩| 国产网站一区二区三区| 欧美一区二区高清| 欧美人牲a欧美精品| 一本一道综合狠狠老| 播五月开心婷婷综合| 9i在线看片成人免费| 国产精品99久久久久久宅男| 日韩av二区在线播放| 亚洲动漫第一页| 一区二区三国产精华液| 中文字幕五月欧美| 国产精品久久久久久亚洲伦| 中文字幕欧美国产| 国产精品午夜久久| 国产日韩欧美亚洲| 久久久久久毛片| 久久久精品国产免大香伊| 欧美成人a∨高清免费观看| 日韩写真欧美这视频| 日韩女优av电影| 日韩美女视频一区二区在线观看| 欧美电影影音先锋| 欧美一级精品大片| 日韩午夜精品视频| 久久婷婷国产综合精品青草| 精品欧美一区二区三区精品久久| 日韩三级视频在线看| 精品少妇一区二区三区视频免付费| 欧美一区二区黄| 精品国产一二三区| 久久精品人人做人人爽97| 欧美激情艳妇裸体舞| 国产精品毛片久久久久久| 国产精品国产精品国产专区不蜜| 亚洲私人黄色宅男| 亚洲国产美国国产综合一区二区| 亚洲一区二区高清| 老汉av免费一区二区三区| 精品中文字幕一区二区| 懂色中文一区二区在线播放| 91麻豆免费视频| 欧美一区二区三区色| 国产欧美一区二区精品秋霞影院| 中文字幕一区免费在线观看| 亚洲一区二区视频在线观看| 国产69精品久久777的优势| 99麻豆久久久国产精品免费| 欧美三日本三级三级在线播放| 日韩一区二区免费电影| 国产视频一区二区三区在线观看| 亚洲免费观看高清完整版在线| 午夜精品一区在线观看| 国产盗摄精品一区二区三区在线| eeuss影院一区二区三区 | 日韩欧美www| 亚洲欧美在线aaa| 麻豆一区二区三| 色噜噜狠狠色综合中国 | 韩国中文字幕2020精品| 99精品视频在线观看免费| 欧美日韩国产一级二级| 欧美激情在线一区二区三区| 香蕉加勒比综合久久| 国产不卡视频在线播放| 欧美日韩国产高清一区二区三区 | 日韩高清不卡在线| www.欧美日韩国产在线|