?? logs.java
字號(hào):
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-------------------------//");
}
/** 寫(xiě)字符信息到日志*/
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);
}
/**寫(xiě)對(duì)象到日志 */
protected static synchronized void log(Object o) {
log(o.toString());
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -