Log4j로 검색한 결과 :: 시소커뮤니티[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

회원가입 I 비밀번호 찾기


SSISO Community검색
SSISO Community메뉴
[카페목록보기]
[블로그등록하기]  
[블로그리스트]  
SSISO Community카페
블로그 카테고리
정치 경제
문화 칼럼
비디오게임 스포츠
핫이슈 TV
포토 온라인게임
PC게임 에뮬게임
라이프 사람들
유머 만화애니
방송 1
1 1
1 1
1 1
1 1
1

Log4j로 검색한 결과
등록일:2008-03-14 09:32:34
작성자:
제목:log4j: File Based Logg Demo


/*
Logging  In  Java  with  the  JDK  1.4  Logging  API  and  Apache  Log4j
by  Samudra  Gupta        
Apress  Copyright  2003  
ISBN:1590590996

*/

import  org.apache.Log4j.*;

public  class  FileBasedLoggingDemo  implements  Runnable  {

    private  static  Logger  logger  =  Logger.getLogger("filename");

    /**  Creates  a  new  instance  of  FileBasedLoggingDemo  */
    public  FileBasedLoggingDemo()  {
    }

    /**
      *  This  method  is  called  by  the  application.  This  method  creates  a  new
      *  thread  to  start  logging
      */
    public  void  doLogging()  {
        Thread  t  =  new  Thread(this);
        t.start();
    }

    /**
      *  The  thread's  run()  method,  which  does  repeated  logging  at  an  interval  of
      *  60secs.
      */
    public  void  run()  {
        int  count  =  1;
        while  (true)  {
            //logging  information
            try  {
                logger.debug("Logging  the  information..."  +  count);
                Thread.sleep(60  *  1000);
                count++;
            }  catch  (Exception  e)  {
                logger.warn("Exception  occured",  e);
            }
        }
    }

    /**
      *  the  main  method
      */
    public  static  void  main(String  args[])  {
        FileBasedLoggingDemo  demo  =  new  FileBasedLoggingDemo();
        demo.doLogging();
    }
}