File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
src/main/java/org/utplsql/cli Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,6 @@ public static void main(String[] args) {
1717
1818 static int runPicocliWithExitCode (String [] args ) {
1919
20- LoggerConfiguration .configure (LoggerConfiguration .ConfigLevel .NONE );
21- LocaleInitializer .initLocale ();
22-
2320 CommandLine commandLine = new CommandLine (UtplsqlPicocliCommand .class );
2421 commandLine .setTrimQuotes (true );
2522
Original file line number Diff line number Diff line change 11package org .utplsql .cli ;
22
3+ import org .slf4j .Logger ;
4+ import org .slf4j .LoggerFactory ;
35import org .utplsql .api .EnvironmentVariableUtil ;
46
57import java .util .Locale ;
1820 */
1921class LocaleInitializer {
2022
23+ private static final Logger logger = LoggerFactory .getLogger (RunAction .class );
24+
2125 private static final Pattern REGEX_LOCALE = Pattern .compile ("^([a-zA-Z]+)[_-]([a-zA-Z]+)" ); // We only need the very first part and are pretty forgiving in parsing
2226
2327 /**
@@ -27,7 +31,10 @@ static void initLocale() {
2731
2832 boolean localeChanged = setDefaultLocale (EnvironmentVariableUtil .getEnvValue ("LC_ALL" ));
2933 if (!localeChanged ) {
30- setDefaultLocale (EnvironmentVariableUtil .getEnvValue ("LANG" ));
34+ localeChanged = setDefaultLocale (EnvironmentVariableUtil .getEnvValue ("LANG" ));
35+ }
36+ if ( !localeChanged ) {
37+ logger .debug ("Java Locale not changed from LC_ALL or LANG environment variable" );
3138 }
3239 }
3340
@@ -54,6 +61,7 @@ private static boolean setDefaultLocale(String localeString) {
5461 Locale l = new Locale .Builder ().setLanguageTag (sb .toString ()).build ();
5562 if (l != null ) {
5663 Locale .setDefault (l );
64+ logger .debug ("Java Locale changed to {}" , l );
5765 return true ;
5866 }
5967 }
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ public RunAction(RunCommandConfig config) {
4848
4949 void init () {
5050 LoggerConfiguration .configure (config .getLogConfigLevel ());
51+ LocaleInitializer .initLocale ();
5152 }
5253
5354 public RunCommandConfig getConfig () {
You can’t perform that action at this time.
0 commit comments