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

📄 logger.java

📁 一个网络爬虫
💻 JAVA
字号:
package org.flaviotordini.arale;import java.util.*;import java.io.*;/** *  Classe che si occupa del logging. * *@author     Flavio Tordini *@created    7 novembre 2001 */public class Logger {    /**     *  Description of the Field     *     *@since     */    public PrintStream logger = null;    /**     *  Sets the logFile attribute of the Logger object     *     *@param  filename  The new logFile value     *@since     */    public void setLogFile(String filename) {        File logfile = new File(filename);        System.out.println("Setting log file to " + logfile);        try {            FileOutputStream fos = new FileOutputStream(logfile.toString(), false);            logger = new PrintStream(fos, true);            logger.println("Arale started at " + new java.util.Date());        } catch (Exception e) {            e.printStackTrace();            System.out.println("Error setting log file");        }    }    /**     *  Description of the Method     *     *@param  s  Description of Parameter     *@since     */    public void log(String s) {        s = "[" + Thread.currentThread().getName() + "] " + s;        System.out.println(s);        logger.println(s);    }    /**     *  Description of the Method     *     *@param  e  <...>     *@since     27 novembre 2001     */    public void log(Exception e) {        // log(e.toString());        e.printStackTrace(logger);        System.out.println(e.toString());    }}

⌨️ 快捷键说明

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