try catchの合理的な使用

1862 ワード

      try catch    ,          ?

       :try catch                  ,                api,   api      api ,   api                  ,      api    ,               ,    api    。

      ,    api,     api    ,      api          ,             ,       try catch    ,       。  api           ,   api     ;           ,          ,        。
try{A   } catch{Exception e}{B   } 。。。。。

A              ,B    A     ,     。   ,      ,                ,      ,            ,                         。try     A                  ,             ,catch       .

        try-catch ,        try   ,             。           ,         ,      。                     , catch     。  ,        ,               ,          ,              ,              。

                  ,        ,          try-catch  。                   。
    trycatch      ,       ,            ,      ,          。
         ,try-catch             ,  php  segment fault,         ,   try-catch       ,        gdb       。

try catch             ?                  ?                                                                                  
        try catch     ,           ,             ,          。                 !       ,           ,                       ,         !

LOG4J  
  :Log4j Apache          ,    Log4j,                    、  、GUI  、         、NT      、UNIX Syslog     ;                 ;              ,                  。         ,                    ,           。
                                        。  ,    (trace),         System.out.println printf    。log4j                  。                   。
            ,          System.out.println       ,                      。 log4j                 。             ,                             。

  log4j    3     :
    Logger Logger               。
     Appender Appender              。
     Layout Layout      Appender   。