Eclipse or SUNrise...

Eclipse or SUNrise...
...JAVA for sure

Thursday, September 20, 2012

Liberty profile locale setting

While working on the new RedBook for WebSphere Application Server V8.5 (you can download a draft version here) I didn't add any example of configuring the servers locale. Since I often work with many environments that use non-English locale, I often suffer from the logs written by the servers or Java runtime that are produced in Polish language. And even if it is my native language, the translation makes them totally incomprehensible... trust me ;-). My rule of the thumb in this matter is to always use English at least for the environment logs. This way it will be much easier to find a solution and if the environment has some sort of support, most of the times, the support will require us to gather the logs in English. This is what you will see if you start the Liberty profile server using Java with a default Polish locale:
Uruchamianie serwera server2 (wlp-
w Java HotSpot(TM) Client VM, wersja 1.6.0_21-b07 (pl_PL) [AUDIT ] CWWKE0001I: Serwer server2 został uruchomiony. [AUDIT ] J2CA8004I: Zasób dataSource MyDataSource jest dostępny jako
jdbc/MyDataSource. [AUDIT ] J2CA8000I: Zasób jdbcDriver DerbyEmbedded jest dostępny. [AUDIT ] CWWKZ0058I: Monitorowanie aplikacji w katalogu dropins. [AUDIT ] CWWKT0016I: Dostępna aplikacja WWW (default_host):
http://localhost:9081/ITSOWebCustomerCredit/* [AUDIT ] CWWKZ0001I: Aplikacja ITSOWebCustomerCredit2 została
uruchomiona w ciągu 1.391 sek. [AUDIT ] CWWKF0011I: Serwer server2 jest gotowy do działania w
trybie Mądrzejszy Świat
Notice the pl_PL locale. To change it, just put this line into a jvm.options file (you will require to create this file - it is not generated by default).
Now you have two options - if you want to make this change global for all servers, put it in the etc directory (it is also not generated by default) in main Liberty profile folder. If you want to just make this change to a given server, put this file next to the main server.xml configuration file. Remember that if you put it there, it will override the global settings from the etc directory. Now this is the new log produced by the server - the locale is en_PL, which means language is English, but country is Poland.
Launching server2 (wlp- 
on Java HotSpot(TM) Client VM, version 1.6.0_21-b07 (en_PL) [AUDIT ] CWWKE0001I: The server server2 has been launched. [AUDIT ] J2CA8004I: The dataSource MyDataSource is available as
jdbc/MyDataSource. [AUDIT ] J2CA8000I: The jdbcDriver DerbyEmbedded is available. [AUDIT ] CWWKZ0058I: Monitoring dropins for applications. [AUDIT ] CWWKT0016I: Web application available (default_host):
http://localhost:9081/ITSOWebCustomerCredit/* [AUDIT ] CWWKZ0001I: Application ITSOWebCustomerCredit2 started in
1.109 seconds. [AUDIT ] CWWKF0011I: The server server2 is ready to run a smarter planet.
To learn more about the Liberty profile directory structure, the configuration files and a lot more I encourage you to check out the chapter 6 Liberty Profile from the WAS v8.5 RedBook. Hope you like it ;-)

No comments: