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

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Mircea Markus
Hi,

Not a biggie, but I think it would be nice to use this nicer syntax for exception messages, e.g.
throw new ConfigurationException("you 're not allowed to use %s and %s together", that, other);
wdyt?

Cheers,
Mircea
 
_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Manik Surtani
Yeah, I currently do:

        throw new ConfigurationException(String.format("you 're not allowed to use %s and %s together", that, other));

but we could overload the constructor of CacheException ...

On 15 Mar 2011, at 16:15, Mircea Markus wrote:

> Hi,
>
> Not a biggie, but I think it would be nice to use this nicer syntax for exception messages, e.g.
> throw new ConfigurationException("you 're not allowed to use %s and %s together", that, other);
> wdyt?
>
> Cheers,
> Mircea
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Manik Surtani
[hidden email]
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org




_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Emmanuel Bernard
As David pointed out %1$ is superior to %s for internationalization.

On 15 mars 2011, at 18:13, Manik Surtani wrote:

> Yeah, I currently do:
>
> throw new ConfigurationException(String.format("you 're not allowed to use %s and %s together", that, other));
>
> but we could overload the constructor of CacheException ...
>
> On 15 Mar 2011, at 16:15, Mircea Markus wrote:
>
>> Hi,
>>
>> Not a biggie, but I think it would be nice to use this nicer syntax for exception messages, e.g.
>> throw new ConfigurationException("you 're not allowed to use %s and %s together", that, other);
>> wdyt?
>>
>> Cheers,
>> Mircea
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> --
> Manik Surtani
> [hidden email]
> twitter.com/maniksurtani
>
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

David M. Lloyd
In reply to this post by Manik Surtani
If you use the JBoss standard i18n library, you can put things like this
on your message bundle interface:

    @Message("You're not allowed to use %s and %s together")
    ConfigurationException cantUseTogether(String that, String other);

then you can just do:

    throw cantUseTogether(that, other);

with the advantage that it can be translated into other languages.

On 03/15/2011 12:13 PM, Manik Surtani wrote:

> Yeah, I currently do:
>
> throw new ConfigurationException(String.format("you 're not allowed to use %s and %s together", that, other));
>
> but we could overload the constructor of CacheException ...
>
> On 15 Mar 2011, at 16:15, Mircea Markus wrote:
>
>> Hi,
>>
>> Not a biggie, but I think it would be nice to use this nicer syntax for exception messages, e.g.
>> throw new ConfigurationException("you 're not allowed to use %s and %s together", that, other);
>> wdyt?
>>
>> Cheers,
>> Mircea
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> --
> Manik Surtani
> [hidden email]
> twitter.com/maniksurtani
>
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev


--
- DML
_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Mircea Markus
In reply to this post by Emmanuel Bernard

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 (?)

>
> On 15 mars 2011, at 18:13, Manik Surtani wrote:
>
>> Yeah, I currently do:
>>
>> throw new ConfigurationException(String.format("you 're not allowed to use %s and %s together", that, other));
>>
>> but we could overload the constructor of CacheException ...
>>
>> On 15 Mar 2011, at 16:15, Mircea Markus wrote:
>>
>>> Hi,
>>>
>>> Not a biggie, but I think it would be nice to use this nicer syntax for exception messages, e.g.
>>> throw new ConfigurationException("you 're not allowed to use %s and %s together", that, other);
>>> wdyt?
>>>
>>> Cheers,
>>> Mircea
>>>
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>> --
>> Manik Surtani
>> [hidden email]
>> twitter.com/maniksurtani
>>
>> Lead, Infinispan
>> http://www.infinispan.org
>>
>>
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Manik Surtani

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.

--
Manik Surtani
[hidden email]
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org



_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Galder Zamarreno

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
> [hidden email]
> twitter.com/maniksurtani
>
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Tristan Tarrant
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 <[hidden email]> 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
> [hidden email]
> twitter.com/maniksurtani
>
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Emmanuel Bernard
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 <[hidden email]> 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
> [hidden email]
> twitter.com/maniksurtani
>
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev

_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Manik Surtani
Yup.  Essentially if anyone's ever worked with Oracle DB, plugging an ORA-12345 error code into Google usually gives you details of the error regardless of the i18n error message you find in the logs.

On 16 Mar 2011, at 09:08, Emmanuel Bernard wrote:

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 <[hidden email]> 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
> [hidden email]
> twitter.com/maniksurtani
>
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev

_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev

_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev



_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Vladimir Blagojevic
Not only Oracle but our own Weld has this. It is awesome. I googled error codes and fixed the problem immediately. Fantastic idea!

On 11-03-16 6:39 AM, Manik Surtani wrote:
Yup.  Essentially if anyone's ever worked with Oracle DB, plugging an ORA-12345 error code into Google usually gives you details of the error regardless of the i18n error message you find in the logs.

