log.java
来自「WAP PUSH后台源码,WAP PUSH后台源码」· Java 代码 · 共 49 行
JAVA
49 行
package com.sxit.wap.common;import java.io.*;public class Log { public static void write(String url, String s) { try { FileOutputStream fos = new FileOutputStream("error.log", true); PrintWriter pw = new PrintWriter(fos); s = DateUtil.getYYYYMMDDHHMISS() + ">>>>>>>>" + url + "发生如下错误:" + s; pw.println(s); pw.flush(); fos.flush(); } catch(Exception ex) { ex.printStackTrace(); } } public static void write(String url, Exception e) { try { FileOutputStream fos = new FileOutputStream("error.log", true); PrintWriter pw = new PrintWriter(fos); pw.println(DateUtil.getYYYYMMDDHHMISS() + ">>>>>>>>" + url + "发生如下错误:"); pw.println(e); pw.flush(); fos.flush(); } catch(Exception ex) { ex.printStackTrace(); } } public static void write(String url, String s, Exception e) { try { FileOutputStream fos = new FileOutputStream("error.log", true); PrintWriter pw = new PrintWriter(fos); s = DateUtil.getYYYYMMDDHHMISS() + ">>>>>>>>" + url + "发生如下错误:" + s; pw.println(s); pw.println(e); pw.flush(); fos.flush(); } catch(Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) throws IOException { try { int i = 1/0; }catch(Exception e) { } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?