jakarta-eemaven-pluginopen-liberty

Set language for Open Liberty logs running with Maven plugin


I have a Jakarta EE project based on Maven and use the openliberty-runtime plugin to be able to directly start the application in dev mode.

It works, but the log messages are German, since that is my personal locale. But I want to have the logs in English. How can I set that?

I found so far, that a JVM option should be used and -Duser.language=en-US could be set. But it is not clear where exactly that should be done. I tried a jvm.options file and I tried the jvmOptions attribute in plugin's configuration, but no luck.

Other solutions on SO describe how to do it in an installed Open Liberty, but I want to have it when running as mvnw liberty:dev.


Solution

  • If you are trying to change the locale used for the Liberty messages.log (which also gets printed to the console when running in dev mode) to English, you can add a jvm.options file in the src/main/liberty/config folder with the following contents.

    -Duser.language=en
    -Duser.country=US
    

    This worked for me when I specified fr for the language and CA for the country even though my default locale was en and US.