This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new dcc2773 Align with master/9.0.x dcc2773 is described below commit dcc2773b8ab86d6d74eed17b58c018cabded21c6 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Jan 16 18:21:13 2020 +0000 Align with master/9.0.x Clean-up Remove references to org.apache.juli.JdkLoggerConfig (Tomcat Lite era) --- java/org/apache/juli/AsyncFileHandler.java | 6 +----- java/org/apache/juli/FileHandler.java | 9 +++++---- java/org/apache/juli/logging/DirectJDKLog.java | 17 +++++------------ 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/java/org/apache/juli/AsyncFileHandler.java b/java/org/apache/juli/AsyncFileHandler.java index cfd685d..20a9e16 100644 --- a/java/org/apache/juli/AsyncFileHandler.java +++ b/java/org/apache/juli/AsyncFileHandler.java @@ -147,7 +147,6 @@ public class AsyncFileHandler extends FileHandler { } protected static class LoggerThread extends Thread { - protected final boolean run = true; public LoggerThread() { this.setDaemon(true); this.setName("AsyncFileHandlerWriter-" + System.identityHashCode(this)); @@ -155,7 +154,7 @@ public class AsyncFileHandler extends FileHandler { @Override public void run() { - while (run) { + while (true) { try { LogEntry entry = queue.poll(LOGGER_SLEEP_TIME, TimeUnit.MILLISECONDS); if (entry != null) { @@ -187,8 +186,5 @@ public class AsyncFileHandler extends FileHandler { return true; } } - } - - } diff --git a/java/org/apache/juli/FileHandler.java b/java/org/apache/juli/FileHandler.java index 0d62c92..a437f6a 100644 --- a/java/org/apache/juli/FileHandler.java +++ b/java/org/apache/juli/FileHandler.java @@ -95,14 +95,15 @@ import java.util.regex.Pattern; * </ul> */ public class FileHandler extends Handler { + public static final int DEFAULT_MAX_DAYS = -1; private static final ExecutorService DELETE_FILES_SERVICE = Executors.newSingleThreadExecutor(new ThreadFactory() { + private static final String NAME_PREFIX = "FileHandlerLogFilesCleaner-"; private final boolean isSecurityEnabled; private final ThreadGroup group; private final AtomicInteger threadNumber = new AtomicInteger(1); - private final String namePrefix = "FileHandlerLogFilesCleaner-"; { SecurityManager s = System.getSecurityManager(); @@ -135,7 +136,7 @@ public class FileHandler extends Handler { .setContextClassLoader(getClass().getClassLoader()); } Thread t = new Thread(group, r, - namePrefix + threadNumber.getAndIncrement()); + NAME_PREFIX + threadNumber.getAndIncrement()); t.setDaemon(true); return t; } finally { @@ -370,8 +371,7 @@ public class FileHandler extends Handler { private void configure() { Timestamp ts = new Timestamp(System.currentTimeMillis()); - String tsString = ts.toString().substring(0, 19); - date = tsString.substring(0, 10); + date = ts.toString().substring(0, 10); String className = this.getClass().getName(); //allow classes to override @@ -415,6 +415,7 @@ public class FileHandler extends Handler { } catch (NumberFormatException ignore) { //no op } + // Get encoding for the logging file String encoding = getProperty(className + ".encoding", null); if (encoding != null && encoding.length() > 0) { diff --git a/java/org/apache/juli/logging/DirectJDKLog.java b/java/org/apache/juli/logging/DirectJDKLog.java index 2e38563..adf9177 100644 --- a/java/org/apache/juli/logging/DirectJDKLog.java +++ b/java/org/apache/juli/logging/DirectJDKLog.java @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.juli.logging; import java.util.logging.ConsoleHandler; @@ -24,28 +23,22 @@ import java.util.logging.Level; import java.util.logging.Logger; /** - * Hardcoded java.util.logging commons-logging implementation. + * Hard-coded java.util.logging commons-logging implementation. */ class DirectJDKLog implements Log { // no reason to hide this - but good reasons to not hide public final Logger logger; - /** Alternate config reader and console format - */ + // Alternate config reader and console format private static final String SIMPLE_FMT="java.util.logging.SimpleFormatter"; - private static final String SIMPLE_CFG="org.apache.juli.JdkLoggerConfig"; //doesn't exist private static final String FORMATTER="org.apache.juli.formatter"; static { - if( System.getProperty("java.util.logging.config.class") ==null && - System.getProperty("java.util.logging.config.file") ==null ) { + if (System.getProperty("java.util.logging.config.class") == null && + System.getProperty("java.util.logging.config.file") == null) { // default configuration - it sucks. Let's override at least the // formatter for the console try { - Class.forName(SIMPLE_CFG).getConstructor().newInstance(); - } catch( Throwable t ) { - } - try { Formatter fmt= (Formatter) Class.forName(System.getProperty( FORMATTER, SIMPLE_FMT)).getConstructor().newInstance(); // it is also possible that the user modified jre/lib/logging.properties - @@ -57,7 +50,7 @@ class DirectJDKLog implements Log { handler.setFormatter(fmt); } } - } catch( Throwable t ) { + } catch (Throwable t) { // maybe it wasn't included - the ugly default will be used. } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org