BEA Server Manuale Utente

Pagina di 88
C
Loggable Object Reference for BEA WebLogic Server
C-2
Internationalization Guide
How Loggable Objects Are Used
To create a 
Logger
 that provides methods to return 
Loggable objects
, you need to 
set the 
loggables
 attribute in the message catalog. 
For example, consider the test.xml catalog shown in 
Listing C-1   test.xml Message Catalog
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE message_catalog PUBLIC "weblogic-message-catalog-dtd" 
"http://www.bea.com/servers/wls600/msgcat.dtd">
<message_catalog
   subsystem="Examples"
   version="1.0"
   baseid="500000"
   endid="500001"
   loggables="true"
   >
   <logmessage
      messageid="500000"
      severity="error"
      method="logIOError(Throwable t)"
      >
      <messagebody>
         IO failure detected. 
      </messagebody>
      <messagedetail>
      </messagedetail>
      <cause>
      </cause>
      <action>
      </action>
   </logmessage>
</message_catalog>
When you run this catalog through the 
i18ngen
 utility, a 
Logger
 class is created for 
this catalog with the following two methods:
„
logIOError 
(Throwable)—logs the message