| | |
| | | package org.opends.server.loggers; |
| | | |
| | | |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.types.FilePermission; |
| | | import org.opends.server.admin.std.server.SizeLimitLogRotationPolicyCfg; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; |
| | | import static org.opends.messages.LoggerMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.BufferedWriter; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStreamWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | import java.io.*; |
| | | import java.util.concurrent.CopyOnWriteArrayList; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Calendar; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.SizeLimitLogRotationPolicyCfg; |
| | | import org.opends.server.api.DirectoryThread; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.FilePermission; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | /** |
| | | * A MultiFileTextWriter is a specialized TextWriter which supports publishing |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | SizeLimitLogRotationPolicyCfg config, List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | SizeLimitLogRotationPolicyCfg config) |
| | | { |
| | |
| | | |
| | | sizeLimit = newSizeLimit; |
| | | |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false, |
| | | new ArrayList<LocalizableMessage>()); |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * the run method of the rotaterThread. It wakes up periodically and checks |
| | | * whether the file needs to be rotated based on the rotation policy. |
| | | */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | while(!isShuttingDown()) |
| | |
| | | * |
| | | * @return The human-readable name for this shutdown listener. |
| | | */ |
| | | @Override |
| | | public String getShutdownListenerName() |
| | | { |
| | | return "MultifileTextWriter Thread " + name; |
| | |
| | | * |
| | | * @param reason The human-readable reason for the shutdown. |
| | | */ |
| | | @Override |
| | | public void processServerShutdown(LocalizableMessage reason) |
| | | { |
| | | stopRequested = true; |
| | |
| | | /** |
| | | * Shutdown the text writer. |
| | | */ |
| | | @Override |
| | | public void shutdown() |
| | | { |
| | | processServerShutdown(null); |
| | |
| | | * |
| | | * @param record the log record to write. |
| | | */ |
| | | @Override |
| | | public void writeRecord(String record) |
| | | { |
| | | // Assume each character is 1 byte ASCII |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void flush() |
| | | { |
| | | try |