You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/04/18 16:07:18 UTC
svn commit: r1094584 - in /tomcat/tc6.0.x/trunk: STATUS.txt
java/org/apache/juli/FileHandler.java webapps/docs/changelog.xml
Author: markt
Date: Mon Apr 18 14:07:18 2011
New Revision: 1094584
URL: http://svn.apache.org/viewvc?rev=1094584&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49180
Add option to disable log rotation in juli FileHandler
Modified:
tomcat/tc6.0.x/trunk/STATUS.txt
tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1094584&r1=1094583&r2=1094584&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Apr 18 14:07:18 2011
@@ -144,12 +144,6 @@ PATCHES PROPOSED TO BACKPORT:
+1: markt
-1:
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49180
- Add option to disable log rotation in juli FileHandler
- https://issues.apache.org/bugzilla/attachment.cgi?id=26844
- +1: kkolinko, markt, kfujino
- -1:
-
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47880
Clarify error messages in *.sh files to mention that if a script is not
found it might be because execute permission is needed.
Modified: tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java?rev=1094584&r1=1094583&r2=1094584&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java Mon Apr 18 14:07:18 2011
@@ -50,6 +50,11 @@ import java.util.logging.SimpleFormatter
* specify an absolute path for this property,
* <code>${catalina.base}/logs</code>
* Default value: <code>logs</code></li>
+ * <li><code>rotatable</code> - If <code>true</code>, the log file will be
+ * rotated on the first write past midnight and the filename will be
+ * <code>{prefix}{date}{suffix}</code>, where date is yyyy-MM-dd. If <code>false</code>,
+ * the file will not be rotated and the filename will be <code>{prefix}{suffix}</code>.
+ * Default value: <code>true</code></li>
* <li><code>prefix</code> - The leading part of the log file name.
* Default value: <code>juli.</code></li>
* <li><code>suffix</code> - The trailing part of the log file name. Default value: <code>.log</code></li>
@@ -124,6 +129,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;
@@ -162,7 +173,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();
@@ -271,6 +282,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)
@@ -352,7 +364,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;
Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1094584&r1=1094583&r2=1094584&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Mon Apr 18 14:07:18 2011
@@ -88,6 +88,10 @@
Remove unnecessary whitespace from MIME mapping entries in global
web.xml file. (markt)
</fix>
+ <add>
+ <bug>49180</bug>: Add an option to disable file rotation in JULI
+ FileHandler. (kkolinko)
+ </add>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org