"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java" between
apache-log4j-2.11.1-src.tar.gz and apache-log4j-2.11.2-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).

DefaultRolloverStrategy.java  (apache-log4j-2.11.1-src):DefaultRolloverStrategy.java  (apache-log4j-2.11.2-src)
skipping to change at line 146 skipping to change at line 146
if (max != null) { if (max != null) {
maxIndex = Integer.parseInt(max); maxIndex = Integer.parseInt(max);
if (maxIndex < minIndex) { if (maxIndex < minIndex) {
maxIndex = minIndex < DEFAULT_WINDOW_SIZE ? DEFAULT_WIND OW_SIZE : minIndex; maxIndex = minIndex < DEFAULT_WINDOW_SIZE ? DEFAULT_WIND OW_SIZE : minIndex;
LOGGER.error("Maximum window size must be greater than t he minimum windows size. Set to " + maxIndex); LOGGER.error("Maximum window size must be greater than t he minimum windows size. Set to " + maxIndex);
} }
} }
} }
final int compressionLevel = Integers.parseInt(compressionLevelStr, Deflater.DEFAULT_COMPRESSION); final int compressionLevel = Integers.parseInt(compressionLevelStr, Deflater.DEFAULT_COMPRESSION);
// The config object can be null when this object is built programma tically. // The config object can be null when this object is built programma tically.
StrSubstitutor nonNullStrSubstitutor = config != null ? config.getSt rSubstitutor() : new StrSubstitutor(); final StrSubstitutor nonNullStrSubstitutor = config != null ? config .getStrSubstitutor() : new StrSubstitutor();
return new DefaultRolloverStrategy(minIndex, maxIndex, us eMax, compressionLevel, nonNullStrSubstitutor, return new DefaultRolloverStrategy(minIndex, maxIndex, us eMax, compressionLevel, nonNullStrSubstitutor,
customActions, stopCustomActionsOnError, tempCompressedFileP attern); customActions, stopCustomActionsOnError, tempCompressedFileP attern);
} }
public String getMax() { public String getMax() {
return max; return max;
} }
/** /**
* Defines the maximum number of files to keep. * Defines the maximum number of files to keep.
skipping to change at line 520 skipping to change at line 520
/** /**
* Performs the rollover. * Performs the rollover.
* *
* @param manager The RollingFileManager name for current active log file. * @param manager The RollingFileManager name for current active log file.
* @return A RolloverDescription. * @return A RolloverDescription.
* @throws SecurityException if an error occurs. * @throws SecurityException if an error occurs.
*/ */
@Override @Override
public RolloverDescription rollover(final RollingFileManager manager) throws SecurityException { public RolloverDescription rollover(final RollingFileManager manager) throws SecurityException {
int fileIndex; int fileIndex;
final StringBuilder buf = new StringBuilder(255);
if (minIndex == Integer.MIN_VALUE) { if (minIndex == Integer.MIN_VALUE) {
final SortedMap<Integer, Path> eligibleFiles = getEligibleFiles(mana ger); final SortedMap<Integer, Path> eligibleFiles = getEligibleFiles(mana ger);
fileIndex = eligibleFiles.size() > 0 ? eligibleFiles.lastKey() + 1 : 1; fileIndex = eligibleFiles.size() > 0 ? eligibleFiles.lastKey() + 1 : 1;
manager.getPatternProcessor().formatFileName(strSubstitut or, buf, fileIndex);
} else { } else {
if (maxIndex < 0) { if (maxIndex < 0) {
return null; return null;
} }
final long startNanos = System.nanoTime(); final long startNanos = System.nanoTime();
fileIndex = purge(minIndex, maxIndex, manager); fileIndex = purge(minIndex, maxIndex, manager);
if (fileIndex < 0) { if (fileIndex < 0) {
return null; return null;
} }
manager.getPatternProcessor().formatFileName(strSubstitut or, buf, fileIndex);
if (LOGGER.isTraceEnabled()) { if (LOGGER.isTraceEnabled()) {
final double durationMillis = TimeUnit.NANOSECONDS.toMillis(Syst em.nanoTime() - startNanos); final double durationMillis = TimeUnit.NANOSECONDS.toMillis(Syst em.nanoTime() - startNanos);
LOGGER.trace("DefaultRolloverStrategy.purge() took {} millisecon ds", durationMillis); LOGGER.trace("DefaultRolloverStrategy.purge() took {} millisecon ds", durationMillis);
} }
} }
final StringBuilder buf = new StringBuilder(255);
manager.getPatternProcessor().formatFileName(strSubstitutor, buf, fileIn
dex);
final String currentFileName = manager.getFileName(); final String currentFileName = manager.getFileName();
String renameTo = buf.toString(); String renameTo = buf.toString();
final String compressedName = renameTo; final String compressedName = renameTo;
Action compressAction = null; Action compressAction = null;
final FileExtension fileExtension = manager.getFileExtension(); final FileExtension fileExtension = manager.getFileExtension();
if (fileExtension != null) { if (fileExtension != null) {
final File renameToFile = new File(renameTo); final File renameToFile = new File(renameTo);
renameTo = renameTo.substring(0, renameTo.length() - fileExtension.l ength()); renameTo = renameTo.substring(0, renameTo.length() - fileExtension.l ength());
 End of changes. 5 change blocks. 
4 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)