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) {
17
17
18
18
static int runPicocliWithExitCode (String [] args ) {
19
19
20
- LoggerConfiguration .configure (LoggerConfiguration .ConfigLevel .NONE );
21
- LocaleInitializer .initLocale ();
22
-
23
20
CommandLine commandLine = new CommandLine (UtplsqlPicocliCommand .class );
24
21
commandLine .setTrimQuotes (true );
25
22
Original file line number Diff line number Diff line change 1
1
package org .utplsql .cli ;
2
2
3
+ import org .slf4j .Logger ;
4
+ import org .slf4j .LoggerFactory ;
3
5
import org .utplsql .api .EnvironmentVariableUtil ;
4
6
5
7
import java .util .Locale ;
18
20
*/
19
21
class LocaleInitializer {
20
22
23
+ private static final Logger logger = LoggerFactory .getLogger (RunAction .class );
24
+
21
25
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
22
26
23
27
/**
@@ -27,7 +31,10 @@ static void initLocale() {
27
31
28
32
boolean localeChanged = setDefaultLocale (EnvironmentVariableUtil .getEnvValue ("LC_ALL" ));
29
33
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" );
31
38
}
32
39
}
33
40
@@ -54,6 +61,7 @@ private static boolean setDefaultLocale(String localeString) {
54
61
Locale l = new Locale .Builder ().setLanguageTag (sb .toString ()).build ();
55
62
if (l != null ) {
56
63
Locale .setDefault (l );
64
+ logger .debug ("Java Locale changed to {}" , l );
57
65
return true ;
58
66
}
59
67
}
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ public RunAction(RunCommandConfig config) {
48
48
49
49
void init () {
50
50
LoggerConfiguration .configure (config .getLogConfigLevel ());
51
+ LocaleInitializer .initLocale ();
51
52
}
52
53
53
54
public RunCommandConfig getConfig () {
You can’t perform that action at this time.
0 commit comments