⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logs.java

📁 java HTTP代理多线程监听和处理连接 java HTTP代理多线程监听和处理连接
💻 JAVA
字号:
package proxy;
import java.io.*;
import java.util.*;
import blueSky.util.*;
/**
 * 记录日志
 * @author liwen
 *
 */
public class Logs {
	public Logs() {
		// TODO Auto-generated constructor stub
	}

	public static synchronized void logByte(byte[] bytes, int offset, int len)
			throws IOException {
		System.out.println("//--------------------------start-----------------------//");
		for (int i = 0; i < len; i++) {
			//System.out.print((int) bytes[offset + i]);
		}
		System.out.println("//--------------------------end-------------------------//");
	}
    /** 写字符信息到日志*/
    protected static synchronized void log(String s) {

    	FileOutputStream out = null;
    	String str = BaseFunction.dateToString(new Date()) + ":" + s + "\r\n";
    	try{
	    	out = new FileOutputStream("log.log",true);
	    	out.write(str.getBytes());
    	}catch(Exception ex){
    		System.out.println(BaseFunction.dateToString(new Date()) + ":Write log Exception:" + ex);
    	}finally{
    		try{
    			out.close();
        	}catch(IOException ex){
        		System.out.println(BaseFunction.dateToString(new Date()) + ":Close logfile Exception:" + ex);
        	}
   			
    	}
    	
        //System.out.println(new Date() + ":" + s);
    }
    /**写对象到日志 */

    protected static synchronized void log(Object o) {
        log(o.toString());
    }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -