[infinispan-dev] use %s syntax for formatting exception messages

Emmanuel Bernard emmanuel at hibernate.org
Wed Mar 16 05:08:19 EDT 2011


The road taken by JBoss Logging is to:
 - associate an alphanumerical code that you can search on the internet. And of course by default messages are in English.
 - use methods to generate the log call

in Infinispan code
if ( txLog == null ) {
   LOG.txLogPushError(txId);
}

@MessageLogger( projectCode = "ISPN" )
public interfaceInfinispanLogger extends BasicLogger {
    @LogMessage( level = ERROR )
    @Message( value = "Error pushing tx log (tx id=%1$)", id = 345 )
    void txLogPushError(String txId);

in your app log
ISPN000345 Error pushing tx log (tx id=3232)


later on, on a wiki page

ISPN-000345 Error pushing tx log
When this happens, you're screwed unless you use JBoss Transaction and then...


I could not really find the doc for JBoss Logging but David will know where it is.

On 16 mars 2011, at 09:42, Tristan Tarrant wrote:

> The only problem I have with this is that if all error / logging messages are i18n'ed, they will be difficult to search for on the web / forums / wikis. 
> For this reason all error messages should include a locale-independent error code. Numeric is ok, but I'd rather have a "readable" error code. 
> For example the string "Error pushing tx log" in InvertedLeaveTask.java would become "TX_LOG_PUSH_ERR: Error pushing tx log".
> 
> Any thoughts on this ?
> 
> Tristan
> 
> On Wed, Mar 16, 2011 at 09:09, Galder Zamarreño <galder at redhat.com> wrote:
> 
> On Mar 15, 2011, at 6:29 PM, Manik Surtani wrote:
> 
> >
> > On 15 Mar 2011, at 17:21, Mircea Markus wrote:
> >
> >>
> >> On 15 Mar 2011, at 17:17, Emmanuel Bernard wrote:
> >>
> >>> As David pointed out %1$ is superior to %s for internationalization.
> >> Agreed.
> >> Not sure we want i18n for logs and error messages (?)
> >
> > It's on our roadmap and a requirement for a few downstream projects/products.
> 
> Yup: https://issues.jboss.org/browse/ISPN-380
> 
> >
> > --
> > Manik Surtani
> > manik at jboss.org
> > twitter.com/maniksurtani
> >
> > Lead, Infinispan
> > http://www.infinispan.org
> >
> >
> >
> > _______________________________________________
> > infinispan-dev mailing list
> > infinispan-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/infinispan-dev
> 
> --
> Galder Zamarreño
> Sr. Software Engineer
> Infinispan, JBoss Cache
> 
> 
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
> 
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20110316/bc25758a/attachment.html 


More information about the infinispan-dev mailing list