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

📄 jspmyadminlogwriter.java

📁 管理 MySQL 的工具, 相當方便好用
💻 JAVA
字号:
/*
 * jspMyAdminLogWriter 0.6 2001/08/25 
 * Copyright (c) 2001 zsolyfree@yahoo.com under the GPL (www.gnu.org/copyleft/)
 * 
 * TERMS OF USAGE:
 * This file was written and developed by Zsolt Mali (zsolyfree@yahoo.com)
 * for educational and demonstration purposes only.  You have all rights to use,
 * modify, and redistribute this file as you like.  The only
 * requirement is that you must retain this notice, without modifications, at
 * the top of your source code.  No warranties or guarantees are expressed or
 * implied. DO NOT use this code in a production environment without
 * understanding the limitations and weaknesses pretaining to or caused by the
 * use of these scripts, directly or indirectly. USE AT YOUR OWN RISK!
 */
package com.jspmyadmin;


import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.net.InetAddress;
public class jspMyAdminLogWriter
{
PrintWriter out;
String IPAdress;
public jspMyAdminLogWriter(String log_FileName) {
try {
out = new PrintWriter(new FileWriter(log_FileName,true));
   }
catch (IOException e) {
 System.out.println("File not found"+log_FileName);
 }
  try {
 InetAddress me = InetAddress.getLocalHost();
 this.IPAdress=me.getHostAddress();
      } catch (Exception e) {
      e.printStackTrace();
      }
}//end method jspMyAdminLogWriter

public jspMyAdminLogWriter(String log_FileName, String ipAddress) {
try {
out = new PrintWriter(new FileWriter(log_FileName,true));
   }
catch (IOException e) {
 System.out.println("File not found"+log_FileName);
 }
this.IPAdress=ipAddress;
}//end method jspMyAdminLogWriter

public void writeln(String line) {
Calendar rightNow = Calendar.getInstance();

SimpleDateFormat df = new SimpleDateFormat("(E dd MMM yyyy HH:mm:ss a)");
out.println(df.format(rightNow.getTime())+" - "+IPAdress+" - "+line);
out.flush();
} //end method writeln

public void close() {
out.flush();
out.close();
} //end method close

}//end class jspMyAdminLogWriter

⌨️ 快捷键说明

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