| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | * new one named in accordance with a specified FileNamingPolicy. |
| | | */ |
| | | public class MultifileTextWriter |
| | | implements ServerShutdownListener, TextWriter, |
| | | implements ServerShutdownListener, TextWriter, RotatableLogFile, |
| | | ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg> |
| | | { |
| | | /** |
| | |
| | | outputStream = new MeteredStream(stream, file.length()); |
| | | |
| | | OutputStreamWriter osw = new OutputStreamWriter(outputStream, encoding); |
| | | BufferedWriter bw = null; |
| | | if(bufferSize <= 0) |
| | | { |
| | | writer = new BufferedWriter(osw); |
| | |
| | | this.actions = actions; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the number of bytes written to the current log file. |
| | | * |
| | | * @return The number of bytes written to the current log file. |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getBytesWritten() |
| | | { |
| | | return outputStream.written; |
| | |
| | | return lastCleanCount; |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the last time a log file was rotated in this instance of |
| | | * Directory Server. If a log rotation never |
| | | * occurred, this value will be the time the server started. |
| | | * |
| | | * @return The last time log rotation occurred. |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Calendar getLastRotationTime() |
| | | { |
| | | return lastRotationTime; |