On 16 Mar 2011, at 09:08, Emmanuel Bernard wrote:

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 <[hidden email]> 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
> [hidden email]
> twitter.com/maniksurtani
>
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev

_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev

_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev


_______________________________________________ infinispan-dev mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/infinispan-dev


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Sanne Grinovero
in future we might have the logger output a link to a wiki page, one
page for each error, where people can write about issue context and
possible solutions, or links to JIRAs, fixed versions. Then we can
collect statistics on those page visits..

2011/3/16 Vladimir Blagojevic <[hidden email]>:

> Not only Oracle but our own Weld has this. It is awesome. I googled error
> codes and fixed the problem immediately. Fantastic idea!
>
> On 11-03-16 6:39 AM, Manik Surtani wrote:
>
> Yup.  Essentially if anyone's ever worked with Oracle DB, plugging an
> ORA-12345 error code into Google usually gives you details of the error
> regardless of the i18n error message you find in the logs.
> On 16 Mar 2011, at 09:08, Emmanuel Bernard wrote:
>
> 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 <[hidden email]> 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
>> > [hidden email]
>> > twitter.com/maniksurtani
>> >
>> > Lead, Infinispan
>> > http://www.infinispan.org
>> >
>> >
>> >
>> > _______________________________________________
>> > infinispan-dev mailing list
>> > [hidden email]
>> > https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>> --
>> Galder Zamarreño
>> Sr. Software Engineer
>> Infinispan, JBoss Cache
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> --
> Manik Surtani
> [hidden email]
> twitter.com/maniksurtani
> Lead, Infinispan
> http://www.infinispan.org
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>

_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Manik Surtani
Also a good idea.  The approach may well be to start with error codes though, and have a error code reference on our wiki pointing to specific pages per error code - which would be picked up by search engines, etc.

On 16 Mar 2011, at 14:23, Sanne Grinovero wrote:

> in future we might have the logger output a link to a wiki page, one
> page for each error, where people can write about issue context and
> possible solutions, or links to JIRAs, fixed versions. Then we can
> collect statistics on those page visits..
>
> 2011/3/16 Vladimir Blagojevic <[hidden email]>:
>> Not only Oracle but our own Weld has this. It is awesome. I googled error
>> codes and fixed the problem immediately. Fantastic idea!
>>
>> On 11-03-16 6:39 AM, Manik Surtani wrote:
>>
>> Yup.  Essentially if anyone's ever worked with Oracle DB, plugging an
>> ORA-12345 error code into Google usually gives you details of the error
>> regardless of the i18n error message you find in the logs.
>> On 16 Mar 2011, at 09:08, Emmanuel Bernard wrote:
>>
>> 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 <[hidden email]> 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
>>>> [hidden email]
>>>> twitter.com/maniksurtani
>>>>
>>>> Lead, Infinispan
>>>> http://www.infinispan.org
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> infinispan-dev mailing list
>>>> [hidden email]
>>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>
>>> --
>>> Galder Zamarreño
>>> Sr. Software Engineer
>>> Infinispan, JBoss Cache
>>>
>>>
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>> --
>> Manik Surtani
>> [hidden email]
>> twitter.com/maniksurtani
>> Lead, Infinispan
>> http://www.infinispan.org
>>
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Manik Surtani
[hidden email]
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org




_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

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

Pete Muir
In reply to this post by Vladimir Blagojevic
Yes I think people really like the "certainty" associated with error codes - they are sure the error they are getting is the same as the other persons. Now we just need to actually start using the codes in wiki pages ;-)

On 16 Mar 2011, at 14:18, Vladimir Blagojevic wrote:

> Not only Oracle but our own Weld has this. It is awesome. I googled error codes and fixed the problem immediately. Fantastic idea!
>
> On 11-03-16 6:39 AM, Manik Surtani wrote:
>> Yup.  Essentially if anyone's ever worked with Oracle DB, plugging an ORA-12345 error code into Google usually gives you details of the error regardless of the i18n error message you find in the logs.
>>
>> On 16 Mar 2011, at 09:08, Emmanuel Bernard wrote:
>>
>>> 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 <[hidden email]> 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
>>>> > [hidden email]
>>>> > twitter.com/maniksurtani
>>>> >
>>>> > Lead, Infinispan
>>>> > http://www.infinispan.org
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > infinispan-dev mailing list
>>>> > [hidden email]
>>>> > https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>>
>>>> --
>>>> Galder Zamarreño
>>>> Sr. Software Engineer
>>>> Infinispan, JBoss Cache
>>>>
>>>>
>>>> _______________________________________________
>>>> infinispan-dev mailing list
>>>> [hidden email]
>>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>>
>>>> _______________________________________________
>>>> infinispan-dev mailing list
>>>> [hidden email]
>>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>>
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>> --
>> Manik Surtani
>> [hidden email]
>> twitter.com/maniksurtani
>>
>> Lead, Infinispan
>> http://www.infinispan.org
>>
>>
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>>
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> _______________________________________________
> infinispan-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev


_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev