Author: carnold Date: Fri Jun 13 14:50:06 2008 New Revision: 667661 URL: http://svn.apache.org/viewvc?rev=667661&view=rev Log: Bug 45165: finals, javadocs and package.html notice
Modified: logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/MultiFileAppender.java logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/package.html Modified: logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/MultiFileAppender.java URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/MultiFileAppender.java?rev=667661&r1=667660&r2=667661&view=diff ============================================================================== --- logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/MultiFileAppender.java (original) +++ logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/MultiFileAppender.java Fri Jun 13 14:50:06 2008 @@ -118,15 +118,19 @@ } /** - * - * @param layout - * @param defaultFileName - * @param fileNamePolicy - * @param bufferedIO - * @param bufferSize + * Create a MultiFileAppender. + * + * @param layout layout, may not be null. + * @param defaultFileName default file name, may not be null. + * @param fileNamePolicy file name policy, may not be null. + * @param bufferedIO use buffered io. + * @param bufferSize buffer size. */ - public MultiFileAppender(Layout layout, String defaultFileName, - FileNamePolicy fileNamePolicy, boolean bufferedIO, int bufferSize) { + public MultiFileAppender(final Layout layout, + final String defaultFileName, + final FileNamePolicy fileNamePolicy, + final boolean bufferedIO, + final int bufferSize) { this.layout = layout; this.setBufferedIO(bufferedIO); this.bufferSize = bufferSize; @@ -135,19 +139,24 @@ } /** + * Create a MultiFileAppender. * - * @param layout - * @param defaultFileName - * @param fileNamePolicy + * @param layout layout, may not be null. + * @param defaultFileName default file name, may not be null. + * @param fileNamePolicy file name policy, may not be null. */ - public MultiFileAppender(Layout layout, String defaultFileName, - FileNamePolicy fileNamePolicy) { + public MultiFileAppender(final Layout layout, + final String defaultFileName, + final FileNamePolicy fileNamePolicy) { this.layout = layout; this.defaultFileName = defaultFileName; this.fileNamePolicy = fileNamePolicy; } - public void append(LoggingEvent event) { + /** + * [EMAIL PROTECTED] + */ + public void append(final LoggingEvent event) { if (!checkEntryConditions()) { return; } @@ -172,7 +181,11 @@ cleanupIdleFiles(); } - protected boolean checkEntryConditions() { + /** + * Check preconditions for appending event. + * @return true if ready to append event. + */ + protected boolean checkEntryConditions() { if (this.closed) { LogLog.warn("Not allowed to write to a closed appender."); return false; @@ -186,15 +199,14 @@ } /** - * get the file and append log message + * Get the file and append log message. * - * @param fileName - * @param event + * @param fileName file name, may not be null. + * @param event event, may not be null. */ - protected void subAppend(String fileName, LoggingEvent event) { - LogFileEntry lfe; + protected void subAppend(final String fileName, final LoggingEvent event) { // is the file already open - lfe = (LogFileEntry) openFileMap.get(fileName); + LogFileEntry lfe = (LogFileEntry) openFileMap.get(fileName); // else open/create the new file if (null == lfe) { lfe = openFile(fileName); @@ -212,7 +224,13 @@ } } - protected void subAppendToWriter(QuietWriter qw, LoggingEvent event) { + /** + * Layout event and any throwable and append to writer. + * + * @param qw writer. + * @param event logging event, may not be null. + */ + protected void subAppendToWriter(final QuietWriter qw, final LoggingEvent event) { qw.write(this.layout.format(event)); if (layout.ignoresThrowable()) { @@ -273,7 +291,7 @@ openFileMap.clear(); } - protected LogFileEntry openFile(String fileName) { + protected LogFileEntry openFile(final String fileName) { FileOutputStream ostream = null; try { // @@ -324,8 +342,9 @@ /** * Write a footer as produced by the embedded layout's [EMAIL PROTECTED] * Layout#getFooter} method. + * @param qw writer. */ - protected void writeFooter(QuietWriter qw) { + protected void writeFooter(final QuietWriter qw) { if (layout != null) { String f = layout.getFooter(); if (f != null && qw != null) { @@ -338,8 +357,9 @@ /** * Write a header as produced by the embedded layout's [EMAIL PROTECTED] * Layout#getHeader} method. + * @param qw writer. */ - protected void writeHeader(QuietWriter qw) { + protected void writeHeader(final QuietWriter qw) { if (layout != null) { String h = layout.getHeader(); if (h != null && qw != null) @@ -354,7 +374,7 @@ * using the default system encoding (an error message will be printed to * the loglog. */ - protected OutputStreamWriter createWriter(OutputStream os) { + protected OutputStreamWriter createWriter(final OutputStream os) { OutputStreamWriter retval = null; String enc = getEncoding(); @@ -372,7 +392,7 @@ return retval; } - protected void closeFile(LogFileEntry logFile) { + protected void closeFile(final LogFileEntry logFile) { writeFooter(logFile.getQw()); try { @@ -391,7 +411,7 @@ return bufferedIO; } - public void setBufferedIO(boolean bufferedIO) { + public void setBufferedIO(final boolean bufferedIO) { this.bufferedIO = bufferedIO; if (bufferedIO) { this.immediateFlush = false; @@ -402,7 +422,7 @@ return bufferSize; } - public void setBufferSize(int bufferSize) { + public void setBufferSize(final int bufferSize) { this.bufferSize = bufferSize; } @@ -410,7 +430,7 @@ return defaultFileName; } - public void setDefaultFileName(String defaultFileName) { + public void setDefaultFileName(final String defaultFileName) { this.defaultFileName = defaultFileName.trim(); } @@ -418,7 +438,7 @@ return encoding; } - public void setEncoding(String encoding) { + public void setEncoding(final String encoding) { this.encoding = encoding; } @@ -426,7 +446,7 @@ return idleTime; } - public void setIdleTime(long idleTime) { + public void setIdleTime(final long idleTime) { this.idleTime = idleTime; } @@ -434,7 +454,7 @@ return immediateFlush; } - public void setImmediateFlush(boolean immediateFlush) { + public void setImmediateFlush(final boolean immediateFlush) { this.immediateFlush = immediateFlush; } @@ -442,7 +462,7 @@ return maxOpenFiles; } - public void setMaxOpenFiles(int openFileLimit) { + public void setMaxOpenFiles(final int openFileLimit) { this.maxOpenFiles = openFileLimit; } @@ -450,7 +470,7 @@ return fileNamePolicy; } - public void setFileNamePolicy(FileNamePolicy fileNamePolicy) { + public void setFileNamePolicy(final FileNamePolicy fileNamePolicy) { this.fileNamePolicy = fileNamePolicy; } @@ -458,7 +478,7 @@ // do nothing } - protected void fireFileAppendedEvent(String fileName, long fileSize) { + protected void fireFileAppendedEvent(final String fileName, final long fileSize) { Iterator listenerIt = this.listeners.iterator(); while (listenerIt.hasNext()) { ((MultiFileAppenderListener) listenerIt.next()).fileAppended( @@ -469,19 +489,19 @@ /** * Add a MultiFileAppenderListener to this MultiFileAppender * - * @param listener + * @param listener listern to add, may not be null. */ - public void addMultiFileAppenderListener(MultiFileAppenderListener listener) { + public void addMultiFileAppenderListener(final MultiFileAppenderListener listener) { this.listeners.add(listener); } /** * Remove a MultiFileAppenderListener from this MultiFileAppender * - * @param listener + * @param listener listener to add, may not be null. */ public void removeMultiFileAppenderListener( - MultiFileAppenderListener listener) { + final MultiFileAppenderListener listener) { this.listeners.remove(listener); } @@ -493,7 +513,7 @@ private Date lastAccess; - public LogFileEntry(String fileName, CountingQuietWriter qw) { + public LogFileEntry(final String fileName, final CountingQuietWriter qw) { this.fileName = fileName; this.qw = qw; this.lastAccess = new Date(); @@ -503,7 +523,7 @@ return fileName; } - public void setFileName(String fileName) { + public void setFileName(final String fileName) { this.fileName = fileName; } @@ -511,7 +531,7 @@ return lastAccess; } - public void setLastAccess(Date lastAccess) { + public void setLastAccess(final Date lastAccess) { this.lastAccess = lastAccess; } @@ -519,7 +539,7 @@ return qw; } - public void setQw(CountingQuietWriter qw) { + public void setQw(final CountingQuietWriter qw) { this.qw = qw; } } Modified: logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/package.html URL: http://svn.apache.org/viewvc/logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/package.html?rev=667661&r1=667660&r2=667661&view=diff ============================================================================== --- logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/package.html (original) +++ logging/sandbox/log4j/multifile/src/main/java/org/apache/log4j/multifile/package.html Fri Jun 13 14:50:06 2008 @@ -2,19 +2,21 @@ <html> <head> <!-- - Copyright 2006 The Apache Software Foundation. + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 - http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --> </head> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]