[slf4j-dev] slf4j i8ln

Ralph Goers rgoers at apache.org
Thu Aug 20 17:35:28 CEST 2009


On Aug 20, 2009, at 8:22 AM, 近藤 健 wrote:
>
> ---
>
> I think there is advantage using enum definition discussed below.
>
> enum has information of package and definition class and field.
> Using this feature , I've designed 3 feature.
>
> 1. log message definition using enum
> For example sample code, it can define enum with log message. so  
> developer don't need to write property file. property file must  
> ensure consistency to log id by hand. enum and annotation do by  
> compiler.

This is interesting. Providing the non-internationalized message text  
along with the key would make it easy to create a non-localized  
version of a product and then localize it later just by adding files.

>
> 2. default property file
>  Because enum has class definition, log api is referable declared  
> class of enum.
> Log api can load propery file from using declared class name.
> for example if enum class name is "example.LogMessages", default  
> propery file is "example/LogMessages.properties".

Keep in mind that it isn't a great idea to have the localized files  
only be able to be loaded via the classloader. Ideally, they should be  
in a CMS. However, this pattern could still be useful for that. It is  
handy having the "bundle name" associated with the key.

>
> 3. package
>  EnumMap must create per enum class. so if log id is enum,  
> they aren't duplication.
>

You're saying this prevents duplicate message keys? This one is not  
something I worry about.

In this approach SLF4J would at least have to be able to serialize the  
enum and include the relevant parts - the class name, id and message.

Ralph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-dev/attachments/20090820/b9f3d3ff/attachment.htm>


More information about the slf4j-dev mailing list