java.util.logging.Logger
来源:互联网 发布:java迭代什么意思 编辑:程序博客网 时间:2024/05/17 19:22
public class TestLogger {public static void main(String[] args){Logger log=Logger.getLogger("haha");log.setLevel(Level.INFO);Logger log1=Logger.getLogger("haha");System.out.println(log==log1);Logger log2=Logger.getLogger("haha1");ConsoleHandler consoleHandler=new ConsoleHandler();consoleHandler.setLevel(Level.ALL);log.addHandler(consoleHandler);try {FileHandler fileHandler;String pathString=System.getProperty("user.dir");System.out.println(pathString);fileHandler=new FileHandler(pathString+"\\JZlog.log");fileHandler.setLevel(Level.INFO); log.addHandler(fileHandler);} catch (SecurityException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();} log.info("aaa");log2.info("bbb");log2.fine("fine");}}
console output:
true
E:\myjava\JztechServer
一月 15, 2013 10:32:38 上午 testlog.TestLogger main
INFO: aaa
一月 15, 2013 10:32:38 上午 testlog.TestLogger main
INFO: aaa
一月 15, 2013 10:32:38 上午 testlog.TestLogger main
INFO: bbb
JZlog.log:
<?xml version="1.0" encoding="GBK" standalone="no"?><!DOCTYPE log SYSTEM "logger.dtd"><log><record> <date>2013-01-15T10:32:38</date> <millis>1358217158312</millis> <sequence>0</sequence> <logger>haha</logger> <level>INFO</level> <class>testlog.TestLogger</class> <method>main</method> <thread>1</thread> <message>aaa</message></record></log>
- java.util.logging.Logger
- java.util.logging.Logger
- java.util.logging.Logger
- java.util.logging.Logger
- java.util.logging.Logger
- java.util.logging.Logger基础教程
- java.util.logging.Logger基础教程
- java.util.logging.Logger基础教程
- java.util.logging.Logger基础教程
- java.util.logging.Logger基础教程
- java日志 java.util.logging.Logger用法
- java.util.logging.Logger使用详解
- java.util.logging.Logger使用详解
- java.util.logging.Logger 使用详解
- java.util.logging.Logger使用详解
- java.util.logging.Logger使用详解
- java.util.logging.Logger使用详解
- java.util.logging.Logger使用详解
- console.log()
- 如何在VC6中配置wxWidgets
- UNIX TCP回射服务器/客户端(6):进程池服务器
- 从Samples中入门IOS开发(六)------ Photo和Album浏览
- Java线程:新特征-线程池
- java.util.logging.Logger
- MySQL数据库中show命令用法
- COdeforce 14E
- Redis的安装配置介绍
- linux下解压命令大全
- HDU4300:Clairewd’s message
- Given an array say [9,20,-2,-45,23,5,1], find the minimum positive missing number from the array.
- iPhone iPad 各种控件默认高度
- 线程池ThreadPoolExecutor使用简介