Lines 50-55
Link Here
|
50 |
* specify an absolute path for this property, |
50 |
* specify an absolute path for this property, |
51 |
* <code>${catalina.base}/logs</code> |
51 |
* <code>${catalina.base}/logs</code> |
52 |
* Default value: <code>logs</code></li> |
52 |
* Default value: <code>logs</code></li> |
|
|
53 |
* <li><code>rotatable</code> - If <code>true</code>, the log file will be |
54 |
* rotated on the first write past midnight and the filename will be |
55 |
* <code>{prefix}{date}{suffix}</code>, where date is yyyy-MM-dd. If <code>false</code>, |
56 |
* the file will not be rotated and the filename will be <code>{prefix}{suffix}</code>. |
57 |
* Default value: <code>true</code></li> |
53 |
* <li><code>prefix</code> - The leading part of the log file name. |
58 |
* <li><code>prefix</code> - The leading part of the log file name. |
54 |
* Default value: <code>juli.</code></li> |
59 |
* Default value: <code>juli.</code></li> |
55 |
* <li><code>suffix</code> - The trailing part of the log file name. Default value: <code>.log</code></li> |
60 |
* <li><code>suffix</code> - The trailing part of the log file name. Default value: <code>.log</code></li> |
Lines 124-129
Link Here
|
124 |
|
129 |
|
125 |
|
130 |
|
126 |
/** |
131 |
/** |
|
|
132 |
* Determines whether the logfile is rotatable |
133 |
*/ |
134 |
private boolean rotatable = true; |
135 |
|
136 |
|
137 |
/** |
127 |
* The PrintWriter to which we are currently logging, if any. |
138 |
* The PrintWriter to which we are currently logging, if any. |
128 |
*/ |
139 |
*/ |
129 |
private volatile PrintWriter writer = null; |
140 |
private volatile PrintWriter writer = null; |
Lines 162-168
Link Here
|
162 |
|
173 |
|
163 |
writerLock.readLock().lock(); |
174 |
writerLock.readLock().lock(); |
164 |
// If the date has changed, switch log files |
175 |
// If the date has changed, switch log files |
165 |
if (!date.equals(tsDate)) { |
176 |
if (rotatable && !date.equals(tsDate)) { |
166 |
// Update to writeLock before we switch |
177 |
// Update to writeLock before we switch |
167 |
writerLock.readLock().unlock(); |
178 |
writerLock.readLock().unlock(); |
168 |
writerLock.writeLock().lock(); |
179 |
writerLock.writeLock().lock(); |
Lines 271-276
Link Here
|
271 |
ClassLoader cl = Thread.currentThread().getContextClassLoader(); |
282 |
ClassLoader cl = Thread.currentThread().getContextClassLoader(); |
272 |
|
283 |
|
273 |
// Retrieve configuration of logging file name |
284 |
// Retrieve configuration of logging file name |
|
|
285 |
rotatable = Boolean.parseBoolean(getProperty(className + ".rotatable", "true")); |
274 |
if (directory == null) |
286 |
if (directory == null) |
275 |
directory = getProperty(className + ".directory", "logs"); |
287 |
directory = getProperty(className + ".directory", "logs"); |
276 |
if (prefix == null) |
288 |
if (prefix == null) |
Lines 352-358
Link Here
|
352 |
writerLock.writeLock().lock(); |
364 |
writerLock.writeLock().lock(); |
353 |
try { |
365 |
try { |
354 |
String pathname = dir.getAbsolutePath() + File.separator + |
366 |
String pathname = dir.getAbsolutePath() + File.separator + |
355 |
prefix + date + suffix; |
367 |
prefix + (rotatable ? date : "") + suffix; |
356 |
String encoding = getEncoding(); |
368 |
String encoding = getEncoding(); |
357 |
FileOutputStream fos = new FileOutputStream(pathname, true); |
369 |
FileOutputStream fos = new FileOutputStream(pathname, true); |
358 |
OutputStream os = bufferSize>0?new BufferedOutputStream(fos,bufferSize):fos; |
370 |
OutputStream os = bufferSize>0?new BufferedOutputStream(fos,bufferSize):fos; |