From: funkman Date: Mon, 1 Nov 2010 15:48:32 +0000 (+0000) Subject: bug 49180 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0654b725d41ab290a723269f46fec07f2f2f138a;p=tomcat7.0 bug 49180 Add option to disable log rotation in FileHandler credit: Pid (pidster at apache ) git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1029719 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/juli/FileHandler.java b/java/org/apache/juli/FileHandler.java index 90127aba9..cfae91b38 100644 --- a/java/org/apache/juli/FileHandler.java +++ b/java/org/apache/juli/FileHandler.java @@ -95,6 +95,12 @@ public class FileHandler /** + * Determines whether the logfile is rotatable + */ + private boolean rotatable = true; + + + /** * The PrintWriter to which we are currently logging, if any. */ private volatile PrintWriter writer = null; @@ -134,7 +140,7 @@ public class FileHandler writerLock.readLock().lock(); // If the date has changed, switch log files - if (!date.equals(tsDate)) { + if (rotatable && !date.equals(tsDate)) { // Update to writeLock before we switch writerLock.readLock().unlock(); writerLock.writeLock().lock(); @@ -245,6 +251,7 @@ public class FileHandler ClassLoader cl = Thread.currentThread().getContextClassLoader(); // Retrieve configuration of logging file name + rotatable = Boolean.parseBoolean(getProperty(className + ".rotatable", "true")); if (directory == null) directory = getProperty(className + ".directory", "logs"); if (prefix == null) @@ -326,7 +333,7 @@ public class FileHandler writerLock.writeLock().lock(); try { String pathname = dir.getAbsolutePath() + File.separator + - prefix + date + suffix; + prefix + (rotatable ? date : "") + suffix; String encoding = getEncoding(); FileOutputStream fos = new FileOutputStream(pathname, true); OutputStream os = bufferSize>0?new BufferedOutputStream(fos,bufferSize):fos;