[jOOQ/jOOQ#12405] CLI programs should set java.util.loggin.SimpleFormatter.format if not already set

This commit is contained in:
Lukas Eder 2021-09-07 15:00:02 +02:00
parent 8bbf080a87
commit 0d7eb1748f
4 changed files with 16 additions and 1 deletions

View File

@ -150,6 +150,7 @@ public class GenerationTool {
}
public static void main(String[] args) throws Exception {
JooqLogger.initSimpleFormatter();
String[] files;
if (args.length > 0) {

View File

@ -39,6 +39,8 @@ package org.jooq;
import static org.jooq.Constants.MINOR_VERSION;
import org.jooq.tools.JooqLogger;
/**
* Common utilities for {@link ParserCLI}, {@link DiffCLI} and others.
*
@ -47,6 +49,8 @@ import static org.jooq.Constants.MINOR_VERSION;
final class CLIUtil {
static void main(String url, Runnable runnable) {
JooqLogger.initSimpleFormatter();
try {
runnable.run();
}

View File

@ -37,6 +37,8 @@
*/
package org.jooq.tools;
import java.util.logging.SimpleFormatter;
import org.jooq.Log;
/**
@ -596,4 +598,13 @@ public final class JooqLogger implements Log {
return ordinal() <= level.ordinal();
}
}
/**
* [#12405] The common {@link SimpleFormatter} format to be set in all of
* jOOQ's CLIs.
*/
public static void initSimpleFormatter() {
if (System.getProperty("java.util.logging.SimpleFormatter.format") == null)
System.setProperty("java.util.logging.SimpleFormatter.format", "%1$tH:%1$tM:%1$tS %4$s %5$s%6$s%n");
}
}

View File

@ -57,7 +57,6 @@ import java.lang.reflect.ParameterizedType;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.IdentityHashMap;