[jboss-dev-forums] [JBoss AS7 Development] - Logging for JBoss Application Server 7 Subsystems
James Perkins
do-not-reply at jboss.com
Sun Nov 6 13:54:50 EST 2011
James Perkins [http://community.jboss.org/people/jamezp] modified the document:
"Logging for JBoss Application Server 7 Subsystems"
To view the document, visit: http://community.jboss.org/docs/DOC-17334
--------------------------------------------------------------
h3. *General Rules:*
* All exceptions and messages require a translation method in the @MessageBundle.
* All info and higher messages being logged require a translation method in the @MessageLogger.
* Messages in both the @MessageBundle and @MessageLogger should have an id***. Note though there are cases, specifically some methods in the @MessageBundle, that do not need id's. These typically include messages that are not being used in exceptions.
*** A list of id's can be found here http://community.jboss.org/docs/DOC-16810 http://community.jboss.org/wiki/LoggingIds
h3. *Examples:*
*
*
*Before:*
@Override
public void start(StartContext context) throws StartException {
try {
final JBossThreadFactory threadFactory = new JBossThreadFactory(new ThreadGroup("ServerDeploymentRepository-temp-threads"), Boolean.FALSE, null, "%G - %t", null, null, AccessController.getContext());
tempFileProvider = TempFileProvider.create("temp", Executors.newScheduledThreadPool(2, threadFactory));
} catch (IOException e) {
throw new StartException("Failed to create temp file provider");
}
log.debugf("%s started", ServerDeploymentRepository.class.getSimpleName());
}
*Methods added to DeploymentRepositoryMessages:*
/**
* Creates an exception indicating a failure to create a temp file provider.
*
* @return a {@link StartException} for the error.
*/
@Message(id = 14900, value = "Failed to create temp file provider")
StartException failedCreatingTempProvider();
*After:*
@Override
public void start(StartContext context) throws StartException {
try {
final JBossThreadFactory threadFactory = new JBossThreadFactory(new ThreadGroup("ServerDeploymentRepository-temp-threads"), Boolean.FALSE, null, "%G - %t", null, null, AccessController.getContext());
tempFileProvider = TempFileProvider.create("temp", Executors.newScheduledThreadPool(2, threadFactory));
} catch (IOException e) {
throw MESSAGES.failedCreatingTempProvider();
}
ROOT_LOGGER.debugf("%s started", ServerDeploymentRepository.class.getSimpleName());
}
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-17334]
Create a new document in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20111106/98d52491/attachment.html
More information about the jboss-dev-forums
mailing list