黑马程序员——【Java】IO——字符流:简单Log
来源:互联网 发布:mac wine 软件 编辑:程序博客网 时间:2024/06/05 18:51
------- android培训、java培训、期待与您交流! ----------
import java.io.*;
import java.util.*;
import java.text.*;
class ExceptionInfo {
public static void main(String[] args) throws IOException {
try {
int[] arr = new int[2];
System.out.println(arr[3]);
} catch (Exception e) {
try {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
String s = sdf.format(d);
PrintStream ps = new PrintStream("exeception.log");
ps.println(s);
System.setOut(ps);
} catch (IOException ex) {
throw new RuntimeException("日志文件创建失败");
}
e.printStackTrace(System.out);
}
}
}
import java.util.*;
import java.text.*;
class ExceptionInfo {
public static void main(String[] args) throws IOException {
try {
int[] arr = new int[2];
System.out.println(arr[3]);
} catch (Exception e) {
try {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
String s = sdf.format(d);
PrintStream ps = new PrintStream("exeception.log");
ps.println(s);
System.setOut(ps);
} catch (IOException ex) {
throw new RuntimeException("日志文件创建失败");
}
e.printStackTrace(System.out);
}
}
}
import java.util.*;
import java.io.*;
class SystemInfo
{
public static void main(String[] args) throws IOException
{
Properties prop = System.getProperties();
//System.out.println(prop);
prop.list(new PrintStream("sysinfo.txt"));
}
}
import java.io.*;
class SystemInfo
{
public static void main(String[] args) throws IOException
{
Properties prop = System.getProperties();
//System.out.println(prop);
prop.list(new PrintStream("sysinfo.txt"));
}
}
import java.io.*;
import java.util.*;
import java.text.*;
class ExceptionInfo {
public static void main(String[] args) throws IOException {
try {
int[] arr = new int[2];
System.out.println(arr[3]);
} catch (Exception e) {
try {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
String s = sdf.format(d);
PrintStream ps = new PrintStream("exeception.log");
ps.println(s);
System.setOut(ps);
} catch (IOException ex) {
throw new RuntimeException("日志文件创建失败");
}
e.printStackTrace(System.out);
}
}
}
import java.util.*;
import java.text.*;
class ExceptionInfo {
public static void main(String[] args) throws IOException {
try {
int[] arr = new int[2];
System.out.println(arr[3]);
} catch (Exception e) {
try {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
String s = sdf.format(d);
PrintStream ps = new PrintStream("exeception.log");
ps.println(s);
System.setOut(ps);
} catch (IOException ex) {
throw new RuntimeException("日志文件创建失败");
}
e.printStackTrace(System.out);
}
}
}
import java.util.*;
import java.io.*;
class SystemInfo
{
public static void main(String[] args) throws IOException
{
Properties prop = System.getProperties();
//System.out.println(prop);
prop.list(new PrintStream("sysinfo.txt"));
}
}
import java.io.*;
class SystemInfo
{
public static void main(String[] args) throws IOException
{
Properties prop = System.getProperties();
//System.out.println(prop);
prop.list(new PrintStream("sysinfo.txt"));
}
}
总结自黑马程序员毕向东老师课堂笔记。演示源码,可运行Demo
0 0
- 黑马程序员——【Java】IO——字符流:简单Log
- 黑马程序员——Java IO —字符流
- 黑马程序员——Java基础---IO流(字符流)
- 黑马程序员——java基础---IO---字符流
- 黑马程序员——java基础---IO---字符流
- 黑马程序员——IO字符流
- 黑马程序员——java IO流
- 黑马程序员—java—IO流
- 黑马程序员——Java IO流
- 黑马程序员——Java IO流
- 黑马程序员——java-IO流
- 黑马程序员java学习—IO流
- 黑马程序员—Java中的IO流
- 黑马程序员——IO流-字节流、字符流
- 黑马程序员——IO字符流与字节流
- 黑马程序员——io流(一)字符流
- 黑马程序员——IO流字符流
- 黑马程序员——IO流2:字符流
- 上课笔记-台大哲学概论(一)
- 黑马程序员——【Java】IO——字节流:流操作规律
- JDK源码阅读之Map接口和Set接口
- 第五周——分数类
- Linux mail命令发送邮件
- 黑马程序员——【Java】IO——字符流:简单Log
- 【笔记】2013-10<—>2013-11
- 设计模式总结
- 黑马程序员——【Java】IO——File基本
- java synchronized详解
- 九款WPF界面控件的优势总结
- 冒泡排序
- 怎么在eclipse虚拟机上安装apk
- WINDOWS键盘事件的挂钩监控原理及其应用技术