Thanks for the pointer.
Looks like LocalizedMessage already covers this functionality.
Also, if I'm not mistaken, in LocalizedMessage the key is the message if
the bundle does not contain the key, so same behaviour as in v1.

So, false alarm then? No need to do anything, right?


On Sat, Feb 1, 2014 at 12:32 AM, Gary Gregory <[email protected]>wrote:

> On Fri, Jan 31, 2014 at 10:16 AM, Remko Popma <[email protected]>wrote:
>
>> Anyway, what are we going to do with this?
>> Team, do we want to support this functionality (localized log message
>> lookup in ResourceBundles) in Log4J2?
>>
>> If so, where do we put the #setResourceBundle() method? On LogManager?
>> And I guess the #l7dlog() methods would need to be added to the Logger
>> interface?
>>
>
> The tricky part is that in v1, if a key is not in the resource bundle then
> the key *is* the message. So this let's you mix keys and messages in call
> sites, which our server does all the time, not very neat and tidy I know.
> This brings up and interesting usage issue: We wanted to localize
> everything the user sees, but it is hard to justify anything below INFO
> going into the RB because it is more work. It would also slow down
> development and discourage peppering the code with good DEBUG messages.
>
> Speaking of looking before you speak. We do have
> org.apache.logging.log4j.message.LocalizedMessageFactory
>
> Gary
>
>
> On Sat, Feb 1, 2014 at 12:08 AM, Remko Popma <[email protected]>wrote:
>
>> Hm... I should have looked it up sooner... :-(
>>
>>
>> On Sat, Feb 1, 2014 at 12:07 AM, Gary Gregory <[email protected]>wrote:
>>
>>> On Fri, Jan 31, 2014 at 3:06 AM, Remko Popma <[email protected]>wrote:
>>>
>>>> I should have looked this up...
>>>> l7dlog() methods replace the user-supplied key by its localized version
>>>> from the resource bundle.
>>>>
>>>> So this is about the log message text, not the level names. Please
>>>> disregard my previous email.
>>>>
>>>
>>> Now I see this :) ah! Good digging Remko!
>>>
>>> Gary
>>>
>>>
>>>>
>>>> One of my colleagues raised an interesting point: We have some systems
>>>> where the log files are tailed and monitored, and alerts are raised for
>>>> certain keywords. For those systems it is important that the format doesn't
>>>> change when upgrading.
>>>
>>>
>>>> That may actually be a good argument in favor of supporting
>>>> localization in log4j 2.0...
>>>>
>>>
>>>>
>>>>
>>>>
>>>> On Friday, January 31, 2014, Remko Popma <[email protected]> wrote:
>>>>
>>>>> I asked a number of Japanese and Chinese colleagues, but nobody seemed
>>>>> to want the level names translated in the log output. They were all
>>>>> happy with the English names. About half advised against translating, half
>>>>> was indifferent, and one person said he wouldn't use it himself but he
>>>>> thought that other people might want it.
>>>>>
>>>>> So maybe this is a "nice-to-have" rather than a "must-have" feature?
>>>>>
>>>>> On Friday, January 31, 2014, Remko Popma <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> What does the localization do?
>>>>>> Is it for translating the built-in level names?
>>>>>>
>>>>>>
>>>>>> On Friday, January 31, 2014, Gary Gregory <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> In Log4j 1 we use:
>>>>>>>
>>>>>>> - org.apache.log4j.Category.setResourceBundle(ResourceBundle)
>>>>>>> - org.apache.log4j.Category.l7dlog(Priority, String, Object[],
>>>>>>> Throwable)
>>>>>>>
>>>>>>> It seems v2 makes sidesteps the whole localization/i18n issue.
>>>>>>>
>>>>>>> What's the migration path for that?
>>>>>>>
>>>>>>> So we'll never play nice with some projects that require playing
>>>>>>> with resource bundles.
>>>>>>>
>>>>>>> Should we recommend creating a Logger wrapper to hold a resource
>>>>>>> bundle? I'm not sure what else we can do... we could provide it...
>>>>>>>
>>>>>>> Thoughts?
>>>>>>>
>>>>>>> Gary
>>>>>>> --
>>>>>>> E-Mail: [email protected] | [email protected]
>>>>>>> Java Persistence with Hibernate, Second 
>>>>>>> Edition<http://www.manning.com/bauer3/>
>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>> Home: http://garygregory.com/
>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>
>>>>>>
>>>
>>>
>>> --
>>> E-Mail: [email protected] | [email protected]
>>> Java Persistence with Hibernate, Second 
>>> Edition<http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>
>>
>
>
>
> --
> E-Mail: [email protected] | [email protected]
> Java Persistence with Hibernate, Second 
> Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>

Reply via email to