I use jboss-logging. According to https://jboss-logging.github.io/jboss-logging-tools/#message-bundle-interfaces, there the two types:
I don't know how this is internally handled but using
@MessageLogger(projectCode = "TESTLOGGER", length = 3)
public interface TestLogger {
// This is not a log message, but a string message
@Message(id=1, value = "invalid {0}", format = Message.Format.MESSAGE_FORMAT)
void test(String dateString);
// this is a typical log message
@LogMessage
@Message(id=2, value = "invalid {0}", format = Message.Format.MESSAGE_FORMAT)
void test(String dateString);
// this is a typcial exception
@Message(id = 3, value = "Invalid '%s'")
IllegalArgumentException invalidPermissionAction(String action);
}
}
also works. So I assume that I can put log messages, exceptions and string messages within a @MessageLogger
and don't need to separate them by @MessageBundle
. Am I right? Are there any hidden limitations with this approach?
That is correct. You can put log messages, string messages and exceptions in the same file.