此内容没有您所选择的语言版本。
6.2.4. Customizing Internationalized Log Messages
		This task shows how to add message ids and project codes to internationalized log messages created using JBoss Logging Tools. A log message must have both a project code and message id for them to be displayed in the log. If a message does not have both a project code and a message id, then neither is displayed.
	
		Refer to the 
logging-tools quick start for a complete example.
	Prerequisites
- You must already have a project with internationalized log messages. Refer to Section 6.2.2.1, “Create Internationalized Log Messages”.
- You need to know what the project code you will be using is. You can use a single project code, or define different ones for each interface.
Procedure 6.6. Add message Ids and Project Codes to Log Messages
- Specify the project code for the interface. Specify the project code using the projectCode attribute of the- @MessageLoggerannotation attached to a custom logger interface. All messages that are defined in the interface will use that project code.- @MessageLogger(projectCode="ACCNTS") interface AccountsLogger extends BasicLogger { }- @MessageLogger(projectCode="ACCNTS") interface AccountsLogger extends BasicLogger { }- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Specify Message Ids Specify a message ID for each message using the- idattribute of the- @Messageannotation attached to the method that defines the message.- @LogMessage @Message(id=43, value = "Customer query failed, Database not available.") void customerQueryFailDBClosed(); - @LogMessage @Message(id=43, value = "Customer query failed, Database not available.") void customerQueryFailDBClosed();- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
		The log messages that have both a message ID and project code have been associated with them will prepend these to the logged message.
	
10:55:50,638 INFO [com.company.accounts.ejb] (MSC service thread 1-4) ACCNTS000043: Customer query failed, Database not available.
10:55:50,638 INFO  [com.company.accounts.ejb] (MSC service thread 1-4) ACCNTS000043: Customer query failed, Database not available.