Log spec sets in persistence unit's property fail with exception when run in different locale

Details

Description

When an application sets the Log property in a persistence unit (persistence.xml) or passes in through map during createEntityManager[Factory] using one locale, this setting will fail when runs in a different locale.

I understand the intention is to match the Log setting using the same locale, however if the Log string is set in an application's persistence unit (persistence.xml) or business logic (createEntityManagerFactory( ...., map)), the application will fail.

I see two alternatives:
1) Since Log is part of the property and configuration framework, none of these property settings are local sensitive. We can make Log property NOT locale sensitive, i.e. always use TRACE, INFO, WARN, ERROR and FATAL as the Log values.

2) Access both English (as in alternative 1) and also whatever current locale Log values. I.e. English only Log values will work when set in persistence.xml and business logic regardless of the current locale setting but locale specific settings ONLY work in the same current locale.

Personally, the second option is more attractive and also backward compatible with existing application that uses locale specific behavior.

I have the same feeling at the first glance and it was also my first choice.

After some thought, I was worried about if there is any existing application that actually uses locale specific Log spec in their p.xml or Map passed to createEntityManager[Factory], option 1 will break their application. Option 2 is a compromise to avoid any back compatibility breakage but still support option 1, which is the preferred behavior.

If there are any strong opinions that backward compatibility is NOT a concern, I can go for option 1.

Albert Lee
added a comment - 20/May/08 15:57 I have the same feeling at the first glance and it was also my first choice.
After some thought, I was worried about if there is any existing application that actually uses locale specific Log spec in their p.xml or Map passed to createEntityManager [Factory] , option 1 will break their application. Option 2 is a compromise to avoid any back compatibility breakage but still support option 1, which is the preferred behavior.
If there are any strong opinions that backward compatibility is NOT a concern, I can go for option 1.
Albert Lee.