From 6dc91f889744c17a9a0d8a7c92276b62dea25941 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 03 May 2007 21:55:23 +0000
Subject: [PATCH] Major changes made to the logging framework. It should resolve the following issues:
---
opendj-sdk/opends/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java | 2
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogPublisher.java | 101
opendj-sdk/opends/src/server/org/opends/server/schema/CertificateListSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/core/BackendConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/EntryCacheConfigManager.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedErrorLogPublisherConfiguration.xml | 238
opendj-sdk/opends/src/server/org/opends/server/loggers/ErrorLogger.java | 444 +
opendj-sdk/opends/src/server/org/opends/server/types/SearchFilter.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TraceSettings.java | 141
opendj-sdk/opends/src/server/org/opends/server/schema/UTCTimeSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/CertificateMapperConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/SASLConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java | 4
opendj-sdk/opends/src/server/org/opends/server/schema/PostalAddressSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/loggers/TimeLimitRotationPolicy.java | 67
opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRotationPolicy.java | 63
opendj-sdk/opends/src/server/org/opends/server/core/MonitorConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/OtherMailboxSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java | 528 +
opendj-sdk/opends/src/server/org/opends/server/schema/SubstringAssertionSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java | 875 +++
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/TimeLimitLogRotationPolicyConfiguration.xml | 34
opendj-sdk/opends/src/server/org/opends/server/config/IntegerConfigAttribute.java | 4
opendj-sdk/opends/src/server/org/opends/server/types/Schema.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexRebuildThread.java | 2
opendj-sdk/opends/src/server/org/opends/server/tools/BackUpDB.java | 260
opendj-sdk/opends/src/server/org/opends/server/api/DebugLogPublisher.java | 476 +
opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java | 6
opendj-sdk/opends/src/server/org/opends/server/loggers/TextWriter.java | 151
opendj-sdk/opends/src/server/org/opends/server/replication/server/DbHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/MatchingRuleSyntax.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FixedTimeLogRotationPolicyConfiguration.xml | 43
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexMergeThread.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/BooleanSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskScheduler.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java | 196
opendj-sdk/opends/src/server/org/opends/server/tools/VerifyIndex.java | 96
opendj-sdk/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java | 848 +-
opendj-sdk/opends/src/server/org/opends/server/loggers/AsyncronousTextWriter.java | 267 +
opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleIntrospection.java | 4
opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java | 119
opendj-sdk/opends/src/server/org/opends/server/schema/CountryStringSyntax.java | 2
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestListener.java | 37
opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/FreeDiskSpaceRetentionPolicy.java | 88
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/StressTest.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/IntegerSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroup.java | 2
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/TelephoneNumberSyntax.java | 2
opendj-sdk/opends/resource/schema/02-config.ldif | 191
opendj-sdk/opends/src/server/org/opends/server/schema/CertificateSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidator.java | 4
opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java | 4
opendj-sdk/opends/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/config/StringConfigAttribute.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/LogRetentionPolicyConfigManager.java | 292 +
opendj-sdk/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml | 238
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/BinarySyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/TimeStampNaming.java | 54
opendj-sdk/opends/src/server/org/opends/server/types/Entry.java | 2
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/DNS.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/RootDNConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/PasswordValidatorConfigManager.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogRetentionPolicyConfiguration.xml | 41
opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java | 6
opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/StaticGroup.java | 2
opendj-sdk/opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java | 2
opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleClient.java | 4
opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java | 7
opendj-sdk/opends/src/server/org/opends/server/schema/GuideSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/RFC3672SubtreeSpecificationSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/MD5PasswordStorageScheme.java | 2
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/RootDSEBackend.java | 2
opendj-sdk/opends/src/server/org/opends/server/messages/LoggerMessages.java | 148
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java | 4
opendj-sdk/opends/src/server/org/opends/server/core/VirtualAttributeConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/RotationPolicy.java | 31
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ImportJob.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/EntryCacheCommon.java | 2
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDB.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/SizeLimitLogRotationPolicyConfiguration.xml | 34
opendj-sdk/opends/src/server/org/opends/server/loggers/FileNumberRetentionPolicy.java | 78
opendj-sdk/opends/src/server/org/opends/server/schema/AciSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordSyntax.java | 4
opendj-sdk/opends/src/server/org/opends/server/core/IdentityMapperConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/DirectoryStringSyntax.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogPublisherConfiguration.xml | 35
opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciListenerManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/UUIDSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java | 4
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java | 2
opendj-sdk/opends/src/server/org/opends/server/config/DNConfigAttribute.java | 4
opendj-sdk/opends/src/server/org/opends/server/core/AccessControlConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugMessageFormatter.java | 35
opendj-sdk/opends/src/server/org/opends/server/core/LogRotationPolicyConfigManager.java | 291 +
opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java | 99
opendj-sdk/opends/src/server/org/opends/server/schema/PresentationAddressSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/schema/RelativeSubtreeSpecificationSyntax.java | 2
opendj-sdk/opends/tests/unit-tests-testng/resource/config-changes.ldif | 5
opendj-sdk/opends/src/server/org/opends/server/tools/RestoreDB.java | 30
opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRetentionPolicy.java | 87
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/VerifyJob.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/PrintableStringSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/config/MultiChoiceConfigAttribute.java | 4
opendj-sdk/opends/src/server/org/opends/server/util/Validator.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileCountLogRetentionPolicyConfiguration.xml | 34
opendj-sdk/opends/src/server/org/opends/server/config/ReadOnlyConfigAttribute.java | 3
opendj-sdk/opends/src/server/org/opends/server/schema/FaxNumberSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java | 4
opendj-sdk/opends/src/server/org/opends/server/loggers/MultifileTextWriter.java | 615 +
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java | 65
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RootContainer.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/JPEGSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java | 2
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroupSearchThread.java | 2
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ListenerThread.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageScheme.java | 2
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java | 2
opendj-sdk/opends/src/server/org/opends/server/messages/ConfigMessages.java | 75
opendj-sdk/opends/src/server/org/opends/server/tasks/BackupTask.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/FixedTimeRotationPolicy.java | 148
opendj-sdk/opends/src/server/org/opends/server/schema/TelexNumberSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java | 4
opendj-sdk/opends/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackupManager.java | 2
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java | 592 ++
opendj-sdk/opends/src/server/org/opends/server/schema/DeliveryMethodSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/api/AccessLogPublisher.java | 138
opendj-sdk/opends/src/server/org/opends/server/schema/BitStringSyntax.java | 4
opendj-sdk/opends/src/server/org/opends/server/core/LoggerConfigManager.java | 1324 ----
opendj-sdk/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java | 2
opendj-sdk/opends/src/server/org/opends/server/config/IntegerWithUnitConfigAttribute.java | 4
opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java | 4
opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java | 5
opendj-sdk/opends/src/server/org/opends/server/loggers/FileNamingPolicy.java | 18
opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RebuildJob.java | 2
opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageScheme.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ExportJob.java | 2
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java | 2
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java | 2
opendj-sdk/opends/src/server/org/opends/server/tools/ImportLDIF.java | 30
opendj-sdk/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugTracer.java | 1049 ++++
opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java | 31
opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Config.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/RetentionPolicy.java | 33
opendj-sdk/opends/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/tasks/TaskUtils.java | 42
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/AccessLogPublisherConfiguration.xml | 62
opendj-sdk/opends/src/server/org/opends/server/tools/BackendToolUtils.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogRotationPolicyConfiguration.xml | 41
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/ErrorLogPublisherConfiguration.xml | 155
opendj-sdk/opends/src/server/org/opends/server/schema/FaxSyntax.java | 3
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/RootConfiguration.xml | 24
opendj-sdk/opends/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/PluginConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java | 2
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestTextWriter.java | 62
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java | 2
opendj-sdk/opends/src/server/org/opends/server/util/LDIFReader.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/OIDSyntax.java | 3
opendj-sdk/opends/resource/config/config.ldif | 138
opendj-sdk/opends/src/server/org/opends/server/core/GroupManager.java | 4
opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java | 16
opendj-sdk/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java | 4
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/SizeLimitLogRetentionPolicyConfiguration.xml | 35
opendj-sdk/opends/src/server/org/opends/server/loggers/AccessLogger.java | 778 +++
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/DebugTargetConfiguration.xml | 248 +
opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfilerPlugin.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/DistinguishedNameSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/CoreConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/IA5StringSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/config/JMXMBean.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/ProtocolInformationSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/tasks/ExportTask.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java | 2
opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java | 870 +++
opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageScheme.java | 2
opendj-sdk/opends/src/server/org/opends/server/schema/EnhancedGuideSyntax.java | 2
opendj-sdk/opends/src/server/org/opends/server/loggers/ThreadFilterTextErrorLogPublisher.java | 101
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml | 238
opendj-sdk/opends/src/server/org/opends/server/schema/OctetStringSyntax.java | 3
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FreeDiskSpaceLogRetentionPolicyConfiguration.xml | 35
opendj-sdk/opends/src/server/org/opends/server/loggers/RotationActionThread.java | 12
opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java | 72
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationCache.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java | 2
opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java | 2
opendj-sdk/opends/resource/admin/example-plugin/ExamplePlugin.java | 2
/dev/null | 179
opendj-sdk/opends/src/server/org/opends/server/schema/CertificatePairSyntax.java | 3
opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java | 2
opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/DebugLogPublisherConfiguration.xml | 254 +
opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java | 2
237 files changed, 11,427 insertions(+), 3,251 deletions(-)
diff --git a/opendj-sdk/opends/resource/admin/example-plugin/ExamplePlugin.java b/opendj-sdk/opends/resource/admin/example-plugin/ExamplePlugin.java
index adf80cc..5bda58d 100644
--- a/opendj-sdk/opends/resource/admin/example-plugin/ExamplePlugin.java
+++ b/opendj-sdk/opends/resource/admin/example-plugin/ExamplePlugin.java
@@ -28,7 +28,7 @@
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import java.util.List;
import java.util.Set;
diff --git a/opendj-sdk/opends/resource/config/config.ldif b/opendj-sdk/opends/resource/config/config.ldif
index 9f0df6d..8fce081 100644
--- a/opendj-sdk/opends/resource/config/config.ldif
+++ b/opendj-sdk/opends/resource/config/config.ldif
@@ -504,14 +504,15 @@
objectClass: ds-cfg-access-logger
objectClass: ds-cfg-file-based-access-logger
cn: File-Based Access Logger
-ds-cfg-logger-class: org.opends.server.loggers.DirectoryAccessLogger
+ds-cfg-logger-class: org.opends.server.loggers.TextAccessLogPublisher
ds-cfg-logger-enabled: true
ds-cfg-log-file: logs/access
+ds-cfg-log-file-mode: 640
ds-cfg-suppress-internal-operations: true
-ds-cfg-rotation-policy: Size
-ds-cfg-rotation-policy: FixedTime
-ds-cfg-size-limit: 104857600
-ds-cfg-fixed-time-limit: 86400000
+ds-cfg-asynchronous-writes: true
+ds-cfg-rotation-policy-dn: cn=24 Hours Time Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+ds-cfg-rotation-policy-dn: cn=Size Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+ds-cfg-retention-policy-dn: cn=File Count Retention Policy,cn=Log Retention Policies,cn=config
dn: cn=File-Based Audit Logger,cn=Loggers,cn=config
objectClass: top
@@ -519,26 +520,15 @@
objectClass: ds-cfg-access-logger
objectClass: ds-cfg-file-based-access-logger
cn: File-Based Audit Logger
-ds-cfg-logger-class: org.opends.server.loggers.DirectoryAuditLogger
-ds-cfg-logger-enabled: false
-ds-cfg-log-file: logs/audit
-ds-cfg-suppress-internal-operations: true
-ds-cfg-rotation-policy: Size
-ds-cfg-rotation-policy: FixedTime
-ds-cfg-size-limit: 104857600
-ds-cfg-fixed-time-limit: 86400000
-
-dn: cn=File-Based Debug Logger,cn=Loggers,cn=config
-objectClass: top
-objectClass: ds-cfg-logger
-objectClass: ds-cfg-debug-logger
-objectClass: ds-cfg-file-based-debug-logger
-cn: File-Based Debug Logger
-ds-cfg-logger-class: org.opends.server.loggers.DirectoryDebugLogger
+ds-cfg-logger-class: org.opends.server.loggers.TextAuditLogPublisher
ds-cfg-logger-enabled: true
-ds-cfg-log-file: logs/debug
-ds-cfg-default-severity: ERROR
-ds-cfg-default-severity: WARNING
+ds-cfg-log-file: logs/audit
+ds-cfg-log-file-mode: 640
+ds-cfg-suppress-internal-operations: true
+ds-cfg-asynchronous-writes: true
+ds-cfg-rotation-policy-dn: cn=24 Hours Time Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+ds-cfg-rotation-policy-dn: cn=Size Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+ds-cfg-retention-policy-dn: cn=File Count Retention Policy,cn=Log Retention Policies,cn=config
dn: cn=File-Based Error Logger,cn=Loggers,cn=config
objectClass: top
@@ -546,17 +536,97 @@
objectClass: ds-cfg-error-logger
objectClass: ds-cfg-file-based-error-logger
cn: File-Based Error Logger
-ds-cfg-logger-class: org.opends.server.loggers.DirectoryErrorLogger
+ds-cfg-logger-class: org.opends.server.loggers.TextErrorLogPublisher
ds-cfg-logger-enabled: true
-ds-cfg-log-file: logs/errors
-ds-cfg-default-severity: FATAL_ERROR
-ds-cfg-default-severity: NOTICE
-ds-cfg-default-severity: SEVERE_ERROR
-ds-cfg-default-severity: SEVERE_WARNING
-ds-cfg-rotation-policy: Size
-ds-cfg-rotation-policy: FixedTime
-ds-cfg-size-limit: 104857600
-ds-cfg-fixed-time-limit: 86400000
+ds-cfg-log-file: logs/error
+ds-cfg-log-file-mode: 640
+ds-cfg-default-severity: severe-warning
+ds-cfg-default-severity: severe-error
+ds-cfg-default-severity: fatal-error
+ds-cfg-default-severity: notice
+ds-cfg-asynchronous-writes: false
+ds-cfg-rotation-policy-dn: cn=7 Days Time Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+ds-cfg-rotation-policy-dn: cn=Size Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+ds-cfg-retention-policy-dn: cn=File Count Retention Policy,cn=Log Retention Policies,cn=config
+
+dn: cn=File-Based Debug Logger,cn=Loggers,cn=config
+objectClass: top
+objectClass: ds-cfg-logger
+objectClass: ds-cfg-debug-logger
+objectClass: ds-cfg-file-based-debug-logger
+cn: File-Based Debug Logger
+ds-cfg-logger-class: org.opends.server.loggers.debug.TextDebugLogPublisher
+ds-cfg-logger-enabled: false
+ds-cfg-log-file: logs/debug
+ds-cfg-log-file-mode: 640
+ds-cfg-default-debug-level: error
+ds-cfg-asynchronous-writes: false
+
+dn: cn=Log Rotation Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-branch
+cn: Log Rotation Policies
+
+dn: cn=24 Hours Time Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-log-rotation-policy
+objectClass: ds-cfg-time-limit-log-rotation-policy
+cn: Time Limit Rotation Policy
+ds-cfg-rotation-policy-class: org.opends.server.loggers.TimeLimitRotationPolicy
+ds-cfg-rotation-interval: 24 hours
+
+dn: cn=7 Days Time Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-log-rotation-policy
+objectClass: ds-cfg-time-limit-log-rotation-policy
+cn: Time Limit Rotation Policy
+ds-cfg-rotation-policy-class: org.opends.server.loggers.TimeLimitRotationPolicy
+ds-cfg-rotation-interval: 7 days
+
+dn: cn=Size Limit Rotation Policy,cn=Log Rotation Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-log-rotation-policy
+objectClass: ds-cfg-size-limit-log-rotation-policy
+cn: Size Limit Rotation Policy
+ds-cfg-rotation-policy-class: org.opends.server.loggers.SizeBasedRotationPolicy
+ds-cfg-file-size-limit: 100 megabytes
+
+dn: cn=Fixed Time Rotation Policy,cn=Log Rotation Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-log-rotation-policy
+objectClass: ds-cfg-fixed-time-log-rotation-policy
+cn: Fixed Time Rotation Policy
+ds-cfg-rotation-policy-class: org.opends.server.loggers.FixedTimeRotationPolicy
+ds-cfg-time-of-day: 2359
+
+dn: cn=Log Retention Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-branch
+cn: Log Retention Policies
+
+dn: cn=File Count Retention Policy,cn=Log Retention Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-log-retention-policy
+objectClass: ds-cfg-file-count-log-retention-policy
+cn: File Count Retention Policy
+ds-cfg-retention-policy-class: org.opends.server.loggers.FileNumberRetentionPolicy
+ds-cfg-number-of-files: 10
+
+dn: cn=Free Disk Space Retention Policy,cn=Log Retention Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-log-retention-policy
+objectClass: ds-cfg-free-disk-space-log-retention-policy
+cn: Free Disk Space Retention Policy
+ds-cfg-retention-policy-class: org.opends.server.loggers.FreeDiskSpaceRetentionPolicy
+ds-cfg-free-disk-space: 500 megabytes
+
+dn: cn=Size Limit Retention Policy,cn=Log Retention Policies,cn=config
+objectClass: top
+objectClass: ds-cfg-log-retention-policy
+objectClass: ds-cfg-size-limit-log-retention-policy
+cn: Size Limit Retention Policy
+ds-cfg-retention-policy-class: org.opends.server.loggers.SizeBasedRetentionPolicy
+ds-cfg-disk-space-used: 500 megabytes
dn: cn=Matching Rules,cn=config
objectClass: top
diff --git a/opendj-sdk/opends/resource/schema/02-config.ldif b/opendj-sdk/opends/resource/schema/02-config.ldif
index 8e63eaa..0907d67 100644
--- a/opendj-sdk/opends/resource/schema/02-config.ldif
+++ b/opendj-sdk/opends/resource/schema/02-config.ldif
@@ -148,7 +148,7 @@
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.38 NAME 'ds-cfg-exclude-filter'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.39
- NAME 'ds-cfg-fixed-time-limit' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
+ NAME 'ds-cfg-rotation-interval' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.320 NAME 'ds-cfg-global-aci'
SYNTAX 1.3.6.1.4.1.26027.1.3.4 X-ORIGIN 'OpenDS Directory Server' )
@@ -312,13 +312,13 @@
NAME 'ds-cfg-rotation-action' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.90
- NAME 'ds-cfg-rotation-policy' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+ NAME 'ds-cfg-rotation-policy-dn' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.91
- NAME 'ds-cfg-retention-policy' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+ NAME 'ds-cfg-retention-policy-dn' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.92 NAME 'ds-cfg-number-of-files'
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'OpenDS Directory Server' )
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.93 NAME 'ds-cfg-disk-space-used'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.94 NAME 'ds-cfg-free-disk-space'
@@ -422,7 +422,7 @@
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.126 NAME 'ds-cfg-time-of-day'
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 SINGLE-VALUE
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.36
X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.127
NAME 'ds-cfg-trust-manager-provider-class'
@@ -1178,8 +1178,92 @@
NAME 'ds-cfg-virtual-attribute-value' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.345
+ NAME 'ds-cfg-default-debug-level'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.346
+ NAME 'ds-cfg-default-debug-category'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.347
+ NAME 'ds-cfg-default-omit-method-entry-arguments'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.348
+ NAME 'ds-cfg-default-omit-method-return-value'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.349
+ NAME 'ds-cfg-default-include-throwable-cause'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.350
+ NAME 'ds-cfg-default-throwable-stack-frames'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.351
+ NAME 'ds-cfg-debug-scope'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.352
+ NAME 'ds-cfg-debug-level'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.353
+ NAME 'ds-cfg-debug-category'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.354
+ NAME 'ds-cfg-omit-method-entry-arguments'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.355
+ NAME 'ds-cfg-omit-method-return-value'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.356
+ NAME 'ds-cfg-include-throwable-cause'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.357
+ NAME 'ds-cfg-throwable-stack-frames'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.358
+ NAME 'ds-cfg-asynchronous-writes'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.359
+ NAME 'ds-cfg-log-file-mode'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.360
+ NAME 'ds-cfg-writer-auto-flush'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.361
+ NAME 'ds-cfg-writer-append'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.375
NAME 'ds-cfg-allow-retrieving-membership' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.376
+ NAME 'ds-cfg-rotation-policy-class'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.377
+ NAME 'ds-cfg-retention-policy-class'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.378
+ NAME 'ds-cfg-log-queue-size'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.379
+ NAME 'ds-cfg-file-size-limit'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE
+ X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.1
NAME 'ds-cfg-access-control-handler' SUP top STRUCTURAL
MUST ( cn $ ds-cfg-acl-handler-class $ ds-cfg-acl-handler-enabled )
@@ -1297,37 +1381,47 @@
ds-cfg-key-store-pin-environment-variable $ ds-cfg-key-store-pin-file )
X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.22 NAME 'ds-cfg-logger'
- SUP top STRUCTURAL MUST ( cn $ ds-cfg-logger-class $
- ds-cfg-logger-enabled ) X-ORIGIN 'OpenDS Directory Server' )
+ SUP top STRUCTURAL MUST ( cn $ ds-cfg-logger-enabled $ ds-cfg-logger-class )
+ X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.23 NAME 'ds-cfg-access-logger'
- SUP ds-cfg-logger STRUCTURAL X-ORIGIN 'OpenDS Directory Server' )
+ SUP ds-cfg-logger
+ STRUCTURAL MAY ( ds-cfg-suppress-internal-operations )
+ X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.24 NAME 'ds-cfg-error-logger'
- SUP ds-cfg-logger STRUCTURAL X-ORIGIN 'OpenDS Directory Server' )
+ SUP ds-cfg-logger
+ STRUCTURAL MAY ( ds-cfg-default-severity $ ds-cfg-override-severity )
+ X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.25 NAME 'ds-cfg-debug-logger'
- SUP ds-cfg-logger STRUCTURAL X-ORIGIN 'OpenDS Directory Server' )
+ SUP ds-cfg-logger STRUCTURAL MUST ( ds-cfg-default-debug-level )
+ MAY ( ds-cfg-default-debug-category $
+ ds-cfg-default-omit-method-entry-arguments $
+ ds-cfg-default-omit-method-return-value $
+ ds-cfg-default-include-throwable-cause $
+ ds-cfg-throwable-stack-frames )
+ X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.26
NAME 'ds-cfg-file-based-access-logger' SUP ds-cfg-access-logger STRUCTURAL
- MUST ds-cfg-log-file MAY ( ds-cfg-rotation-policy $ ds-cfg-size-limit $
- ds-cfg-fixed-time-limit $ ds-cfg-time-of-day $ ds-cfg-rotation-action $
- ds-cfg-default-severity $ ds-cfg-override-severity $
- ds-cfg-retention-policy $ ds-cfg-number-of-files $ ds-cfg-disk-space-used $
- ds-cfg-thread-time-interval $ ds-cfg-buffer-size $ ds-cfg-free-disk-space $
- ds-cfg-suppress-internal-operations ) X-ORIGIN 'OpenDS Directory Server' )
+ MUST ( ds-cfg-log-file $ ds-cfg-asynchronous-writes $ ds-cfg-log-file-mode )
+ MAY ( ds-cfg-rotation-policy-dn $
+ ds-cfg-rotation-action $ ds-cfg-retention-policy-dn $
+ ds-cfg-thread-time-interval $ ds-cfg-buffer-size $ ds-cfg-writer-auto-flush $
+ ds-cfg-writer-append )
+ X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.27
NAME 'ds-cfg-file-based-debug-logger' SUP ds-cfg-debug-logger STRUCTURAL
- MUST ds-cfg-log-file MAY ( ds-cfg-rotation-policy $ ds-cfg-size-limit $
- ds-cfg-fixed-time-limit $ ds-cfg-time-of-day $ ds-cfg-rotation-action $
- ds-cfg-retention-policy $ ds-cfg-number-of-files $ ds-cfg-disk-space-used $
- ds-cfg-thread-time-interval $ ds-cfg-buffer-size $ ds-cfg-free-disk-space $
- ds-cfg-default-severity $ ds-cfg-override-severity )
+ MUST ( ds-cfg-log-file $ ds-cfg-asynchronous-writes $ ds-cfg-log-file-mode )
+ MAY ( ds-cfg-rotation-policy-dn $
+ ds-cfg-rotation-action $ ds-cfg-retention-policy-dn $
+ ds-cfg-thread-time-interval $ ds-cfg-buffer-size $ ds-cfg-writer-auto-flush $
+ ds-cfg-writer-append )
X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.28
NAME 'ds-cfg-file-based-error-logger' SUP ds-cfg-error-logger STRUCTURAL
- MUST ds-cfg-log-file MAY ( ds-cfg-rotation-policy $ ds-cfg-size-limit $
- ds-cfg-fixed-time-limit $ ds-cfg-time-of-day $ ds-cfg-rotation-action $
- ds-cfg-retention-policy $ ds-cfg-number-of-files $ ds-cfg-disk-space-used $
- ds-cfg-thread-time-interval $ ds-cfg-buffer-size $ ds-cfg-free-disk-space $
- ds-cfg-default-severity $ ds-cfg-override-severity )
+ MUST ( ds-cfg-log-file $ ds-cfg-asynchronous-writes $ ds-cfg-log-file-mode )
+ MAY ( ds-cfg-rotation-policy-dn $
+ ds-cfg-rotation-action $ ds-cfg-retention-policy-dn $
+ ds-cfg-thread-time-interval $ ds-cfg-buffer-size $ ds-cfg-writer-auto-flush $
+ ds-cfg-writer-append )
X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.29 NAME 'ds-cfg-matching-rule'
SUP top STRUCTURAL MUST ( cn $ ds-cfg-matching-rule-class $
@@ -1656,7 +1750,7 @@
ds-cfg-allow-unclassified-characters ) X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.98
NAME 'ds-task-rebuild' SUP ds-task
- MUST ( ds-task-rebuild-base-dn $ ds-task-rebuild-index )
+ STRUCTURAL MUST ( ds-task-rebuild-base-dn $ ds-task-rebuild-index )
MAY ( ds-task-rebuild-max-threads )
X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.99 NAME 'ds-virtual-static-group'
@@ -1667,6 +1761,49 @@
STRUCTURAL MUST ds-cfg-virtual-attribute-value
X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.101
+ NAME 'ds-cfg-debug-target'
+ STRUCTURAL MUST ( ds-cfg-debug-scope $ ds-cfg-debug-level )
+ MAY (ds-cfg-debug-category $ ds-cfg-omit-method-entry-arguments $
+ ds-cfg-omit-method-return-value $ ds-cfg-omit-method-return-value $
+ ds-cfg-include-throwable-cause $ ds-cfg-throwable-stack-frames )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.102
+ NAME 'ds-cfg-log-retention-policy'
+ STRUCTURAL MUST ( cn $ ds-cfg-retention-policy-class )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.103
+ NAME 'ds-cfg-file-count-log-retention-policy' SUP ds-cfg-log-retention-policy
+ STRUCTURAL MUST ( ds-cfg-number-of-files )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.104
+ NAME 'ds-cfg-size-limit-log-retention-policy' SUP ds-cfg-log-retention-policy
+ STRUCTURAL MUST ( ds-cfg-disk-space-used )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.105
+ NAME 'ds-cfg-free-disk-space-log-retention-policy'
+ SUP ds-cfg-log-retention-policy
+ STRUCTURAL MUST ( ds-cfg-free-disk-space )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.106
+ NAME 'ds-cfg-log-rotation-policy'
+ STRUCTURAL MUST ( cn $ ds-cfg-rotation-policy-class )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.107
+ NAME 'ds-cfg-size-limit-log-rotation-policy'
+ SUP ds-cfg-log-rotation-policy
+ STRUCTURAL MUST ( ds-cfg-file-size-limit )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.108
+ NAME 'ds-cfg-time-limit-log-rotation-policy'
+ SUP ds-cfg-log-rotation-policy
+ STRUCTURAL MUST ( ds-cfg-rotation-interval )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.109
+ NAME 'ds-cfg-fixed-time-log-rotation-policy'
+ SUP ds-cfg-log-rotation-policy
+ STRUCTURAL MUST ( ds-cfg-time-of-day )
+ X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.113
NAME 'ds-cfg-member-virtual-attribute' SUP ds-cfg-virtual-attribute
STRUCTURAL MUST ds-cfg-allow-retrieving-membership
X-ORIGIN 'OpenDS Directory Server' )
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/AccessLogPublisherConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/AccessLogPublisherConfiguration.xml
new file mode 100644
index 0000000..da7ab40
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/AccessLogPublisherConfiguration.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adm:managed-object name="access-log-publisher"
+ plural-name="access-log-publishers"
+ package="org.opends.server.admin.std"
+ extends="log-publisher"
+ abstract="true"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name />
+ are reponsible for distributing access log messages from the access logger
+ to a destination.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.23</ldap:oid>
+ <ldap:name>ds-cfg-access-logger</ldap:name>
+ <ldap:superior>ds-cfg-logger</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="java-implementation-class" mandatory="true">
+ <adm:synopsis>
+ The fully-qualified name of the Java class that provides the
+ <adm:user-friendly-name />
+ implementation.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:java-class>
+ <adm:instance-of>
+ org.opends.server.api.AccessLogPublisher
+ </adm:instance-of>
+ </adm:java-class>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.60</ldap:oid>
+ <ldap:name>ds-cfg-logger-class</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="suppress-internal-operations">
+ <adm:synopsis>
+ Omit access messages generated by internal operations.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ true
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.123</ldap:oid>
+ <ldap:name>ds-cfg-suppress-internal-operations</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/DebugLogPublisherConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/DebugLogPublisherConfiguration.xml
new file mode 100644
index 0000000..44f0834
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/DebugLogPublisherConfiguration.xml
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adm:managed-object name="debug-log-publisher"
+ plural-name="debug-log-publishers"
+ package="org.opends.server.admin.std"
+ extends="log-publisher"
+ abstract="true"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name />
+ are reponsible for distributing debug log messages from the debug logger to
+ a destination.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.25</ldap:oid>
+ <ldap:name>ds-cfg-debug-logger</ldap:name>
+ <ldap:superior>ds-cfg-logger</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:relation name="debug-target">
+ <adm:one-to-many />
+ <adm:profile name="ldap">
+ <ldap:rdn-sequence>
+ cn=Debug Targets
+ </ldap:rdn-sequence>
+ <ldap:naming-attribute>
+ ds-cfg-debug-scope
+ </ldap:naming-attribute>
+ </adm:profile>
+ </adm:relation>
+ <adm:property name="java-implementation-class" mandatory="true">
+ <adm:synopsis>
+ The fully-qualified name of the Java class that provides the
+ <adm:user-friendly-name />
+ implementation.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:java-class>
+ <adm:instance-of>
+ org.opends.server.api.DebugLogPublisher
+ </adm:instance-of>
+ </adm:java-class>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.60</ldap:oid>
+ <ldap:name>ds-cfg-logger-class</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="default-debug-level" mandatory="true">
+ <adm:synopsis>
+ The lowest severity level of debug messages to log when none of the
+ defined targets match the message.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:enumeration>
+ <adm:value name="disabled">
+ <adm:synopsis>
+ No messages will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="error">
+ <adm:synopsis>
+ Messages with severity level of ERROR or higher will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="warning">
+ <adm:synopsis>
+ Messages with severity level of WARNING or higher will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="info">
+ <adm:synopsis>
+ Messages with severity level of INFO or higher will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="verbose">
+ <adm:synopsis>
+ Messages with severity level of VERBOSE or higher will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="all">
+ <adm:synopsis>
+ Messages with any severity level will be logged.
+ </adm:synopsis>
+ </adm:value>
+ </adm:enumeration>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.345</ldap:oid>
+ <ldap:name>ds-cfg-default-debug-level</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="default-debug-category" multi-valued="true">
+ <adm:synopsis>
+ The category(ies) of debug messages to log when none of the defined
+ targets match the message.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ Messages with any category will be logged.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:enumeration>
+ <adm:value name="caught">
+ <adm:synopsis>
+ Exception caught.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="constructor">
+ <adm:synopsis>
+ Constructor entry.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="data">
+ <adm:synopsis>
+ Raw data dump.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="database-access">
+ <adm:synopsis>
+ Access to a backend database.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="enter">
+ <adm:synopsis>
+ Method entry.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="exit">
+ <adm:synopsis>
+ Method exit.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="message">
+ <adm:synopsis>
+ Arbitrary debug message.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="protocol">
+ <adm:synopsis>
+ Protocol element dump.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="thrown">
+ <adm:synopsis>
+ Exception throw from method.
+ </adm:synopsis>
+ </adm:value>
+ </adm:enumeration>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.346</ldap:oid>
+ <ldap:name>ds-cfg-default-debug-category</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="default-omit-method-entry-arguments">
+ <adm:synopsis>
+ Property to indicate whether to include method arguments in debug messages
+ logged by default.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ false
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.347</ldap:oid>
+ <ldap:name>ds-cfg-default-omit-method-entry-arguments</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="default-omit-method-return-value">
+ <adm:synopsis>
+ Property to indicate whether to include the return value in debug messages
+ logged by default.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ false
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.348</ldap:oid>
+ <ldap:name>ds-cfg-default-omit-method-return-value</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="default-include-throwable-cause">
+ <adm:synopsis>
+ Property to indicate whether to include the cause of exceptions in
+ exception thrown and caught messages logged by default.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ false
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.349</ldap:oid>
+ <ldap:name>ds-cfg-default-include-throwable-cause</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="default-throwable-stack-frames">
+ <adm:synopsis>
+ Property to indicate the number of stack frames to include in the stack
+ trace for method entry and exception thrown messages.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 0
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:integer lower-limit="0" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.350</ldap:oid>
+ <ldap:name>ds-cfg-default-throwable-stack-frames</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/DebugTargetConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/DebugTargetConfiguration.xml
new file mode 100644
index 0000000..c7a473a
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/DebugTargetConfiguration.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adm:managed-object name="debug-target"
+ plural-name="debug-targets"
+ package="org.opends.server.admin.std"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name />
+ define the types of messages logged by the debug logPublisher.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.101</ldap:oid>
+ <ldap:name>ds-cfg-debug-target</ldap:name>
+ <ldap:superior>top</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="debug-scope" mandatory="true">
+ <adm:synopsis>
+ The fully-qualified OpenDS Java package, class, or method affected by
+ the settings in this target definition. Use the number character (#) to
+ seperate the class name and the method name.
+ (ie. org.opends.server.core.DirectoryServer#startUp)
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:string>
+ <adm:pattern>
+ <adm:regex>
+ ^([A-Za-z][A-Za-z0-9_]*\\.)*[A-Za-z][A-Za-z0-9_]*(#[A-Za-z][A-Za-z0-9_]*)?$
+ </adm:regex>
+ <adm:synopsis>
+ A fully-qualified OpenDS Java package, class, or method name.
+ </adm:synopsis>
+ </adm:pattern>
+ </adm:string>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>
+ 1.3.6.1.4.1.26027.1.1.351
+ </ldap:oid>
+ <ldap:name>
+ ds-cfg-debug-scope
+ </ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="debug-level" mandatory="true">
+ <adm:synopsis>
+ The lowest severity level of debug messages to log.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:enumeration>
+ <adm:value name="disabled">
+ <adm:synopsis>
+ No messages will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="error">
+ <adm:synopsis>
+ Messages with severity level of ERROR or higher will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="warning">
+ <adm:synopsis>
+ Messages with severity level of WARNING or higher will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="info">
+ <adm:synopsis>
+ Messages with severity level of INFO or higher will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="verbose">
+ <adm:synopsis>
+ Messages with severity level of VERBOSE or higher will be logged.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="all">
+ <adm:synopsis>
+ Messages with any severity level will be logged.
+ </adm:synopsis>
+ </adm:value>
+ </adm:enumeration>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.352</ldap:oid>
+ <ldap:name>ds-cfg-debug-level</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="debug-category" multi-valued="true">
+ <adm:synopsis>
+ The category(ies) of debug messages to log.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ Messages with any category will be logged.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:enumeration>
+ <adm:value name="caught">
+ <adm:synopsis>
+ Exception caught.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="constructor">
+ <adm:synopsis>
+ Constructor entry.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="data">
+ <adm:synopsis>
+ Raw data dump.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="database-access">
+ <adm:synopsis>
+ Access to a backend database.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="enter">
+ <adm:synopsis>
+ Method entry.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="exit">
+ <adm:synopsis>
+ Method exit.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="message">
+ <adm:synopsis>
+ Arbitrary debug message.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="protocol">
+ <adm:synopsis>
+ Protocol element dump.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="thrown">
+ <adm:synopsis>
+ Exception throw from method.
+ </adm:synopsis>
+ </adm:value>
+ </adm:enumeration>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.353</ldap:oid>
+ <ldap:name>ds-cfg-debug-category</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="omit-method-entry-arguments">
+ <adm:synopsis>
+ Property to indicate whether to include method arguments in debug
+ messages.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ false
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.354</ldap:oid>
+ <ldap:name>ds-cfg-omit-method-entry-arguments</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="omit-method-return-value">
+ <adm:synopsis>
+ Property to indicate whether to include the return value in debug
+ messages.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ false
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.355</ldap:oid>
+ <ldap:name>ds-cfg-omit-method-return-value</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="include-throwable-cause">
+ <adm:synopsis>
+ Property to indicate whether to include the cause of exceptions in
+ exception thrown and caught messages.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ false
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.356</ldap:oid>
+ <ldap:name>ds-cfg-include-throwable-cause</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="throwable-stack-frames">
+ <adm:synopsis>
+ Property to indicate the number of stack frames to include in the stack
+ trace for method entry and exception thrown messages.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 0
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:integer lower-limit="0" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.357</ldap:oid>
+ <ldap:name>ds-cfg-throwable-stack-frames</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/ErrorLogPublisherConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/ErrorLogPublisherConfiguration.xml
new file mode 100644
index 0000000..0de3cef
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/ErrorLogPublisherConfiguration.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adm:managed-object name="error-log-publisher"
+ plural-name="error-log-publishers"
+ package="org.opends.server.admin.std"
+ extends="log-publisher"
+ abstract="true"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name />
+ are reponsible for distributing error log messages from the error logger to
+ a destination.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.24</ldap:oid>
+ <ldap:name>ds-cfg-error-logger</ldap:name>
+ <ldap:superior>ds-cfg-logger</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="java-implementation-class" mandatory="true">
+ <adm:synopsis>
+ The fully-qualified name of the Java class that provides the
+ <adm:user-friendly-name />
+ implementation.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:java-class>
+ <adm:instance-of>
+ org.opends.server.api.ErrorLogPublisher
+ </adm:instance-of>
+ </adm:java-class>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.60</ldap:oid>
+ <ldap:name>ds-cfg-logger-class</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="default-severity" multi-valued="true">
+ <adm:synopsis>
+ Property to specify the default severity levels for the logger.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ Severities fatal-error, severe-warning, and severe-error will
+ be used for the logger.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:enumeration>
+ <adm:value name="fatal-error">
+ <adm:synopsis>
+ The error log severity that will be used for messages that
+ provide information about fatal errors which may force the server
+ to shut down or operate in a significantly degraded state.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="generic-debug">
+ <adm:synopsis>
+ The error log severity that will be used for debug messages
+ generated during general processing that may be useful enough to
+ warrant making them available without restarting the server in
+ debug mode.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="informational">
+ <adm:synopsis>
+ The error log severity that will be used for messages that
+ provide information about significant events within the server
+ that are not warnings or errors.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="mild-error">
+ <adm:synopsis>
+ The error log severity that will be used for messages that
+ provide information about mild (recoverable) errors encountered
+ during processing.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="mild-warning">
+ <adm:synopsis>
+ The error log severity that will be used for messages that
+ provide information about mild warnings triggered during
+ processing.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="notice">
+ <adm:synopsis>
+ The error log severity that will be used for the most important
+ informational messages (i.e., information that should almost
+ always be logged but is not associated with a warning or error
+ condition).
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="severe-error">
+ <adm:synopsis>
+ The error log severity that will be used for messages that
+ provide information about severe errors encountered during
+ processing.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="severe-warning">
+ <adm:synopsis>
+ The error log severity that will be used for messages that
+ provide information about severe warnings triggered during
+ processing.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="shutdown-debug">
+ <adm:synopsis>
+ The error log severity that will be used for debug messages
+ generated during server shutdown.
+ </adm:synopsis>
+ </adm:value>
+ <adm:value name="startup-debug">
+ <adm:synopsis>
+ The error log severity that will be used for debug messages
+ generated during server startup.
+ </adm:synopsis>
+ </adm:value>
+ </adm:enumeration>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.31</ldap:oid>
+ <ldap:name>ds-cfg-default-severity</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="override-severity" multi-valued="true">
+ <adm:synopsis>
+ Property to specify the override severity levels for the logger.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ Messages will use the default severity levels.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:string />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.74</ldap:oid>
+ <ldap:name>ds-cfg-override-severity</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml
new file mode 100644
index 0000000..2a885ed
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adm:managed-object name="file-based-access-log-publisher"
+ plural-name="file-based-access-log-publishers"
+ package="org.opends.server.admin.std" extends="access-log-publisher"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name />
+ publish access messages to the file system.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.26</ldap:oid>
+ <ldap:name>ds-cfg-file-based-access-logger</ldap:name>
+ <ldap:superior>ds-cfg-access-logger</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="asynchronous" mandatory="true">
+ <adm:synopsis>
+ Indicate whether the
+ <adm:user-friendly-name />
+ will publish records asyncronously.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.358</ldap:oid>
+ <ldap:name>ds-cfg-asynchronous-writes</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="queue-size">
+ <adm:synopsis>
+ The maximum number of log records that can be stored in the
+ asynchronous queue.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 5000
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:integer />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.378</ldap:oid>
+ <ldap:name>dscfg-log-queue-size</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="log-file" mandatory="true">
+ <adm:synopsis>
+ The file name to use for the log files generated by the
+ <adm:user-friendly-name />. The path to the file is relative to the server
+ root.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:string />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.59</ldap:oid>
+ <ldap:name>ds-cfg-log-file</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="log-file-mode" mandatory="true">
+ <adm:synopsis>
+ The UNIX permissions of the log files created by this
+ <adm:user-friendly-name />.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:string>
+ <adm:pattern>
+ <adm:regex>
+ ^([0-7][0-7][0-7])$
+ </adm:regex>
+ <adm:synopsis>
+ An valid UNIX mode string. The mode string must contain three
+ digits between zero and seven.
+ </adm:synopsis>
+ </adm:pattern>
+ </adm:string>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.359</ldap:oid>
+ <ldap:name>ds-cfg-log-file-mode</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="time-interval">
+ <adm:synopsis>
+ This property specifies the interval to check whether
+ the log files need to be rotated.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 5s
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:duration base-unit="ms" lower-limit="1"/>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.109</ldap:oid>
+ <ldap:name>ds-cfg-thread-time-interval</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="buffer-size">
+ <adm:synopsis>
+ This property specifies the log file buffer size.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 64kb
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:size lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.110</ldap:oid>
+ <ldap:name>ds-cfg-buffer-size</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="auto-flush">
+ <adm:synopsis>
+ This property specifies whether to flush the writer after every log
+ record. If the asynchronous writes option is used, the writer will
+ be flushed after all the log records in the queue are written.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ true
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.360</ldap:oid>
+ <ldap:name>ds-cfg-writer-auto-flush</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="append">
+ <adm:synopsis>
+ This property specifies whether to append to existing log files.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ true
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.361</ldap:oid>
+ <ldap:name>ds-cfg-writer-append</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="rotation-policy-dn" multi-valued="true">
+ <adm:synopsis>
+ The retention policy to use for the <adm:user-friendly-name />. When
+ multiple policies are used, rotation will occur if any policy's conditions
+ are met.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ No rotation policy is used and log rotation will not occur.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:dn>
+ <adm:base>
+ cn=Log Rotation Policies,cn=config
+ </adm:base>
+ </adm:dn>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.90</ldap:oid>
+ <ldap:name>ds-cfg-rotation-policy-dn</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="retention-policy-dn" multi-valued="true">
+ <adm:synopsis>
+ The retention policy to use for the <adm:user-friendly-name />. When
+ multiple policies are used, log files will be cleaned when any of the
+ policy's conditions are met
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ No rentation policy is used and log files will never be cleaned.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:dn>
+ <adm:base>
+ cn=Log Retention Policies,cn=config
+ </adm:base>
+ </adm:dn>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.91</ldap:oid>
+ <ldap:name>ds-cfg-retention-policy-dn</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml
new file mode 100644
index 0000000..711296d
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adm:managed-object name="file-based-debug-log-publisher"
+ plural-name="file-based-debug-log-publishers"
+ package="org.opends.server.admin.std" extends="debug-log-publisher"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name />
+ publish debug messages to the file system.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.27</ldap:oid>
+ <ldap:name>ds-cfg-file-based-debug-logger</ldap:name>
+ <ldap:superior>ds-cfg-debug-logger</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="asynchronous" mandatory="true">
+ <adm:synopsis>
+ Indicate whether the
+ <adm:user-friendly-name />
+ will publish records asyncronously.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.358</ldap:oid>
+ <ldap:name>ds-cfg-asynchronous-writes</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="queue-size">
+ <adm:synopsis>
+ The maximum number of log records that can be stored in the
+ asynchronous queue.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 5000
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:integer />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.378</ldap:oid>
+ <ldap:name>dscfg-log-queue-size</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="log-file" mandatory="true">
+ <adm:synopsis>
+ The file name to use for the log files generated by the
+ <adm:user-friendly-name />. The path to the file is relative to the server
+ root.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:string />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.59</ldap:oid>
+ <ldap:name>ds-cfg-log-file</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="log-file-mode" mandatory="true">
+ <adm:synopsis>
+ The UNIX permissions of the log files created by this
+ <adm:user-friendly-name />.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:string>
+ <adm:pattern>
+ <adm:regex>
+ ^([0-7][0-7][0-7])$
+ </adm:regex>
+ <adm:synopsis>
+ An valid UNIX mode string. The mode string must contain three
+ digits between zero and seven.
+ </adm:synopsis>
+ </adm:pattern>
+ </adm:string>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.359</ldap:oid>
+ <ldap:name>ds-cfg-log-file-mode</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="time-interval">
+ <adm:synopsis>
+ This property specifies the interval to check whether
+ the log files need to be rotated.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 5s
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:duration base-unit="ms" lower-limit="1"/>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.109</ldap:oid>
+ <ldap:name>ds-cfg-thread-time-interval</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="buffer-size">
+ <adm:synopsis>
+ This property specifies the log file buffer size.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 64kb
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:size lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.110</ldap:oid>
+ <ldap:name>ds-cfg-buffer-size</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="auto-flush">
+ <adm:synopsis>
+ This property specifies whether to flush the writer after every log
+ record. If the asynchronous writes option is used, the writer will
+ be flushed after all the log records in the queue are written.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ true
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.360</ldap:oid>
+ <ldap:name>ds-cfg-writer-auto-flush</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="append">
+ <adm:synopsis>
+ This property specifies whether to append to existing log files.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ true
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.361</ldap:oid>
+ <ldap:name>ds-cfg-writer-append</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="rotation-policy-dn" multi-valued="true">
+ <adm:synopsis>
+ The retention policy to use for the <adm:user-friendly-name />. When
+ multiple policies are used, rotation will occur if any policy's conditions
+ are met.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ No rotation policy is used and log rotation will not occur.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:dn>
+ <adm:base>
+ cn=Log Rotation Policies,cn=config
+ </adm:base>
+ </adm:dn>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.90</ldap:oid>
+ <ldap:name>ds-cfg-rotation-policy-dn</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="retention-policy-dn" multi-valued="true">
+ <adm:synopsis>
+ The retention policy to use for the <adm:user-friendly-name />. When
+ multiple policies are used, log files will be cleaned when any of the
+ policy's conditions are met
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ No rentation policy is used and log files will never be cleaned.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:dn>
+ <adm:base>
+ cn=Log Retention Policies,cn=config
+ </adm:base>
+ </adm:dn>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.91</ldap:oid>
+ <ldap:name>ds-cfg-retention-policy-dn</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedErrorLogPublisherConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedErrorLogPublisherConfiguration.xml
new file mode 100644
index 0000000..781f3e8
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileBasedErrorLogPublisherConfiguration.xml
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adm:managed-object name="file-based-error-log-publisher"
+ plural-name="file-based-error-log-publishers"
+ package="org.opends.server.admin.std" extends="error-log-publisher"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name />
+ publish error messages to the file system.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.28</ldap:oid>
+ <ldap:name>ds-cfg-file-based-error-logger</ldap:name>
+ <ldap:superior>ds-cfg-error-logger</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="asynchronous" mandatory="true">
+ <adm:synopsis>
+ Indicate whether the
+ <adm:user-friendly-name />
+ will publish records asyncronously.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.358</ldap:oid>
+ <ldap:name>ds-cfg-asynchronous-writes</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="queue-size">
+ <adm:synopsis>
+ The maximum number of log records that can be stored in the
+ asynchronous queue.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 5000
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:integer />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.378</ldap:oid>
+ <ldap:name>dscfg-log-queue-size</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="log-file" mandatory="true">
+ <adm:synopsis>
+ The file name to use for the log files generated by the
+ <adm:user-friendly-name />. The path to the file is relative to the server
+ root.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:string />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.59</ldap:oid>
+ <ldap:name>ds-cfg-log-file</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="log-file-mode" mandatory="true">
+ <adm:synopsis>
+ The UNIX permissions of the log files created by this
+ <adm:user-friendly-name />.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:string>
+ <adm:pattern>
+ <adm:regex>
+ ^([0-7][0-7][0-7])$
+ </adm:regex>
+ <adm:synopsis>
+ An valid UNIX mode string. The mode string must contain three
+ digits between zero and seven.
+ </adm:synopsis>
+ </adm:pattern>
+ </adm:string>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.359</ldap:oid>
+ <ldap:name>ds-cfg-log-file-mode</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="time-interval">
+ <adm:synopsis>
+ This property specifies the interval to check whether
+ the log files need to be rotated.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 5s
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:duration base-unit="ms" lower-limit="1"/>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.109</ldap:oid>
+ <ldap:name>ds-cfg-thread-time-interval</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="buffer-size">
+ <adm:synopsis>
+ This property specifies the log file buffer size.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ 64kb
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:size lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.110</ldap:oid>
+ <ldap:name>ds-cfg-buffer-size</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="auto-flush">
+ <adm:synopsis>
+ This property specifies whether to flush the writer after every log
+ record. If the asynchronous writes option is used, the writer will
+ be flushed after all the log records in the queue are written.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ true
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.360</ldap:oid>
+ <ldap:name>ds-cfg-writer-auto-flush</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="append">
+ <adm:synopsis>
+ This property specifies whether to append to existing log files.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>
+ true
+ </adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.361</ldap:oid>
+ <ldap:name>ds-cfg-writer-append</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="rotation-policy-dn" multi-valued="true">
+ <adm:synopsis>
+ The retention policy to use for the <adm:user-friendly-name />. When
+ multiple policies are used, rotation will occur if any policy's conditions
+ are met.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ No rotation policy is used and log rotation will not occur.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:dn>
+ <adm:base>
+ cn=Log Rotation Policies,cn=config
+ </adm:base>
+ </adm:dn>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.90</ldap:oid>
+ <ldap:name>ds-cfg-rotation-policy-dn</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="retention-policy-dn" multi-valued="true">
+ <adm:synopsis>
+ The retention policy to use for the <adm:user-friendly-name />. When
+ multiple policies are used, log files will be cleaned when any of the
+ policy's conditions are met
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:alias>
+ <adm:synopsis>
+ No rentation policy is used and log files will never be cleaned.
+ </adm:synopsis>
+ </adm:alias>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:dn>
+ <adm:base>
+ cn=Log Retention Policies,cn=config
+ </adm:base>
+ </adm:dn>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.91</ldap:oid>
+ <ldap:name>ds-cfg-retention-policy-dn</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileCountLogRetentionPolicyConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileCountLogRetentionPolicyConfiguration.xml
new file mode 100644
index 0000000..1289bdf
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FileCountLogRetentionPolicyConfiguration.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<adm:managed-object
+ name="file-count-log-retention-policy"
+ plural-name="file-count-log-retention-policies"
+ package="org.opends.server.admin.std"
+ extends="log-retention-policy"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ Retention policy based on the number of rotated log files on disk.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.103</ldap:oid>
+ <ldap:name>ds-cfg-file-count-log-retention-policy</ldap:name>
+ <ldap:superior>ds-cfg-log-retention-policy</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="number-of-files" mandatory="true">
+ <adm:synopsis>
+ Number of log files to retain before the oldest ones will be cleaned.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:integer lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.92</ldap:oid>
+ <ldap:name>ds-cfg-number-of-files</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
+
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FixedTimeLogRotationPolicyConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FixedTimeLogRotationPolicyConfiguration.xml
new file mode 100644
index 0000000..d6c8145
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FixedTimeLogRotationPolicyConfiguration.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<adm:managed-object
+ name="fixed-time-log-rotation-policy"
+ plural-name="fixed-time-log-rotation-policies"
+ package="org.opends.server.admin.std"
+ extends="log-rotation-policy"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ Rotation policy based on fixed time of day.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.109</ldap:oid>
+ <ldap:name>ds-cfg-fixed-time-log-rotation-policy</ldap:name>
+ <ldap:superior>ds-cfg-log-rotation-policy</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="time-of-day" multi-valued="true" mandatory="true">
+ <adm:synopsis>
+ The time of day which log rotation should occur.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:string>
+ <adm:pattern>
+ <adm:regex>
+ ^(([0-1][0-9])|([2][0-3]))([0-5][0-9])$
+ </adm:regex>
+ <adm:synopsis>
+ 24 hour time of day in HHmm format.
+ </adm:synopsis>
+ </adm:pattern>
+ </adm:string>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.126</ldap:oid>
+ <ldap:name>ds-cfg-time-of-day</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
+
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FreeDiskSpaceLogRetentionPolicyConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FreeDiskSpaceLogRetentionPolicyConfiguration.xml
new file mode 100644
index 0000000..e386232
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/FreeDiskSpaceLogRetentionPolicyConfiguration.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<adm:managed-object
+ name="free-disk-space-log-retention-policy"
+ plural-name="free-disk-space-log-retention-policies"
+ package="org.opends.server.admin.std"
+ extends="log-retention-policy"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ Retention policy based on the free disk space available.
+ This policy is only available on Java 6.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.105</ldap:oid>
+ <ldap:name>ds-cfg-free-disk-space-log-retention-policy</ldap:name>
+ <ldap:superior>ds-cfg-log-retention-policy</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="free-disk-space" mandatory="true">
+ <adm:synopsis>
+ The size of free disk space needed.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:size lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.94</ldap:oid>
+ <ldap:name>ds-cfg-free-disk-space</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
+
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogPublisherConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogPublisherConfiguration.xml
new file mode 100644
index 0000000..c92e391
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogPublisherConfiguration.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adm:managed-object name="log-publisher"
+ plural-name="log-publishers"
+ package="org.opends.server.admin.std" abstract="true"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name />
+ are reponsible for distributing log messages from different loggers to
+ a destination.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.22</ldap:oid>
+ <ldap:name>ds-cfg-logger</ldap:name>
+ <ldap:superior>top</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="enabled" mandatory="true">
+ <adm:synopsis>
+ Indicate whether the
+ <adm:user-friendly-name />
+ is enabled for use.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.61</ldap:oid>
+ <ldap:name>ds-cfg-logger-enabled</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogRetentionPolicyConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogRetentionPolicyConfiguration.xml
new file mode 100644
index 0000000..c44e3b3
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogRetentionPolicyConfiguration.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<adm:managed-object
+ name="log-retention-policy"
+ plural-name="log-retention-policies"
+ package="org.opends.server.admin.std"
+ abstract="true"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name /> are used to specify when log files should
+ be cleaned.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.102</ldap:oid>
+ <ldap:name>ds-cfg-log-retention-policy</ldap:name>
+ <ldap:superior>top</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="java-implementation-class" mandatory="true">
+ <adm:synopsis>
+ The fully-qualified name of the Java class that provides the
+ <adm:user-friendly-name />
+ implementation.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:java-class>
+ <adm:instance-of>
+ org.opends.server.loggers.RetentionPolicy
+ </adm:instance-of>
+ </adm:java-class>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.362</ldap:oid>
+ <ldap:name>ds-cfg-retention-policy-class</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
+
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogRotationPolicyConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogRotationPolicyConfiguration.xml
new file mode 100644
index 0000000..7525f84
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/LogRotationPolicyConfiguration.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<adm:managed-object
+ name="log-rotation-policy"
+ plural-name="log-rotation-policies"
+ package="org.opends.server.admin.std"
+ abstract="true"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ <adm:user-friendly-plural-name /> are used to specify when log files should
+ be rotated.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.106</ldap:oid>
+ <ldap:name>ds-cfg-log-rotation-policy</ldap:name>
+ <ldap:superior>top</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="java-implementation-class" mandatory="true">
+ <adm:synopsis>
+ The fully-qualified name of the Java class that provides the
+ <adm:user-friendly-name />
+ implementation.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:java-class>
+ <adm:instance-of>
+ org.opends.server.loggers.RotationPolicy
+ </adm:instance-of>
+ </adm:java-class>
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.363</ldap:oid>
+ <ldap:name>ds-cfg-rotation-policy-class</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
+
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/RootConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/RootConfiguration.xml
index 565b1e7..ce2d70f 100644
--- a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/RootConfiguration.xml
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/RootConfiguration.xml
@@ -175,5 +175,29 @@
</ldap:rdn-sequence>
</adm:profile>
</adm:relation>
+ <adm:relation name="log-publisher">
+ <adm:one-to-many />
+ <adm:profile name="ldap">
+ <ldap:rdn-sequence>
+ cn=Loggers,cn=config
+ </ldap:rdn-sequence>
+ </adm:profile>
+ </adm:relation>
+ <adm:relation name="log-rotation-policy">
+ <adm:one-to-many />
+ <adm:profile name="ldap">
+ <ldap:rdn-sequence>
+ cn=Log Rotation Policies,cn=config
+ </ldap:rdn-sequence>
+ </adm:profile>
+ </adm:relation>
+ <adm:relation name="log-retention-policy">
+ <adm:one-to-many />
+ <adm:profile name="ldap">
+ <ldap:rdn-sequence>
+ cn=Log Retention Policies,cn=config
+ </ldap:rdn-sequence>
+ </adm:profile>
+ </adm:relation>
<adm:product-name>OpenDS Directory Server</adm:product-name>
</adm:root-managed-object>
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/SizeLimitLogRetentionPolicyConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/SizeLimitLogRetentionPolicyConfiguration.xml
new file mode 100644
index 0000000..8e21530
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/SizeLimitLogRetentionPolicyConfiguration.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<adm:managed-object
+ name="size-limit-log-retention-policy"
+ plural-name="size-limit-log-retention-policies"
+ package="org.opends.server.admin.std"
+ extends="log-retention-policy"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ Retention policy based on the amount of space taken by the log
+ files on disk.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.104</ldap:oid>
+ <ldap:name>ds-cfg-size-limit-log-retention-policy</ldap:name>
+ <ldap:superior>ds-cfg-log-retention-policy</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="disk-space-used" mandatory="true">
+ <adm:synopsis>
+ The maximum total disk space used by the log files.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:size lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.93</ldap:oid>
+ <ldap:name>ds-cfg-disk-space-used</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
+
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/SizeLimitLogRotationPolicyConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/SizeLimitLogRotationPolicyConfiguration.xml
new file mode 100644
index 0000000..d20036b
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/SizeLimitLogRotationPolicyConfiguration.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<adm:managed-object
+ name="size-limit-log-rotation-policy"
+ plural-name="size-limit-log-rotation-policies"
+ package="org.opends.server.admin.std"
+ extends="log-rotation-policy"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ Rotation policy based on the size of the log file.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.107</ldap:oid>
+ <ldap:name>ds-cfg-size-limit-log-rotation-policy</ldap:name>
+ <ldap:superior>ds-cfg-log-rotation-policy</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="file-size-limit" mandatory="true">
+ <adm:synopsis>
+ The size of the file when rotation takes place.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:size lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.379</ldap:oid>
+ <ldap:name>ds-cfg-file-size-limit</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
+
diff --git a/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/TimeLimitLogRotationPolicyConfiguration.xml b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/TimeLimitLogRotationPolicyConfiguration.xml
new file mode 100644
index 0000000..b895c2d
--- /dev/null
+++ b/opendj-sdk/opends/src/admin/defn/org/opends/server/admin/std/TimeLimitLogRotationPolicyConfiguration.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<adm:managed-object
+ name="time-limit-log-rotation-policy"
+ plural-name="time-limit-log-rotation-policies"
+ package="org.opends.server.admin.std"
+ extends="log-rotation-policy"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+ Rotation policy based on the time since last rotation.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+ <ldap:object-class>
+ <ldap:oid>1.3.6.1.4.1.26027.1.2.108</ldap:oid>
+ <ldap:name>ds-cfg-time-limit-log-rotation-policy</ldap:name>
+ <ldap:superior>ds-cfg-log-rotation-policy</ldap:superior>
+ </ldap:object-class>
+ </adm:profile>
+ <adm:property name="rotation-interval" mandatory="true">
+ <adm:synopsis>
+ The time interval between rotations.
+ </adm:synopsis>
+ <adm:syntax>
+ <adm:duration base-unit="ms" lower-limit="1" />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:oid>1.3.6.1.4.1.26027.1.1.39</ldap:oid>
+ <ldap:name>ds-cfg-rotation-interval</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+</adm:managed-object>
+
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java b/opendj-sdk/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java
index 7d5b820..273edd8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java
@@ -28,7 +28,7 @@
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.messages.AdminMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleClient.java b/opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleClient.java
index bf9d69b..1f37a19 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleClient.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleClient.java
@@ -29,7 +29,7 @@
-import static org.opends.server.loggers.Error.removeAllErrorLoggers;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.util.ServerConstants.PROPERTY_SERVER_ROOT;
import java.io.File;
@@ -95,7 +95,7 @@
// generator.
DirectoryServer.initializeJMX();
- removeAllErrorLoggers(true);
+ removeAllErrorLogPublishers();
// Initialize the configuration.
File instanceRoot = new File("build/package/OpenDS-0.1");
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleIntrospection.java b/opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleIntrospection.java
index cf22f7c..d9dd8fa 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleIntrospection.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/client/ExampleIntrospection.java
@@ -28,7 +28,7 @@
-import static org.opends.server.loggers.Error.removeAllErrorLoggers;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.util.ServerConstants.PROPERTY_SERVER_ROOT;
import java.io.File;
@@ -97,7 +97,7 @@
// generator.
DirectoryServer.initializeJMX();
- removeAllErrorLoggers(true);
+ removeAllErrorLogPublishers();
// Initialize the configuration.
File instanceRoot = new File("build/package/OpenDS-0.1");
diff --git a/opendj-sdk/opends/src/server/org/opends/server/api/AccessLogger.java b/opendj-sdk/opends/src/server/org/opends/server/api/AccessLogPublisher.java
similarity index 75%
rename from opendj-sdk/opends/src/server/org/opends/server/api/AccessLogger.java
rename to opendj-sdk/opends/src/server/org/opends/server/api/AccessLogPublisher.java
index 6f0255e..1389e84 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/api/AccessLogger.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/api/AccessLogPublisher.java
@@ -26,62 +26,52 @@
*/
package org.opends.server.api;
-
-
-import org.opends.server.config.ConfigEntry;
+import org.opends.server.admin.std.server.AccessLogPublisherCfg;
import org.opends.server.config.ConfigException;
-import org.opends.server.core.AbandonOperation;
-import org.opends.server.core.AddOperation;
-import org.opends.server.core.BindOperation;
-import org.opends.server.core.CompareOperation;
-import org.opends.server.core.DeleteOperation;
-import org.opends.server.core.ExtendedOperation;
-import org.opends.server.core.ModifyOperation;
-import org.opends.server.core.ModifyDNOperation;
-import org.opends.server.core.SearchOperation;
-import org.opends.server.core.UnbindOperation;
-import org.opends.server.types.DisconnectReason;
import org.opends.server.types.InitializationException;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.SearchResultReference;
-
-
+import org.opends.server.core.*;
/**
* This class defines the set of methods and structures that must be
- * implemented for a Directory Server access logger.
+ * implemented for a Directory Server access log publisher.
+ *
+ * @param <T> The type of access log publisher configuration handled
+ * by this log publisher implementation.
*/
-public abstract class AccessLogger
+public abstract class AccessLogPublisher
+ <T extends AccessLogPublisherCfg>
{
/**
- * Initializes this access logger based on the information in the
- * provided configuration entry.
- *
- * @param configEntry The configuration entry that contains the
- * information to use to initialize this access
- * logger.
- *
- * @throws ConfigException If an unrecoverable problem arises in
- * the process of performing the
- * initialization.
- *
- * @throws InitializationException If a problem occurs during
- * initialization that is not
- * related to the server
- * configuration.
+ * Indicates if internal operations should be omited in the messages
+ * logged by this publisher.
*/
- public abstract void initializeAccessLogger(ConfigEntry configEntry)
- throws ConfigException, InitializationException;
-
-
+ protected boolean suppressInternalOperations = true;
/**
- * Closes this access logger and releases any resources it might
- * have held.
+ * Initializes this access publisher provider based on the
+ * information in the provided debug publisher configuration.
+ *
+ * @param config
+ * The access publisher configuration that contains the
+ * information to use to initialize this access publisher.
+ * @throws org.opends.server.config.ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws org.opends.server.types.InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
*/
- public abstract void closeAccessLogger();
+ public abstract void initializeAccessLogPublisher(T config)
+ throws ConfigException, InitializationException;
-
+ /**
+ * Close this publisher.
+ */
+ public abstract void close();
/**
* Writes a message to the access logger with information about a
@@ -108,9 +98,9 @@
* the disconnect.
*/
public abstract void
- logDisconnect(ClientConnection clientConnection,
- DisconnectReason disconnectReason,
- String message);
+ logDisconnect(ClientConnection clientConnection,
+ DisconnectReason disconnectReason,
+ String message);
@@ -123,7 +113,7 @@
* request.
*/
public abstract void logAbandonRequest(AbandonOperation
- abandonOperation);
+ abandonOperation);
/**
@@ -135,7 +125,7 @@
* request.
*/
public abstract void logAbandonResult(AbandonOperation
- abandonOperation);
+ abandonOperation);
@@ -194,7 +184,7 @@
* request.
*/
public abstract void logCompareRequest(CompareOperation
- compareOperation);
+ compareOperation);
@@ -207,7 +197,7 @@
* response.
*/
public abstract void logCompareResponse(CompareOperation
- compareOperation);
+ compareOperation);
@@ -220,7 +210,7 @@
* request.
*/
public abstract void logDeleteRequest(DeleteOperation
- deleteOperation);
+ deleteOperation);
@@ -233,7 +223,7 @@
* response.
*/
public abstract void logDeleteResponse(DeleteOperation
- deleteOperation);
+ deleteOperation);
@@ -246,7 +236,7 @@
* request.
*/
public abstract void logExtendedRequest(ExtendedOperation
- extendedOperation);
+ extendedOperation);
@@ -260,7 +250,7 @@
* response.
*/
public abstract void logExtendedResponse(ExtendedOperation
- extendedOperation);
+ extendedOperation);
@@ -273,7 +263,7 @@
* request.
*/
public abstract void logModifyRequest(ModifyOperation
- modifyOperation);
+ modifyOperation);
@@ -286,7 +276,7 @@
* response.
*/
public abstract void logModifyResponse(ModifyOperation
- modifyOperation);
+ modifyOperation);
@@ -300,7 +290,7 @@
* DN request.
*/
public abstract void logModifyDNRequest(ModifyDNOperation
- modifyDNOperation);
+ modifyDNOperation);
@@ -314,7 +304,7 @@
* DN response.
*/
public abstract void logModifyDNResponse(ModifyDNOperation
- modifyDNOperation);
+ modifyDNOperation);
@@ -327,7 +317,7 @@
* request.
*/
public abstract void logSearchRequest(SearchOperation
- searchOperation);
+ searchOperation);
@@ -341,8 +331,8 @@
* @param searchEntry The search result entry to be logged.
*/
public abstract void logSearchResultEntry(
- SearchOperation searchOperation,
- SearchResultEntry searchEntry);
+ SearchOperation searchOperation,
+ SearchResultEntry searchEntry);
@@ -357,8 +347,8 @@
* logged.
*/
public abstract void logSearchResultReference(
- SearchOperation searchOperation,
- SearchResultReference searchReference);
+ SearchOperation searchOperation,
+ SearchResultReference searchReference);
@@ -371,7 +361,7 @@
* result done message.
*/
public abstract void logSearchResultDone(SearchOperation
- searchOperation);
+ searchOperation);
@@ -384,28 +374,4 @@
* request.
*/
public abstract void logUnbind(UnbindOperation unbindOperation);
-
-
-
- /**
- * Indicates whether the provided object is equal to this access
- * logger.
- *
- * @param o The object for which to make the determination.
- *
- * @return <CODE>true</CODE> if the provided object is determined
- * to be equal to this access logger, or <CODE>false</CODE>
- * if not.
- */
- public abstract boolean equals(Object o);
-
-
-
- /**
- * Retrieves the hash code for this access logger.
- *
- * @return The hash code for this access logger.
- */
- public abstract int hashCode();
}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/api/DebugLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/api/DebugLogPublisher.java
new file mode 100644
index 0000000..3bed88c
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/api/DebugLogPublisher.java
@@ -0,0 +1,476 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.api;
+
+import org.opends.server.loggers.LogLevel;
+import org.opends.server.loggers.debug.TraceSettings;
+import org.opends.server.types.*;
+import org.opends.server.admin.std.server.DebugLogPublisherCfg;
+import org.opends.server.config.ConfigException;
+import com.sleepycat.je.Transaction;
+import com.sleepycat.je.Database;
+import com.sleepycat.je.DatabaseEntry;
+import com.sleepycat.je.OperationStatus;
+
+import java.util.*;
+
+/**
+ * This class defines the set of methods and structures that must be
+ * implemented for a Directory Server debug log publisher.
+ *
+ * @param <T> The type of debug log publisher configuration handled
+ * by this log publisher implementation.
+ */
+public abstract class DebugLogPublisher
+ <T extends DebugLogPublisherCfg>
+{
+ //The default global settings key.
+ private static final String GLOBAL= "_global";
+
+ //The map of class names to their trace settings.
+ private Map<String, TraceSettings> classTraceSettings;
+
+ //The map of class names to their method trace settings.
+ private Map<String, Map<String, TraceSettings>> methodTraceSettings;
+
+ /**
+ * Construct a default configuration where the global scope will
+ * only log at the ERROR level.
+ */
+ protected DebugLogPublisher()
+ {
+ classTraceSettings = null;
+ methodTraceSettings = null;
+
+ //Set the global settings so that only errors are logged.
+ addTraceSettings(null, new TraceSettings(DebugLogLevel.ERROR));
+ }
+
+ /**
+ * Initializes this debug publisher provider based on the
+ * information in the provided debug publisher configuration.
+ *
+ * @param config
+ * The debug publisher configuration that contains the
+ * information to use to initialize this debug publisher.
+ * @throws org.opends.server.config.ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws org.opends.server.types.InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public abstract void initializeDebugLogPublisher(T config)
+ throws ConfigException, InitializationException;
+
+ /**
+ * Gets the method trace levels for a specified class.
+ * @param className - a fully qualified class name to get method
+ * trace levels for
+ * @return an unmodifiable map of trace levels keyed by method name.
+ * If no method level tracing is configured for the scope,
+ * <b>null</b> is returned.
+ */
+ public Map<String, TraceSettings> getMethodSettings(
+ String className)
+ {
+ /*if (methodTraceSettings != null) {
+ // Method levels are always at leaves in the
+ // hierarchy, so don't bother searching up.
+ return methodTraceSettings.get(className);
+ }
+ return null;*/
+ return new HashMap<String, TraceSettings>();
+ }
+
+ /**
+ * Get the trace settings for a specified class.
+ * @param className - a fully qualified class name to get the
+ * trace level for
+ * @return the current trace settings for the class.
+ */
+ public TraceSettings getClassSettings(String className)
+ {
+ TraceSettings settings = TraceSettings.DISABLED;
+
+ // If we're not enabled, trace level is DISABLED.
+ if (classTraceSettings != null) {
+ // Find most specific trace setting which covers this
+ // fully qualified class name
+ // Search up the hierarchy for a match.
+ String searchName= className;
+ Object value= null;
+ value= classTraceSettings.get(searchName);
+ while (value == null && searchName != null) {
+ int clipPoint= searchName.lastIndexOf('$');
+ if (clipPoint == -1) clipPoint= searchName.lastIndexOf('.');
+ if (clipPoint != -1) {
+ searchName= searchName.substring(0, clipPoint);
+ value= classTraceSettings.get(searchName);
+ }
+ else {
+ searchName= null;
+ }
+ }
+
+ // Use global settings, if nothing more specific was found.
+ if (value == null) value= classTraceSettings.get(GLOBAL);
+
+ if (value != null) {
+ settings= (TraceSettings)value;
+ }
+ }
+ return settings;
+ }
+
+ /**
+ * Adds a trace settings to the current set for a specified scope.
+ * If a scope is not specified, the settings will be set for the
+ * global scope. The global scope settings are used when no other
+ * scope matches.
+ *
+ * @param scope - the scope to set trace settings for; this is a
+ * fully qualified class name or null to set the trace settings for
+ * the global scope.
+ * @param settings - the trace settings for the scope
+ */
+ public void addTraceSettings(String scope, TraceSettings settings)
+ {
+ if (scope == null) {
+ setClassSettings(GLOBAL, settings);
+ }
+ else {
+ int methodPt= scope.lastIndexOf('#');
+ if (methodPt != -1) {
+ String methodName= scope.substring(methodPt+1);
+ scope= scope.substring(0, methodPt);
+ setMethodSettings(scope, methodName, settings);
+ }
+ else {
+ setClassSettings(scope, settings);
+ }
+ }
+ }
+
+ /**
+ * See if a trace setting is alreadly defined for a particular
+ * scope.
+ *
+ * @param scope - the scope to test; this is a fully
+ * qualified class name or null to set the trace settings for the
+ * globalscope.
+ * @return The trace settings for that scope or null if it doesn't
+ * exist.
+ */
+ public TraceSettings getTraceSettings(String scope)
+ {
+ if (scope == null) {
+ if(classTraceSettings != null)
+ {
+ return classTraceSettings.get(GLOBAL);
+ }
+ return null;
+ }
+ else {
+ int methodPt= scope.lastIndexOf('#');
+ if (methodPt != -1) {
+ String methodName= scope.substring(methodPt+1);
+ scope= scope.substring(0, methodPt);
+ if(methodTraceSettings != null)
+ {
+ Map<String, TraceSettings> methodLevels =
+ methodTraceSettings.get(scope);
+ if(methodLevels != null)
+ {
+ return methodLevels.get(methodName);
+ }
+ return null;
+ }
+ return null;
+ }
+ else {
+ if(classTraceSettings != null)
+ {
+ return classTraceSettings.get(scope);
+ }
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Remove a trace setting by scope.
+ *
+ * @param scope - the scope to remove; this is a fully
+ * qualified class name or null to set the trace settings for the
+ * global scope.
+ * @return The trace settings for that scope or null if it doesn't
+ * exist.
+ */
+ public TraceSettings removeTraceSettings(String scope)
+ {
+ TraceSettings removedSettings = null;
+ if (scope == null) {
+ if(classTraceSettings != null)
+ {
+ removedSettings = classTraceSettings.remove(GLOBAL);
+ }
+ }
+ else {
+ int methodPt= scope.lastIndexOf('#');
+ if (methodPt != -1) {
+ String methodName= scope.substring(methodPt+1);
+ scope= scope.substring(0, methodPt);
+ if(methodTraceSettings != null)
+ {
+ Map<String, TraceSettings> methodLevels =
+ methodTraceSettings.get(scope);
+ if(methodLevels != null)
+ {
+ removedSettings = methodLevels.remove(methodName);
+ if(methodLevels.isEmpty())
+ {
+ methodTraceSettings.remove(scope);
+ }
+ }
+ }
+ }
+ else {
+ if(classTraceSettings != null)
+ {
+ removedSettings = classTraceSettings.remove(scope);
+ }
+ }
+ }
+
+ return removedSettings;
+ }
+
+ /**
+ * Set the trace settings for a class.
+ *
+ * @param className The class name.
+ * @param settings The trace settings for the class.
+ */
+ private synchronized void setClassSettings(String className,
+ TraceSettings settings)
+ {
+ if(classTraceSettings == null) classTraceSettings =
+ new HashMap<String, TraceSettings>();
+
+ classTraceSettings.put(className, settings);
+ }
+
+ /**
+ * Set the method settings for a particular method in a class.
+ *
+ * @param className The class name.
+ * @param methodName The method name.
+ * @param settings The trace settings for the method.
+ */
+ private synchronized void setMethodSettings(String className,
+ String methodName,
+ TraceSettings settings)
+ {
+ if (methodTraceSettings == null) methodTraceSettings =
+ new HashMap<String, Map<String, TraceSettings>>();
+ Map<String, TraceSettings> methodLevels=
+ methodTraceSettings.get(className);
+ if (methodLevels == null) {
+ methodLevels= new TreeMap<String, TraceSettings>();
+ methodTraceSettings.put(className, methodLevels);
+ }
+
+ methodLevels.put(methodName, settings);
+ }
+
+ /**
+ * Log a constructor entry.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param args The parameters provided to the constructor call.
+ */
+ public abstract void traceConstructor(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Object[] args);
+
+ /**
+ * Log a non static method entry.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param obj the object this method operations on.
+ * @param args The parameters provided to the constructor call
+ */
+ public abstract void traceNonStaticMethodEntry(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Object obj,
+ Object[] args);
+
+ /**
+ * Log a static method entry.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param args The parameters provided to the constructor call
+ */
+ public abstract void traceStaticMethodEntry(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Object[] args);
+
+ /**
+ * Log a method return.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param ret the return value of the method.
+ */
+ public abstract void traceReturn(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Object ret);
+
+ /**
+ * Log an arbitrary event in a method.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param msg message to format and log.
+ */
+ public abstract void traceMessage(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ String msg);
+
+ /**
+ * Log a thrown exception in a method.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param ex the exception thrown.
+ */
+ public abstract void traceThrown(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Throwable ex);
+
+ /**
+ * Log a caught exception in a method.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param ex the exception caught.
+ */
+ public abstract void traceCaught(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Throwable ex);
+
+ /**
+ * Log an JE database access in a method.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param status status of the JE operation.
+ * @param database the database handle.
+ * @param txn transaction handle (may be null).
+ * @param key the key to dump.
+ * @param data the data to dump.
+ */
+ public abstract void traceJEAccess(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ OperationStatus status,
+ Database database,
+ Transaction txn,
+ DatabaseEntry key,
+ DatabaseEntry data);
+
+ /**
+ * Log raw data in a method.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param data the data to dump.
+ */
+ public abstract void traceData(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ byte[] data);
+
+ /**
+ * Log a protocol element in a method.
+ *
+ * @param level The level of the log message.
+ * @param settings The current trace settings in effect.
+ * @param signature The constuctor method signature.
+ * @param sourceLocation The location of the method in the source.
+ * @param element the protocol element to dump.
+ */
+ public abstract void traceProtocolElement(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ ProtocolElement element);
+
+ /**
+ * Close this publisher.
+ */
+ public abstract void close();
+}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogPublisher.java
new file mode 100644
index 0000000..beacc1f
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogPublisher.java
@@ -0,0 +1,101 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.api;
+
+import org.opends.server.admin.std.server.ErrorLogPublisherCfg;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+import org.opends.server.types.ErrorLogCategory;
+import org.opends.server.types.ErrorLogSeverity;
+
+import java.util.HashSet;
+import java.util.HashMap;
+
+/**
+ * This class defines the set of methods and structures that must be
+ * implemented for a Directory Server error log publisher.
+ *
+ * @param <T> The type of error log publisher configuration handled
+ * by this log publisher implementation.
+ */
+public abstract class ErrorLogPublisher
+ <T extends ErrorLogPublisherCfg>
+{
+ /**
+ * The hash map that will be used to define specific log severities
+ * for the various categories.
+ */
+ protected HashMap<ErrorLogCategory,HashSet<ErrorLogSeverity>>
+ definedSeverities =
+ new HashMap<ErrorLogCategory, HashSet<ErrorLogSeverity>>();
+
+ /**
+ * The set of default log severities that will be used if no custom
+ * severities have been defined for the associated category.
+ */
+ protected HashSet<ErrorLogSeverity> defaultSeverities =
+ new HashSet<ErrorLogSeverity>();
+ /**
+ * Initializes this access publisher provider based on the
+ * information in the provided debug publisher configuration.
+ *
+ * @param config
+ * The error publisher configuration that contains the
+ * information to use to initialize this error publisher.
+ * @throws org.opends.server.config.ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws org.opends.server.types.InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public abstract void initializeErrorLogPublisher(T config)
+ throws ConfigException, InitializationException;
+
+ /**
+ * Close this publisher.
+ */
+ public abstract void close();
+
+ /**
+ * Writes a message to the error log using the provided information.
+ *
+ * @param category The category that may be used to determine
+ * whether to actually log this message.
+ * @param severity The severity that may be used to determine
+ * whether to actually log this message.
+ * @param message The message to be logged.
+ * @param errorID The error ID that uniquely identifies the
+ * format string used to generate the provided
+ * message.
+ */
+ public abstract void logError(ErrorLogCategory category,
+ ErrorLogSeverity severity,
+ String message, int errorID);
+
+}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogger.java b/opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogger.java
deleted file mode 100644
index 4781f2f..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogger.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.api;
-
-
-
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.config.ConfigException;
-import org.opends.server.types.ErrorLogCategory;
-import org.opends.server.types.ErrorLogSeverity;
-import org.opends.server.types.InitializationException;
-
-
-
-/**
- * This class defines the set of methods and structures that must be
- * implemented for a Directory Server error logger.
- */
-public abstract class ErrorLogger
-{
- /**
- * Initializes this error logger based on the information in the
- * provided configuration entry.
- *
- * @param configEntry The configuration entry that contains the
- * information to use to initialize this error
- * logger.
- *
- * @throws ConfigException If an unrecoverable problem arises in
- * the process of performing the
- * initialization.
- *
- * @throws InitializationException If a problem occurs during
- * initialization that is not
- * related to the server
- * configuration.
- */
- public abstract void initializeErrorLogger(ConfigEntry configEntry)
- throws ConfigException, InitializationException;
-
-
-
- /**
- * Closes this error logger and releases any resources it might have
- * held.
- */
- public abstract void closeErrorLogger();
-
-
-
- /**
- * Writes a message to the error log using the provided information.
- *
- * @param category The category that may be used to determine
- * whether to actually log this message.
- * @param severity The severity that may be used to determine
- * whether to actually log this message.
- * @param message The message to be logged.
- * @param errorID The error ID that uniquely identifies the
- * format string used to generate the provided
- * message.
- */
- public abstract void logError(ErrorLogCategory category,
- ErrorLogSeverity severity,
- String message, int errorID);
-
-
-
- /**
- * Indicates whether the provided object is equal to this error
- * logger.
- *
- * @param o The object for which to make the determination.
- *
- * @return <CODE>true</CODE> if the provided object is determined
- * to be equal to this error logger, or <CODE>false</CODE>
- * if not.
- */
- public abstract boolean equals(Object o);
-
-
-
- /**
- * Retrieves the hash code for this error logger.
- *
- * @return The hash code for this error logger.
- */
- public abstract int hashCode();
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/api/LogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/api/LogPublisher.java
deleted file mode 100644
index 856f371..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/api/LogPublisher.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.api;
-
-
-
-import org.opends.server.loggers.LogRecord;
-import org.opends.server.loggers.LoggerErrorHandler;
-
-
-
-/**
- * LogPublishers are reponsible for distributing logged messages from
- * the Logger object to a destination.
- */
-public interface LogPublisher
-{
- /**
- * Sends the log message to the logging destination. Every
- * LogPublisher must implement the publish method for
- * the generic LogRecord. Specialized LogPublishers should
- * also include an implementation to publish specialized
- * LogRecords (ie. DebugLogRecord).
- *
- * @param record the log record to publish.
- * @param handler the error handler to use when an error occurs.
- */
- public void publish(LogRecord record, LoggerErrorHandler handler);
-
-
-
- /**
- * Releases any resources and prepare for close.
- */
- public void shutdown();
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
index 86a5462..fc4d426 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -32,7 +32,7 @@
import static org.opends.server.messages.AciMessages.*;
import static org.opends.server.authorization.dseecompat.Aci.*;
import org.opends.server.core.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import org.opends.server.types.*;
import static org.opends.server.util.StaticUtils.toLowerCase;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java
index 7c6d913..d472dc6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java
@@ -28,7 +28,7 @@
package org.opends.server.authorization.dseecompat;
import static org.opends.server.messages.AciMessages.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import java.util.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciListenerManager.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciListenerManager.java
index 9841ec6..21fdc80 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciListenerManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciListenerManager.java
@@ -38,7 +38,7 @@
import org.opends.server.protocols.internal.InternalSearchOperation;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import org.opends.server.types.*;
import static org.opends.server.messages.AciMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java
index de14c19..2fed749 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AuthMethod.java
@@ -30,7 +30,7 @@
import static org.opends.server.messages.AciMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import org.opends.server.core.DirectoryServer;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/DNS.java b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/DNS.java
index d67e832..7a31dc2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/DNS.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/DNS.java
@@ -29,7 +29,7 @@
import static org.opends.server.messages.AciMessages.*;
import static org.opends.server.authorization.dseecompat.Aci.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/RootDSEBackend.java b/opendj-sdk/opends/src/server/org/opends/server/backends/RootDSEBackend.java
index df0defc..5b492c5 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/RootDSEBackend.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/RootDSEBackend.java
@@ -76,7 +76,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.BackendMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.ConfigMessages.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java b/opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java
index 4c6c56b..c98fdc9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java
@@ -115,7 +115,7 @@
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.messages.BackendMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
index bd5a2c2..065d5f2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -51,7 +51,7 @@
import static org.opends.server.messages.BackendMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.JebMessages.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackupManager.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackupManager.java
index c085221..65ac7f1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackupManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackupManager.java
@@ -72,7 +72,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.JebMessages.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Config.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Config.java
index 299f7c5..2d54346 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Config.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Config.java
@@ -32,7 +32,7 @@
import static org.opends.server.messages.ConfigMessages.
MSGID_CONFIG_BACKEND_INSANE_MODE;
import static org.opends.server.messages.JebMessages.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.util.StaticUtils.getFileForPath;
import org.opends.server.config.ConfigConstants;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ExportJob.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ExportJob.java
index 6676fb5..bcbe65d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ExportJob.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ExportJob.java
@@ -49,7 +49,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugError;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.MessageHandler.getMessage;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.JebMessages.*;
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ImportJob.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ImportJob.java
index 02120ab..4fa9876 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ImportJob.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ImportJob.java
@@ -62,7 +62,7 @@
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.JebMessages.
MSGID_JEB_IMPORT_PARENT_NOT_FOUND;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.JebMessages.*;
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexMergeThread.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexMergeThread.java
index 8683fd2..1eecd53 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexMergeThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexMergeThread.java
@@ -51,7 +51,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.MessageHandler.getMessage;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.JebMessages.*;
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexRebuildThread.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexRebuildThread.java
index 5284883..ed30b5c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexRebuildThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/IndexRebuildThread.java
@@ -41,7 +41,7 @@
import static org.opends.server.messages.JebMessages.
MSGID_JEB_REBUILD_INSERT_ENTRY_FAILED;
import static org.opends.server.messages.MessageHandler.getMessage;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RebuildJob.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RebuildJob.java
index e4081c5..d17b964 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RebuildJob.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RebuildJob.java
@@ -39,7 +39,7 @@
import com.sleepycat.je.EnvironmentStats;
import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import org.opends.server.core.DirectoryServer;
import static org.opends.server.messages.JebMessages.
MSGID_JEB_ATTRIBUTE_INDEX_NOT_CONFIGURED;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RootContainer.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RootContainer.java
index 572c390..e5663bf 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RootContainer.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/RootContainer.java
@@ -44,7 +44,7 @@
import org.opends.server.types.FilePermission;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/VerifyJob.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/VerifyJob.java
index b1fb472..6f00708 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/VerifyJob.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/VerifyJob.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.backends.jeb;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import com.sleepycat.je.Cursor;
import com.sleepycat.je.CursorConfig;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java b/opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java
index 181d2a1..a45fcf8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java
@@ -56,6 +56,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import org.opends.server.loggers.ErrorLogger;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.BackendMessages.*;
import static org.opends.server.messages.MessageHandler.*;
@@ -801,7 +802,7 @@
String message = MessageHandler.getMessage(errorID);
addLogMessage(severity, errorID, message);
- org.opends.server.loggers.Error.logError(category, severity, errorID);
+ ErrorLogger.logError(category, severity, errorID);
}
@@ -828,7 +829,7 @@
String message = MessageHandler.getMessage(errorID);
addLogMessage(severity, errorID, message);
- org.opends.server.loggers.Error.logError(category, severity, errorID, args);
+ ErrorLogger.logError(category, severity, errorID,args);
}
@@ -852,7 +853,7 @@
int errorID)
{
addLogMessage(severity, errorID, message);
- org.opends.server.loggers.Error.logError(category, severity, message,
+ ErrorLogger.logError(category, severity, message,
errorID);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskScheduler.java b/opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskScheduler.java
index 121b9e0..161d1c0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskScheduler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskScheduler.java
@@ -68,7 +68,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.BackendMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/config/DNConfigAttribute.java b/opendj-sdk/opends/src/server/org/opends/server/config/DNConfigAttribute.java
index f5a303d..da7e202 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/config/DNConfigAttribute.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/config/DNConfigAttribute.java
@@ -47,13 +47,11 @@
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.util.ServerConstants.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/config/IntegerConfigAttribute.java b/opendj-sdk/opends/src/server/org/opends/server/config/IntegerConfigAttribute.java
index 9b6b213..a47a39f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/config/IntegerConfigAttribute.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/config/IntegerConfigAttribute.java
@@ -46,13 +46,11 @@
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.util.ServerConstants.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/config/IntegerWithUnitConfigAttribute.java b/opendj-sdk/opends/src/server/org/opends/server/config/IntegerWithUnitConfigAttribute.java
index 1acb755..631451c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/config/IntegerWithUnitConfigAttribute.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/config/IntegerWithUnitConfigAttribute.java
@@ -49,11 +49,9 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.util.ServerConstants.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/config/JMXMBean.java b/opendj-sdk/opends/src/server/org/opends/server/config/JMXMBean.java
index fc624e0..f9f65f8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/config/JMXMBean.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/config/JMXMBean.java
@@ -69,7 +69,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/config/MultiChoiceConfigAttribute.java b/opendj-sdk/opends/src/server/org/opends/server/config/MultiChoiceConfigAttribute.java
index a5e156f..804f99d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/config/MultiChoiceConfigAttribute.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/config/MultiChoiceConfigAttribute.java
@@ -49,11 +49,9 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.util.ServerConstants.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/config/ReadOnlyConfigAttribute.java b/opendj-sdk/opends/src/server/org/opends/server/config/ReadOnlyConfigAttribute.java
index 4ea5097..f4fcb79 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/config/ReadOnlyConfigAttribute.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/config/ReadOnlyConfigAttribute.java
@@ -42,11 +42,8 @@
import org.opends.server.types.AttributeValue;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.util.ServerConstants.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/config/StringConfigAttribute.java b/opendj-sdk/opends/src/server/org/opends/server/config/StringConfigAttribute.java
index ea6d2cf..d2b530c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/config/StringConfigAttribute.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/config/StringConfigAttribute.java
@@ -48,7 +48,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java
index 27002d8..144fa7e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java
@@ -43,7 +43,7 @@
import org.opends.server.types.operation.PreParseAbandonOperation;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/AccessControlConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/AccessControlConfigManager.java
index 2fcc334..1099b57 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/AccessControlConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/AccessControlConfigManager.java
@@ -29,7 +29,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java
index e550251..42af572 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java
@@ -92,11 +92,11 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/BackendConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/BackendConfigManager.java
index 0fbc90e..7acd8b9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/BackendConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/BackendConfigManager.java
@@ -45,7 +45,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
index 554470a..23dda16 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
@@ -73,10 +73,10 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/CertificateMapperConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/CertificateMapperConfigManager.java
index c79315d..93bf9c2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/CertificateMapperConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/CertificateMapperConfigManager.java
@@ -50,7 +50,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java
index 9af18f1..7ec40cf 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java
@@ -67,7 +67,7 @@
import org.opends.server.types.operation.PreParseCompareOperation;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/CoreConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/CoreConfigManager.java
index fa345c1..7df95c2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/CoreConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/CoreConfigManager.java
@@ -57,7 +57,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java
index 4a4f7f3..d86dd24 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java
@@ -73,11 +73,11 @@
import org.opends.server.types.operation.PreParseDeleteOperation;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java b/opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java
index 336d878..2ab979d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -60,7 +60,10 @@
import org.opends.server.config.JMXMBean;
import org.opends.server.extensions.ConfigFileHandler;
import org.opends.server.extensions.JMXAlertHandler;
-import org.opends.server.loggers.StartupErrorLogger;
+import org.opends.server.loggers.TextErrorLogPublisher;
+import org.opends.server.loggers.TextWriter;
+import org.opends.server.loggers.RetentionPolicy;
+import org.opends.server.loggers.RotationPolicy;
import org.opends.server.monitors.BackendMonitor;
import org.opends.server.monitors.ConnectionHandlerMonitor;
import org.opends.server.schema.*;
@@ -76,10 +79,11 @@
import org.opends.server.util.args.StringArgument;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Access.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.schema.SchemaConstants.*;
@@ -274,6 +278,16 @@
// The set of trust manager providers registered with the server.
private ConcurrentHashMap<DN,TrustManagerProvider> trustManagerProviders;
+ // The set of log rotation policies registered with the Directory Server, as
+ // a mapping between the DN of the associated configuration entry and the
+ // policy implementation.
+ private ConcurrentHashMap<DN, RotationPolicy> rotationPolicies;
+
+ // The set of log retention policies registered with the Directory Server, as
+ // a mapping between the DN of the associated configuration entry and the
+ // policy implementation.
+ private ConcurrentHashMap<DN, RetentionPolicy> retentionPolicies;
+
// The set of extended operation handlers registered with the server (mapped
// between the OID of the extended operation and the handler).
private ConcurrentHashMap<String,ExtendedOperationHandler>
@@ -407,6 +421,12 @@
// with the server offline.
private List<Modification> offlineSchemaChanges;
+ // The log rotation policy config manager for the Directory Server.
+ private LogRotationPolicyConfigManager rotationPolicyConfigManager;
+
+ // The log retention policy config manager for the Directory Server.
+ private LogRetentionPolicyConfigManager retentionPolicyConfigManager;
+
// The logger configuration manager for the Directory Server.
private LoggerConfigManager loggerConfigManager;
@@ -472,7 +492,7 @@
// The error logger that will be used during the Directory Server startup.
- private StartupErrorLogger startupErrorLogger;
+ private TextErrorLogPublisher startupErrorLogPublisher;
// The fully-qualified name of the configuration handler class.
private String configClass;
@@ -612,6 +632,10 @@
new ConcurrentHashMap<DN,KeyManagerProvider>();
directoryServer.trustManagerProviders =
new ConcurrentHashMap<DN,TrustManagerProvider>();
+ directoryServer.rotationPolicies =
+ new ConcurrentHashMap<DN, RotationPolicy>();
+ directoryServer.retentionPolicies =
+ new ConcurrentHashMap<DN, RetentionPolicy>();
directoryServer.certificateMappers =
new ConcurrentHashMap<DN,CertificateMapper>();
directoryServer.passwordPolicies =
@@ -711,11 +735,10 @@
// Install default debug and error loggers for use until enough of the
// configuration has been read to allow the real loggers to be installed.
- removeAllErrorLoggers(true);
- startupErrorLogger = new StartupErrorLogger();
- startupErrorLogger.initializeErrorLogger(null);
- addErrorLogger(startupErrorLogger);
-
+ startupErrorLogPublisher =
+ TextErrorLogPublisher.getStartupTextErrorPublisher(
+ new TextWriter.STDOUT());
+ addErrorLogPublisher(DN.NULL_DN, startupErrorLogPublisher);
// Create the MBean server that we will use for JMX interaction.
initializeJMX();
@@ -992,9 +1015,17 @@
initializeCryptoManager();
+ // Initialize the log rotation policies.
+ rotationPolicyConfigManager = new LogRotationPolicyConfigManager();
+ rotationPolicyConfigManager.initializeLogRotationPolicyConfig();
+
+ // Initialize the log retention policies.
+ retentionPolicyConfigManager = new LogRetentionPolicyConfigManager();
+ retentionPolicyConfigManager.initializeLogRetentionPolicyConfig();
+
// Initialize the server loggers.
loggerConfigManager = new LoggerConfigManager();
- loggerConfigManager.initializeLoggers();
+ loggerConfigManager.initializeLoggerConfig();
@@ -1125,7 +1156,8 @@
sendAlertNotification(this, ALERT_TYPE_SERVER_STARTED, msgID, message);
- removeErrorLogger(startupErrorLogger);
+ removeDebugLogPublisher(DN.NULL_DN);
+ removeErrorLogPublisher(DN.NULL_DN);
// If a server.starting file exists, then remove it.
@@ -5050,6 +5082,105 @@
}
+ /**
+ * Retrieves the log rotation policy registered for the provided configuration
+ * entry.
+ *
+ * @param configEntryDN The DN of the configuration entry for which to
+ * retrieve the associated rotation policy.
+ *
+ * @return The rotation policy registered for the provided configuration
+ * entry, or <CODE>null</CODE> if there is no such policy.
+ */
+ public static RotationPolicy getRotationPolicy(DN configEntryDN)
+ {
+ Validator.ensureNotNull(configEntryDN);
+
+ return directoryServer.rotationPolicies.get(configEntryDN);
+ }
+
+ /**
+ * Registers the provided log rotation policy with the Directory Server. If a
+ * policy is already registered for the provided configuration entry DN, then
+ * it will be replaced.
+ *
+ * @param configEntryDN The DN of the configuration entry that defines the
+ * password policy.
+ * @param policy The rotation policy to register with the server.
+ */
+ public static void registerRotationPolicy(DN configEntryDN,
+ RotationPolicy policy)
+ {
+ Validator.ensureNotNull(configEntryDN, policy);
+
+ directoryServer.rotationPolicies.put(configEntryDN, policy);
+ }
+
+
+
+ /**
+ * Deregisters the provided log rotation policy with the Directory Server.
+ * If no such policy is registered, then no action will be taken.
+ *
+ * @param configEntryDN The DN of the configuration entry that defines the
+ * rotation policy to deregister.
+ */
+ public static void deregisterRotationPolicy(DN configEntryDN)
+ {
+ Validator.ensureNotNull(configEntryDN);
+
+ directoryServer.rotationPolicies.remove(configEntryDN);
+ }
+
+ /**
+ * Retrieves the log retention policy registered for the provided
+ * configuration entry.
+ *
+ * @param configEntryDN The DN of the configuration entry for which to
+ * retrieve the associated retention policy.
+ *
+ * @return The retention policy registered for the provided configuration
+ * entry, or <CODE>null</CODE> if there is no such policy.
+ */
+ public static RetentionPolicy getRetentionPolicy(DN configEntryDN)
+ {
+ Validator.ensureNotNull(configEntryDN);
+
+ return directoryServer.retentionPolicies.get(configEntryDN);
+ }
+
+ /**
+ * Registers the provided log retention policy with the Directory Server.
+ * If a policy is already registered for the provided configuration entry DN,
+ * then it will be replaced.
+ *
+ * @param configEntryDN The DN of the configuration entry that defines the
+ * password policy.
+ * @param policy The retention policy to register with the server.
+ */
+ public static void registerRetentionPolicy(DN configEntryDN,
+ RetentionPolicy policy)
+ {
+ Validator.ensureNotNull(configEntryDN, policy);
+
+ directoryServer.retentionPolicies.put(configEntryDN, policy);
+ }
+
+
+
+ /**
+ * Deregisters the provided log retention policy with the Directory Server.
+ * If no such policy is registered, then no action will be taken.
+ *
+ * @param configEntryDN The DN of the configuration entry that defines the
+ * retention policy to deregister.
+ */
+ public static void deregisterRetentionPolicy(DN configEntryDN)
+ {
+ Validator.ensureNotNull(configEntryDN);
+
+ directoryServer.retentionPolicies.remove(configEntryDN);
+ }
/**
* Retrieves the set of monitor providers that have been registered with the
@@ -7947,21 +8078,6 @@
}
}
-
- // Shut down all the access loggers.
- try
- {
- removeAllAccessLoggers(true);
- }
- catch (Exception e)
- {
- if (debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
- }
-
-
// Release the exclusive lock for the Directory Server process.
String lockFile = LockFileManager.getServerLockFileName();
try
@@ -7995,31 +8111,9 @@
logError(ErrorLogCategory.CORE_SERVER, ErrorLogSeverity.NOTICE,
MSGID_SERVER_STOPPED);
- try
- {
- removeAllErrorLoggers(true);
- }
- catch (Exception e)
- {
- if (debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
- }
-
-
- // The JDK logger doesn't allow you to deregister things, so we have to
- // reset it. This is necessary to avoid exceptions if you perform an
- // in-core restart or stop the server and start a new instance in the same
- // JVM (which currently isn't possible through any means other than an
- // in-core restart but might be exposed at some point).
- //
- // FIXME -- This could cause problems with an application that's embedding
- // OpenDS and also using the JDK logger. The solution for this
- // will come once we have rewritten the loggers so that we no
- // longer use the JDK logging framework.
- java.util.logging.LogManager.getLogManager().reset();
-
+ removeAllAccessLogPublishers();
+ removeAllErrorLogPublishers();
+ removeAllDebugLogPublishers();
// Just in case there's something that isn't shut down properly, wait for
// the monitor to give the OK to stop.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/EntryCacheConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/EntryCacheConfigManager.java
index b53d33b..cc06e6d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/EntryCacheConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/EntryCacheConfigManager.java
@@ -44,7 +44,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java
index 8cb1471..e708a31 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java
@@ -52,7 +52,7 @@
import org.opends.server.types.operation.PreParseExtendedOperation;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/GroupManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/GroupManager.java
index b1f5f71..5fb29f9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/GroupManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/GroupManager.java
@@ -71,12 +71,10 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/IdentityMapperConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/IdentityMapperConfigManager.java
index 466ad21..c2dc95d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/IdentityMapperConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/IdentityMapperConfigManager.java
@@ -50,7 +50,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java
index 599899e..a696f29 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/KeyManagerProviderConfigManager.java
@@ -55,7 +55,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/LogRetentionPolicyConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/LogRetentionPolicyConfigManager.java
new file mode 100644
index 0000000..86cda49
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/LogRetentionPolicyConfigManager.java
@@ -0,0 +1,292 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.core;
+
+import org.opends.server.admin.std.server.LogRetentionPolicyCfg;
+import org.opends.server.admin.std.server.RootCfg;
+import org.opends.server.admin.std.meta.LogRetentionPolicyCfgDefn;
+import org.opends.server.admin.server.ConfigurationAddListener;
+import org.opends.server.admin.server.ServerManagementContext;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.server.ConfigurationDeleteListener;
+import org.opends.server.admin.ClassPropertyDefinition;
+import org.opends.server.types.InitializationException;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.ResultCode;
+import org.opends.server.types.DebugLogLevel;
+import org.opends.server.loggers.RetentionPolicy;
+import org.opends.server.config.ConfigException;
+
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
+import static org.opends.server.messages.MessageHandler.getMessage;
+import static org.opends.server.messages.ConfigMessages.*;
+import static org.opends.server.util.StaticUtils.*;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * This class defines a utility that will be used to manage the set of
+ * log retention policies used in the Directory Server. It will perform the
+ * initialization when the server is starting, and then will manage any
+ * additions, and removals of policies while the server is running.
+ */
+public class LogRetentionPolicyConfigManager implements
+ ConfigurationAddListener<LogRetentionPolicyCfg>,
+ ConfigurationDeleteListener<LogRetentionPolicyCfg>,
+ ConfigurationChangeListener<LogRetentionPolicyCfg>
+{
+
+ /**
+ * Initializes all the log retention policies.
+ *
+ * @throws ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public void initializeLogRetentionPolicyConfig()
+ throws ConfigException, InitializationException
+ {
+ ServerManagementContext context = ServerManagementContext.getInstance();
+ RootCfg root = context.getRootConfiguration();
+
+ root.addLogRetentionPolicyAddListener(this);
+ root.addLogRetentionPolicyDeleteListener(this);
+
+ for(String name : root.listLogRetentionPolicies())
+ {
+ LogRetentionPolicyCfg config = root.getLogRetentionPolicy(name);
+
+ RetentionPolicy RetentionPolicy = getRetentionPolicy(config);
+
+ DirectoryServer.registerRetentionPolicy(config.dn(), RetentionPolicy);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationAddAcceptable(
+ LogRetentionPolicyCfg configuration,
+ List<String> unacceptableReasons)
+ {
+ return isJavaClassAcceptable(configuration, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationDeleteAcceptable(
+ LogRetentionPolicyCfg configuration,
+ List<String> unacceptableReasons)
+ {
+ // TODO: Make sure nothing is using this policy before deleting it.
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationAdd(LogRetentionPolicyCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ try
+ {
+ RetentionPolicy RetentionPolicy = getRetentionPolicy(config);
+
+ DirectoryServer.registerRetentionPolicy(config.dn(), RetentionPolicy);
+ }
+ catch (ConfigException e) {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ messages.add(e.getMessage());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ } catch (Exception e) {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ int msgID = MSGID_CONFIG_RETENTION_POLICY_CANNOT_CREATE_POLICY;
+ messages.add(getMessage(msgID, String.valueOf(config.dn().toString()),
+ stackTraceToSingleLineString(e)));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationDelete(
+ LogRetentionPolicyCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(config.dn());
+ if(policy != null)
+ {
+ DirectoryServer.deregisterRetentionPolicy(config.dn());
+ }
+ else
+ {
+ // TODO: Add message and check for usage
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ LogRetentionPolicyCfg configuration,
+ List<String> unacceptableReasons)
+ {
+ return isJavaClassAcceptable(configuration, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ LogRetentionPolicyCfg configuration)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ RetentionPolicy policy =
+ DirectoryServer.getRetentionPolicy(configuration.dn());
+ String className = configuration.getJavaImplementationClass();
+ if(!className.equals(policy.getClass().getName()))
+ {
+ adminActionRequired = true;
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ private boolean isJavaClassAcceptable(LogRetentionPolicyCfg config,
+ List<String> unacceptableReasons)
+ {
+ String className = config.getJavaImplementationClass();
+ LogRetentionPolicyCfgDefn d = LogRetentionPolicyCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a RetentionPolicy.
+ Class<? extends RetentionPolicy> theClass;
+ try {
+ theClass = pd.loadClass(className, RetentionPolicy.class);
+ theClass.newInstance();
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_RETENTION_POLICY_INVALID_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // Check that the implementation class implements the correct interface.
+ try {
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ theClass.getMethod("initializeLogRetentionPolicy", config.definition()
+ .getServerConfigurationClass());
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_RETENTION_POLICY_INVALID_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // The class is valid as far as we can tell.
+ return true;
+ }
+
+ private RetentionPolicy getRetentionPolicy(LogRetentionPolicyCfg config)
+ throws ConfigException {
+ String className = config.getJavaImplementationClass();
+ LogRetentionPolicyCfgDefn d = LogRetentionPolicyCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a RetentionPolicy.
+ Class<? extends RetentionPolicy> theClass;
+ RetentionPolicy RetentionPolicy;
+ try {
+ theClass = pd.loadClass(className, RetentionPolicy.class);
+ RetentionPolicy = theClass.newInstance();
+
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ Method method = theClass.getMethod("initializeLogRetentionPolicy",
+ config.definition().getServerConfigurationClass());
+ method.invoke(RetentionPolicy, config);
+ }
+ catch (InvocationTargetException ite)
+ {
+ // Rethrow the exceptions thrown be the invoked method.
+ Throwable e = ite.getTargetException();
+ int msgID = MSGID_CONFIG_RETENTION_POLICY_INVALID_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ throw new ConfigException(msgID, message, e);
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_RETENTION_POLICY_INVALID_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ throw new ConfigException(msgID, message, e);
+ }
+
+ // The connection handler has been successfully initialized.
+ return RetentionPolicy;
+ }
+}
+
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/LogRotationPolicyConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/LogRotationPolicyConfigManager.java
new file mode 100644
index 0000000..80d82f1
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/LogRotationPolicyConfigManager.java
@@ -0,0 +1,291 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.core;
+
+import org.opends.server.loggers.RotationPolicy;
+import org.opends.server.admin.server.ConfigurationAddListener;
+import org.opends.server.admin.server.ConfigurationDeleteListener;
+import org.opends.server.admin.server.ServerManagementContext;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.std.server.LogRotationPolicyCfg;
+import org.opends.server.admin.std.server.RootCfg;
+import org.opends.server.admin.std.meta.LogRotationPolicyCfgDefn;
+import org.opends.server.admin.ClassPropertyDefinition;
+import org.opends.server.types.InitializationException;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.ResultCode;
+import org.opends.server.types.DebugLogLevel;
+import org.opends.server.config.ConfigException;
+
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
+import static org.opends.server.messages.MessageHandler.getMessage;
+import static org.opends.server.messages.ConfigMessages.*;
+import static org.opends.server.util.StaticUtils.*;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * This class defines a utility that will be used to manage the set of
+ * log rotation policies used in the Directory Server. It will perform the
+ * initialization when the server is starting, and then will manage any
+ * additions, and removals of policies while the server is running.
+ */
+public class LogRotationPolicyConfigManager implements
+ ConfigurationAddListener<LogRotationPolicyCfg>,
+ ConfigurationDeleteListener<LogRotationPolicyCfg>,
+ ConfigurationChangeListener<LogRotationPolicyCfg>
+{
+
+ /**
+ * Initializes all the log rotation policies.
+ *
+ * @throws ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public void initializeLogRotationPolicyConfig()
+ throws ConfigException, InitializationException
+ {
+ ServerManagementContext context = ServerManagementContext.getInstance();
+ RootCfg root = context.getRootConfiguration();
+
+ root.addLogRotationPolicyAddListener(this);
+ root.addLogRotationPolicyDeleteListener(this);
+
+ for(String name : root.listLogRotationPolicies())
+ {
+ LogRotationPolicyCfg config = root.getLogRotationPolicy(name);
+
+ RotationPolicy rotationPolicy = getRotationPolicy(config);
+
+ DirectoryServer.registerRotationPolicy(config.dn(), rotationPolicy);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationAddAcceptable(
+ LogRotationPolicyCfg configuration,
+ List<String> unacceptableReasons)
+ {
+ return isJavaClassAcceptable(configuration, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationDeleteAcceptable(
+ LogRotationPolicyCfg configuration,
+ List<String> unacceptableReasons)
+ {
+ // TODO: Make sure nothing is using this policy before deleting it.
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationAdd(LogRotationPolicyCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ try
+ {
+ RotationPolicy rotationPolicy = getRotationPolicy(config);
+
+ DirectoryServer.registerRotationPolicy(config.dn(), rotationPolicy);
+ }
+ catch (ConfigException e) {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ messages.add(e.getMessage());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ } catch (Exception e) {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ int msgID = MSGID_CONFIG_ROTATION_POLICY_CANNOT_CREATE_POLICY;
+ messages.add(getMessage(msgID, String.valueOf(config.dn().toString()),
+ stackTraceToSingleLineString(e)));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationDelete(
+ LogRotationPolicyCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(config.dn());
+ if(policy != null)
+ {
+ DirectoryServer.deregisterRotationPolicy(config.dn());
+ }
+ else
+ {
+ // TODO: Add message and check for usage
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ LogRotationPolicyCfg configuration,
+ List<String> unacceptableReasons)
+ {
+ return isJavaClassAcceptable(configuration, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ LogRotationPolicyCfg configuration)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ RotationPolicy policy =
+ DirectoryServer.getRotationPolicy(configuration.dn());
+ String className = configuration.getJavaImplementationClass();
+ if(!className.equals(policy.getClass().getName()))
+ {
+ adminActionRequired = true;
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ private boolean isJavaClassAcceptable(LogRotationPolicyCfg config,
+ List<String> unacceptableReasons)
+ {
+ String className = config.getJavaImplementationClass();
+ LogRotationPolicyCfgDefn d = LogRotationPolicyCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a RotationPolicy.
+ Class<? extends RotationPolicy> theClass;
+ try {
+ theClass = pd.loadClass(className, RotationPolicy.class);
+ theClass.newInstance();
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_ROTATION_POLICY_INVALID_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // Check that the implementation class implements the correct interface.
+ try {
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ theClass.getMethod("initializeLogRotationPolicy", config.definition()
+ .getServerConfigurationClass());
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_ROTATION_POLICY_INVALID_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // The class is valid as far as we can tell.
+ return true;
+ }
+
+ private RotationPolicy getRotationPolicy(LogRotationPolicyCfg config)
+ throws ConfigException {
+ String className = config.getJavaImplementationClass();
+ LogRotationPolicyCfgDefn d = LogRotationPolicyCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a RotationPolicy.
+ Class<? extends RotationPolicy> theClass;
+ RotationPolicy rotationPolicy;
+ try {
+ theClass = pd.loadClass(className, RotationPolicy.class);
+ rotationPolicy = theClass.newInstance();
+
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ Method method = theClass.getMethod("initializeLogRotationPolicy",
+ config.definition().getServerConfigurationClass());
+ method.invoke(rotationPolicy, config);
+ }
+ catch (InvocationTargetException ite)
+ {
+ // Rethrow the exceptions thrown be the invoked method.
+ Throwable e = ite.getTargetException();
+ int msgID = MSGID_CONFIG_ROTATION_POLICY_INVALID_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ throw new ConfigException(msgID, message, e);
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_ROTATION_POLICY_INVALID_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ throw new ConfigException(msgID, message, e);
+ }
+
+ // The connection handler has been successfully initialized.
+ return rotationPolicy;
+ }
+}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/LoggerConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/LoggerConfigManager.java
index eb54351..d359aa3 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/LoggerConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/LoggerConfigManager.java
@@ -28,41 +28,20 @@
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.*;
-import org.opends.server.api.AccessLogger;
-import org.opends.server.api.ConfigAddListener;
-import org.opends.server.api.ConfigChangeListener;
-import org.opends.server.api.ConfigDeleteListener;
-import org.opends.server.api.ConfigHandler;
-import org.opends.server.api.ConfigurableComponent;
-import org.opends.server.api.ErrorLogger;
-import org.opends.server.config.BooleanConfigAttribute;
-import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
-import org.opends.server.config.StringConfigAttribute;
-import org.opends.server.loggers.StartupErrorLogger;
-import org.opends.server.types.ConfigChangeResult;
-import org.opends.server.types.DN;
-import org.opends.server.types.ErrorLogCategory;
-import org.opends.server.types.ErrorLogSeverity;
-import org.opends.server.types.InitializationException;
-import org.opends.server.types.ResultCode;
-import org.opends.server.types.DebugLogLevel;
+import org.opends.server.types.*;
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Access.*;
-import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import org.opends.server.loggers.debug.DebugLogger;
+import org.opends.server.loggers.ErrorLogger;
+import org.opends.server.loggers.AccessLogger;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.util.ServerConstants.*;
-
+import org.opends.server.admin.std.server.*;
+import org.opends.server.admin.server.ConfigurationAddListener;
+import org.opends.server.admin.server.ConfigurationDeleteListener;
+import org.opends.server.admin.server.ServerManagementContext;
/**
@@ -71,1225 +50,204 @@
* the server is starting, and then will manage any additions, removals, or
* modifications of any loggers while the server is running.
*/
-public class LoggerConfigManager
- implements ConfigChangeListener, ConfigAddListener, ConfigDeleteListener
+public class LoggerConfigManager implements
+ ConfigurationAddListener<LogPublisherCfg>,
+ ConfigurationDeleteListener<LogPublisherCfg>
{
- /**
- * The fully-qualified name of this class for debugging purposes.
- */
- private static final String CLASS_NAME =
- "org.opends.server.core.LoggerConfigManager";
-
-
-
- // A mapping between the DNs of the logger configuration entries and the
- // associated active access loggers.
- private ConcurrentHashMap<DN,AccessLogger> activeAccessLoggers;
-
- // A mapping between the DNs of the logger configuration entries and the
- // associated active error loggers.
- private ConcurrentHashMap<DN,ErrorLogger> activeErrorLoggers;
-
- // The configuration handler for the Directory Server.
- private ConfigHandler configHandler;
-
-
/**
- * Creates a new instance of this logger config manager.
- */
- public LoggerConfigManager()
- {
- configHandler = DirectoryServer.getConfigHandler();
-
- activeAccessLoggers = new ConcurrentHashMap<DN,AccessLogger>();
- activeErrorLoggers = new ConcurrentHashMap<DN,ErrorLogger>();
- }
-
-
-
- /**
- * Initializes all loggers currently defined in the Directory Server
- * configuration. This should only be called at Directory Server startup.
+ * Initializes all the log publishers.
*
- * @throws ConfigException If a configuration problem causes the monitor
- * initialization process to fail.
- *
- * @throws InitializationException If a problem occurs while initializing
- * the monitors that is not related to the
- * server configuration.
+ * @throws ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
*/
- public void initializeLoggers()
- throws ConfigException, InitializationException
+ public void initializeLoggerConfig()
+ throws ConfigException, InitializationException
{
- // First, get the logger configuration base entry.
- ConfigEntry loggerBaseEntry;
- try
+ // Create an internal server management context and retrieve
+ // the root configuration which has the log publisher relation.
+ ServerManagementContext context = ServerManagementContext.getInstance();
+ RootCfg root = context.getRootConfiguration();
+
+ root.addLogPublisherAddListener(this);
+ root.addLogPublisherAddListener(this);
+
+ List<DebugLogPublisherCfg> debugPublisherCfgs =
+ new ArrayList<DebugLogPublisherCfg>();
+
+ List<AccessLogPublisherCfg> accessPublisherCfgs =
+ new ArrayList<AccessLogPublisherCfg>();
+
+ List<ErrorLogPublisherCfg> errorPublisherCfgs =
+ new ArrayList<ErrorLogPublisherCfg>();
+
+ for (String name : root.listLogPublishers())
{
- DN loggerBaseDN = DN.decode(DN_LOGGER_BASE);
- loggerBaseEntry = configHandler.getConfigEntry(loggerBaseDN);
- }
- catch (Exception e)
- {
- if(debugEnabled())
+ LogPublisherCfg config = root.getLogPublisher(name);
+
+ if(config instanceof DebugLogPublisherCfg)
{
- debugCaught(DebugLogLevel.ERROR, e);
+ debugPublisherCfgs.add((DebugLogPublisherCfg)config);
}
-
- int msgID = MSGID_CONFIG_LOGGER_CANNOT_GET_BASE;
- String message = getMessage(msgID, String.valueOf(e));
- throw new ConfigException(msgID, message, e);
- }
-
- if (loggerBaseEntry == null)
- {
- // The logger base entry does not exist. This is not acceptable, so throw
- // an exception.
- int msgID = MSGID_CONFIG_LOGGER_BASE_DOES_NOT_EXIST;
- String message = getMessage(msgID);
- throw new ConfigException(msgID, message);
- }
-
-
- // Register add and delete listeners with the logger base entry. We don't
- // care about modifications to it.
- loggerBaseEntry.registerAddListener(this);
- loggerBaseEntry.registerDeleteListener(this);
-
-
- // See if the logger base has any children. If not, then log a warning.
- if (! loggerBaseEntry.hasChildren())
- {
- logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.SEVERE_WARNING,
- MSGID_CONFIG_LOGGER_NO_ACTIVE_ACCESS_LOGGERS);
- logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.SEVERE_WARNING,
- MSGID_CONFIG_LOGGER_NO_ACTIVE_ERROR_LOGGERS);
- logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.MILD_WARNING,
- MSGID_CONFIG_LOGGER_NO_ACTIVE_DEBUG_LOGGERS);
- return;
- }
-
-
- // Iterate through the child entries and process them as logger
- // configuration entries.
- for (ConfigEntry childEntry : loggerBaseEntry.getChildren().values())
- {
- if(!childEntry.hasObjectClass(OC_DEBUG_LOGGER))
+ else if(config instanceof AccessLogPublisherCfg)
{
- childEntry.registerChangeListener(this);
-
- StringBuilder unacceptableReason = new StringBuilder();
- if (! configAddIsAcceptable(childEntry, unacceptableReason))
- {
- logError(ErrorLogCategory.CONFIGURATION,
- ErrorLogSeverity.SEVERE_ERROR,
- MSGID_CONFIG_LOGGER_ENTRY_UNACCEPTABLE,
- childEntry.getDN().toString(),
- unacceptableReason.toString());
- continue;
- }
-
- try
- {
- ConfigChangeResult result = applyConfigurationAdd(childEntry);
- if (result.getResultCode() != ResultCode.SUCCESS)
- {
- StringBuilder buffer = new StringBuilder();
-
- List<String> resultMessages = result.getMessages();
- if ((resultMessages == null) || (resultMessages.isEmpty()))
- {
- buffer.append(
- getMessage(MSGID_CONFIG_UNKNOWN_UNACCEPTABLE_REASON));
- }
- else
- {
- Iterator<String> iterator = resultMessages.iterator();
-
- buffer.append(iterator.next());
- while (iterator.hasNext())
- {
- buffer.append(EOL);
- buffer.append(iterator.next());
- }
- }
-
- logError(ErrorLogCategory.CONFIGURATION,
- ErrorLogSeverity.SEVERE_ERROR,
- MSGID_CONFIG_LOGGER_CANNOT_CREATE_LOGGER,
- childEntry.getDN().toString(), buffer.toString());
- }
- }
- catch (Exception e)
- {
- logError(ErrorLogCategory.CONFIGURATION,
- ErrorLogSeverity.SEVERE_ERROR,
- MSGID_CONFIG_LOGGER_CANNOT_CREATE_LOGGER,
- childEntry.getDN().toString(), String.valueOf(e));
- }
+ accessPublisherCfgs.add((AccessLogPublisherCfg)config);
+ }
+ else if(config instanceof ErrorLogPublisherCfg)
+ {
+ errorPublisherCfgs.add((ErrorLogPublisherCfg)config);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_OBJECTCLASS;
+ String message = getMessage(msgID, String.valueOf(config.dn()));
+ throw new ConfigException(msgID, message);
}
}
-
// See if there are active loggers in all categories. If not, then log a
// message.
- if (activeAccessLoggers.isEmpty())
+ if (accessPublisherCfgs.isEmpty())
{
- logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.SEVERE_WARNING,
- MSGID_CONFIG_LOGGER_NO_ACTIVE_ACCESS_LOGGERS);
+ ErrorLogger.logError(ErrorLogCategory.CONFIGURATION,
+ ErrorLogSeverity.SEVERE_WARNING,
+ MSGID_CONFIG_LOGGER_NO_ACTIVE_ACCESS_LOGGERS);
+ }
+ if (errorPublisherCfgs.isEmpty())
+ {
+ ErrorLogger.logError(ErrorLogCategory.CONFIGURATION,
+ ErrorLogSeverity.SEVERE_WARNING,
+ MSGID_CONFIG_LOGGER_NO_ACTIVE_ERROR_LOGGERS);
}
- if (activeErrorLoggers.isEmpty())
- {
- logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.SEVERE_WARNING,
- MSGID_CONFIG_LOGGER_NO_ACTIVE_ERROR_LOGGERS);
- }
+ DebugLogger.getInstance().initializeDebugLogger(debugPublisherCfgs);
+ AccessLogger.getInstance().initializeAccessLogger(accessPublisherCfgs);
+ ErrorLogger.getInstance().initializeErrorLogger(errorPublisherCfgs);
}
-
-
/**
- * Stops and closes all loggers associated with the Directory Server. It will
- * replace them with startup error and debug loggers so that any final
- * messages logged by the server after this call may still be captured on
- * standard error.
+ * {@inheritDoc}
*/
- public void stopLoggers()
+ public boolean isConfigurationAddAcceptable(LogPublisherCfg config,
+ List<String> unacceptableReasons)
{
- StartupErrorLogger errorLogger = new StartupErrorLogger();
- errorLogger.initializeErrorLogger(null);
-
- removeAllErrorLoggers(true);
- addErrorLogger(errorLogger);
-
- }
-
-
-
- /**
- * Indicates whether the configuration entry that will result from a proposed
- * modification is acceptable to this change listener.
- *
- * @param configEntry The configuration entry that will result from
- * the requested update.
- * @param unacceptableReason A buffer to which this method can append a
- * human-readable message explaining why the
- * proposed change is not acceptable.
- *
- * @return <CODE>true</CODE> if the proposed entry contains an acceptable
- * configuration, or <CODE>false</CODE> if it does not.
- */
- public boolean configChangeIsAcceptable(ConfigEntry configEntry,
- StringBuilder unacceptableReason)
- {
- // Make sure that the entry has an appropriate objectclass for an access,
- // error, or debug logger.
- boolean isAccessLogger = false;
- boolean isErrorLogger = false;
- boolean isDebugLogger = false;
- if (configEntry.hasObjectClass(OC_ACCESS_LOGGER))
+ if(config instanceof DebugLogPublisherCfg)
{
- isAccessLogger = true;
+ return DebugLogger.getInstance().isConfigurationAddAcceptable(
+ (DebugLogPublisherCfg)config, unacceptableReasons);
}
- else if (configEntry.hasObjectClass(OC_ERROR_LOGGER))
- {
- isErrorLogger = true;
- }
- else if (configEntry.hasObjectClass(OC_DEBUG_LOGGER))
- {
- isDebugLogger = true;
- }
+ else if(config instanceof AccessLogPublisherCfg)
+ {
+ return AccessLogger.getInstance().isConfigurationAddAcceptable(
+ (AccessLogPublisherCfg)config, unacceptableReasons);
+ }
+ else if(config instanceof ErrorLogPublisherCfg)
+ {
+ return ErrorLogger.getInstance().isConfigurationAddAcceptable(
+ (ErrorLogPublisherCfg)config, unacceptableReasons);
+ }
else
{
int msgID = MSGID_CONFIG_LOGGER_INVALID_OBJECTCLASS;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReason.append(message);
+ unacceptableReasons.add(getMessage(msgID, String.valueOf(config.dn())));
return false;
}
-
-
- // Make sure that the entry specifies the logger class name.
- StringConfigAttribute classNameAttr;
- try
- {
- StringConfigAttribute classStub =
- new StringConfigAttribute(ATTR_LOGGER_CLASS,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- classNameAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(classStub);
-
- if (classNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_CLASS_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReason.append(message);
- return false;
- }
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_CLASS_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
-
- Class loggerClass;
- try
- {
- loggerClass = DirectoryServer.loadClass(classNameAttr.pendingValue());
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_CLASS_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
-
- if (isAccessLogger)
- {
- try
- {
- AccessLogger logger = (AccessLogger) loggerClass.newInstance();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
- String message = getMessage(msgID, loggerClass.getName(),
- configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
- }
- else if (isErrorLogger)
- {
- try
- {
- ErrorLogger logger = (ErrorLogger) loggerClass.newInstance();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
- String message = getMessage(msgID, loggerClass.getName(),
- configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
- }
- else if (isDebugLogger)
- {
- }
-
-
- // See if this logger entry should be enabled.
- BooleanConfigAttribute enabledAttr;
- try
- {
- BooleanConfigAttribute enabledStub =
- new BooleanConfigAttribute(ATTR_LOGGER_ENABLED,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_ENABLED), false);
- enabledAttr = (BooleanConfigAttribute)
- configEntry.getConfigAttribute(enabledStub);
-
- if (enabledAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_ENABLED_ATTR;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReason.append(message);
- return false;
- }
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ENABLED_VALUE;
- String message = getMessage(msgID, configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
-
-
- // If we've gotten here then the logger entry appears to be acceptable.
- return true;
}
-
-
/**
- * Attempts to apply a new configuration to this Directory Server component
- * based on the provided changed entry.
- *
- * @param configEntry The configuration entry that containing the updated
- * configuration for this component.
- *
- * @return Information about the result of processing the configuration
- * change.
+ * {@inheritDoc}
*/
- public ConfigChangeResult applyConfigurationChange(ConfigEntry configEntry)
+ public ConfigChangeResult applyConfigurationAdd(LogPublisherCfg config)
{
- DN configEntryDN = configEntry.getDN();
- ResultCode resultCode = ResultCode.SUCCESS;
- boolean adminActionRequired = false;
- ArrayList<String> messages = new ArrayList<String>();
-
-
- // Make sure that the entry has an appropriate objectclass for an access,
- // error, or debug logger.
- boolean isAccessLogger = false;
- boolean isErrorLogger = false;
- boolean isDebugLogger = false;
- if (configEntry.hasObjectClass(OC_ACCESS_LOGGER))
+ if(config instanceof DebugLogPublisherCfg)
{
- isAccessLogger = true;
+ return DebugLogger.getInstance().applyConfigurationAdd(
+ (DebugLogPublisherCfg)config);
}
- else if (configEntry.hasObjectClass(OC_ERROR_LOGGER))
- {
- isErrorLogger = true;
- }
- else if (configEntry.hasObjectClass(OC_DEBUG_LOGGER))
- {
- isDebugLogger = true;
- }
+ else if(config instanceof AccessLogPublisherCfg)
+ {
+ return AccessLogger.getInstance().applyConfigurationAdd(
+ (AccessLogPublisherCfg)config);
+ }
+ else if(config instanceof ErrorLogPublisherCfg)
+ {
+ return ErrorLogger.getInstance().applyConfigurationAdd(
+ (ErrorLogPublisherCfg)config);
+ }
else
{
int msgID = MSGID_CONFIG_LOGGER_INVALID_OBJECTCLASS;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN)));
- resultCode = ResultCode.UNWILLING_TO_PERFORM;
+ ArrayList<String> messages = new ArrayList<String>();
+ boolean adminActionRequired = false;
+ messages.add(getMessage(msgID, String.valueOf(config.dn())));
+ ResultCode resultCode = ResultCode.UNWILLING_TO_PERFORM;
return new ConfigChangeResult(resultCode, adminActionRequired, messages);
}
-
-
- // Get the corresponding logger if it is active.
- boolean isActive = false;
- AccessLogger accessLogger = null;
- ErrorLogger errorLogger = null;
- if (isAccessLogger)
- {
- accessLogger = activeAccessLoggers.get(configEntryDN);
- isActive = (accessLogger != null);
- }
- else if (isErrorLogger)
- {
- errorLogger = activeErrorLoggers.get(configEntryDN);
- isActive = (errorLogger != null);
- }
-
-
- // See if this logger should be enabled or disabled.
- boolean needsEnabled = false;
- BooleanConfigAttribute enabledAttr;
- try
- {
- BooleanConfigAttribute enabledStub =
- new BooleanConfigAttribute(ATTR_LOGGER_ENABLED,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_ENABLED), false);
- enabledAttr = (BooleanConfigAttribute)
- configEntry.getConfigAttribute(enabledStub);
-
- if (enabledAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_ENABLED_ATTR;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN)));
- resultCode = ResultCode.UNWILLING_TO_PERFORM;
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
- if (enabledAttr.activeValue())
- {
- if (isActive)
- {
- // The logger is already active, so no action is required.
- }
- else
- {
- needsEnabled = true;
- }
- }
- else
- {
- if (isActive)
- {
- // The logger is active, so it needs to be disabled. Do this and
- // return that we were successful.
- if (isAccessLogger)
- {
- activeAccessLoggers.remove(configEntryDN);
- accessLogger.closeAccessLogger();
- }
- else if (isErrorLogger)
- {
- activeErrorLoggers.remove(configEntryDN);
- errorLogger.closeErrorLogger();
- }
-
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
- else
- {
- // The logger is already disabled, so no action is required and we
- // can short-circuit out of this processing.
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
- }
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ENABLED_VALUE;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
- }
-
-
- // Make sure that the entry specifies the logger class name. If it has
- // changed, then we will not try to dynamically apply it.
- String className;
- try
- {
- StringConfigAttribute classStub =
- new StringConfigAttribute(ATTR_LOGGER_CLASS,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- StringConfigAttribute classNameAttr =
- (StringConfigAttribute) configEntry.getConfigAttribute(classStub);
-
- if (classNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_CLASS_NAME;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN)));
- resultCode = ResultCode.OBJECTCLASS_VIOLATION;
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
- className = classNameAttr.pendingValue();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_CLASS_NAME;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
- }
-
-
- boolean classChanged = false;
- String oldClassName = null;
- if (! (needsEnabled || (accessLogger == null) && (errorLogger == null) ))
- {
- if (isAccessLogger)
- {
- oldClassName = accessLogger.getClass().getName();
- classChanged = (! className.equals(oldClassName));
- }
- else if (isErrorLogger)
- {
- oldClassName = errorLogger.getClass().getName();
- classChanged = (! className.equals(oldClassName));
- }
- }
-
-
- if (classChanged)
- {
- // This will not be applied dynamically. Add a message to the response
- // and indicate that admin action is required.
- adminActionRequired = true;
- messages.add(getMessage(MSGID_CONFIG_LOGGER_CLASS_ACTION_REQUIRED,
- String.valueOf(oldClassName),
- String.valueOf(className),
- String.valueOf(configEntryDN)));
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
- }
-
-
- // If the monitor needs to be enabled, then create it and register it with
- // the Directory Server.
- if (needsEnabled)
- {
- if (isAccessLogger)
- {
- try
- {
- Class loggerClass = DirectoryServer.loadClass(className);
- accessLogger = (AccessLogger) loggerClass.newInstance();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
- messages.add(getMessage(msgID, className,
- String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
- try
- {
- accessLogger.initializeAccessLogger(configEntry);
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_ACCESS_INITIALIZATION_FAILED;
- messages.add(getMessage(msgID, className,
- String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
- addAccessLogger(accessLogger);
- activeAccessLoggers.put(configEntryDN, accessLogger);
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
- else if (isErrorLogger)
- {
- try
- {
- Class loggerClass = DirectoryServer.loadClass(className);
- errorLogger = (ErrorLogger) loggerClass.newInstance();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
- messages.add(getMessage(msgID, className,
- String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
- try
- {
- errorLogger.initializeErrorLogger(configEntry);
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_ERROR_INITIALIZATION_FAILED;
- messages.add(getMessage(msgID, className,
- String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
- addErrorLogger(errorLogger);
- activeErrorLoggers.put(configEntryDN, errorLogger);
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
- else
- {
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
- }
-
-
- // If we've gotten here, then there haven't been any changes to anything
- // that we care about.
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
}
-
-
/**
- * Indicates whether the configuration entry that will result from a proposed
- * add is acceptable to this add listener.
- *
- * @param configEntry The configuration entry that will result from
- * the requested add.
- * @param unacceptableReason A buffer to which this method can append a
- * human-readable message explaining why the
- * proposed entry is not acceptable.
- *
- * @return <CODE>true</CODE> if the proposed entry contains an acceptable
- * configuration, or <CODE>false</CODE> if it does not.
+ * {@inheritDoc}
*/
- public boolean configAddIsAcceptable(ConfigEntry configEntry,
- StringBuilder unacceptableReason)
+ public boolean isConfigurationDeleteAcceptable(LogPublisherCfg config,
+ List<String> unacceptableReasons)
{
- // Make sure that no entry already exists with the specified DN.
- DN configEntryDN = configEntry.getDN();
- if (activeAccessLoggers.containsKey(configEntryDN) ||
- activeErrorLoggers.containsKey(configEntryDN) )
+ if(config instanceof DebugLogPublisherCfg)
{
- int msgID = MSGID_CONFIG_LOGGER_EXISTS;
- String message = getMessage(msgID, String.valueOf(configEntryDN));
- unacceptableReason.append(message);
- return false;
+ return DebugLogger.getInstance().isConfigurationDeleteAcceptable(
+ (DebugLogPublisherCfg)config, unacceptableReasons);
}
-
-
- // Make sure that the entry has an appropriate objectclass for an access,
- // error, or debug logger.
- boolean isAccessLogger = false;
- boolean isErrorLogger = false;
- boolean isDebugLogger = false;
- if (configEntry.hasObjectClass(OC_ACCESS_LOGGER))
- {
- isAccessLogger = true;
- }
- else if (configEntry.hasObjectClass(OC_ERROR_LOGGER))
- {
- isErrorLogger = true;
- }
- else if (configEntry.hasObjectClass(OC_DEBUG_LOGGER))
- {
- isDebugLogger = true;
- }
+ else if(config instanceof AccessLogPublisherCfg)
+ {
+ return AccessLogger.getInstance().isConfigurationDeleteAcceptable(
+ (AccessLogPublisherCfg)config, unacceptableReasons);
+ }
+ else if(config instanceof ErrorLogPublisherCfg)
+ {
+ return ErrorLogger.getInstance().isConfigurationDeleteAcceptable(
+ (ErrorLogPublisherCfg)config, unacceptableReasons);
+ }
else
{
int msgID = MSGID_CONFIG_LOGGER_INVALID_OBJECTCLASS;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReason.append(message);
+ unacceptableReasons.add(getMessage(msgID, String.valueOf(config.dn())));
return false;
}
-
-
- // Make sure that the entry specifies the logger class name.
- StringConfigAttribute classNameAttr;
- try
- {
- StringConfigAttribute classStub =
- new StringConfigAttribute(ATTR_LOGGER_CLASS,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- classNameAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(classStub);
-
- if (classNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_CLASS_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReason.append(message);
- return false;
- }
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_CLASS_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
-
- Class loggerClass;
- try
- {
- loggerClass = DirectoryServer.loadClass(classNameAttr.pendingValue());
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_CLASS_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
-
-
- Object logger = null;
- if (isAccessLogger)
- {
- try
- {
- logger = (AccessLogger) loggerClass.newInstance();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
- String message = getMessage(msgID, loggerClass.getName(),
- configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
- }
- else if (isErrorLogger)
- {
- try
- {
- logger = (ErrorLogger) loggerClass.newInstance();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
- String message = getMessage(msgID, loggerClass.getName(),
- configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
- }
- else if (isDebugLogger)
- {
- }
-
-
- // If the logger is a configurable component, then make sure that its
- // configuration is valid.
- if (logger instanceof ConfigurableComponent)
- {
- ConfigurableComponent cc = (ConfigurableComponent) logger;
- LinkedList<String> errorMessages = new LinkedList<String>();
- if (! cc.hasAcceptableConfiguration(configEntry, errorMessages))
- {
- if (errorMessages.isEmpty())
- {
- int msgID = MSGID_CONFIG_LOGGER_UNACCEPTABLE_CONFIG;
- unacceptableReason.append(getMessage(msgID,
- String.valueOf(configEntryDN)));
- }
- else
- {
- Iterator<String> iterator = errorMessages.iterator();
- unacceptableReason.append(iterator.next());
- while (iterator.hasNext())
- {
- unacceptableReason.append(" ");
- unacceptableReason.append(iterator.next());
- }
- }
-
- return false;
- }
- }
-
-
- // See if this logger entry should be enabled.
- BooleanConfigAttribute enabledAttr;
- try
- {
- BooleanConfigAttribute enabledStub =
- new BooleanConfigAttribute(ATTR_LOGGER_ENABLED,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_ENABLED), false);
- enabledAttr = (BooleanConfigAttribute)
- configEntry.getConfigAttribute(enabledStub);
-
- if (enabledAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_ENABLED_ATTR;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReason.append(message);
- return false;
- }
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ENABLED_VALUE;
- String message = getMessage(msgID, configEntry.getDN().toString(),
- String.valueOf(e));
- unacceptableReason.append(message);
- return false;
- }
-
-
- // If we've gotten here then the logger entry appears to be acceptable.
- return true;
}
-
-
/**
- * Attempts to apply a new configuration based on the provided added entry.
- *
- * @param configEntry The new configuration entry that contains the
- * configuration to apply.
- *
- * @return Information about the result of processing the configuration
- * change.
+ * {@inheritDoc}
*/
- public ConfigChangeResult applyConfigurationAdd(ConfigEntry configEntry)
+ public ConfigChangeResult applyConfigurationDelete(LogPublisherCfg config)
{
- DN configEntryDN = configEntry.getDN();
- ResultCode resultCode = ResultCode.SUCCESS;
- boolean adminActionRequired = false;
- ArrayList<String> messages = new ArrayList<String>();
-
-
- // Make sure that the entry has an appropriate objectclass for an access,
- // error, or debug logger.
- boolean isAccessLogger = false;
- boolean isErrorLogger = false;
- boolean isDebugLogger = false;
- if (configEntry.hasObjectClass(OC_ACCESS_LOGGER))
+ if(config instanceof DebugLogPublisherCfg)
{
- isAccessLogger = true;
+ return DebugLogger.getInstance().applyConfigurationDelete(
+ (DebugLogPublisherCfg)config);
}
- else if (configEntry.hasObjectClass(OC_ERROR_LOGGER))
- {
- isErrorLogger = true;
- }
- else if (configEntry.hasObjectClass(OC_DEBUG_LOGGER))
- {
- isDebugLogger = true;
- }
+ else if(config instanceof AccessLogPublisherCfg)
+ {
+ return AccessLogger.getInstance().applyConfigurationDelete(
+ (AccessLogPublisherCfg)config);
+ }
+ else if(config instanceof ErrorLogPublisherCfg)
+ {
+ return ErrorLogger.getInstance().applyConfigurationDelete(
+ (ErrorLogPublisherCfg)config);
+ }
else
{
int msgID = MSGID_CONFIG_LOGGER_INVALID_OBJECTCLASS;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN)));
- resultCode = ResultCode.UNWILLING_TO_PERFORM;
+ ArrayList<String> messages = new ArrayList<String>();
+ boolean adminActionRequired = false;
+ messages.add(getMessage(msgID, String.valueOf(config.dn())));
+ ResultCode resultCode = ResultCode.UNWILLING_TO_PERFORM;
return new ConfigChangeResult(resultCode, adminActionRequired, messages);
}
-
-
- // See if this logger should be enabled or disabled.
- BooleanConfigAttribute enabledAttr;
- try
- {
- BooleanConfigAttribute enabledStub =
- new BooleanConfigAttribute(ATTR_LOGGER_ENABLED,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_ENABLED), false);
- enabledAttr = (BooleanConfigAttribute)
- configEntry.getConfigAttribute(enabledStub);
-
- if (enabledAttr == null)
- {
- // The attribute doesn't exist, so it will be disabled by default.
- int msgID = MSGID_CONFIG_LOGGER_NO_ENABLED_ATTR;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN)));
- resultCode = ResultCode.SUCCESS;
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
- else if (! enabledAttr.activeValue())
- {
- // It is explicitly configured as disabled, so we don't need to do
- // anything.
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ENABLED_VALUE;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
- }
-
-
- // Make sure that the entry specifies the logger class name.
- String className;
- try
- {
- StringConfigAttribute classStub =
- new StringConfigAttribute(ATTR_LOGGER_CLASS,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- StringConfigAttribute classNameAttr =
- (StringConfigAttribute) configEntry.getConfigAttribute(classStub);
-
- if (classNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_CLASS_NAME;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN)));
- resultCode = ResultCode.OBJECTCLASS_VIOLATION;
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
- className = classNameAttr.pendingValue();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_CLASS_NAME;
- messages.add(getMessage(msgID, String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
- }
-
-
- // If this is supposed to be an access logger, then load and initialize the
- // class, and register it with the Directory Server.
- if (isAccessLogger)
- {
- AccessLogger accessLogger;
-
- try
- {
- Class loggerClass = DirectoryServer.loadClass(className);
- accessLogger = (AccessLogger) loggerClass.newInstance();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
- messages.add(getMessage(msgID, className, String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
-
- try
- {
- accessLogger.initializeAccessLogger(configEntry);
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_ACCESS_INITIALIZATION_FAILED;
- messages.add(getMessage(msgID, className, String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
-
- addAccessLogger(accessLogger);
- activeAccessLoggers.put(configEntryDN, accessLogger);
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
- }
-
-
- // If this is supposed to be an error logger, then load and initialize the
- // class, and register it with the Directory Server.
- else if (isErrorLogger)
- {
- ErrorLogger errorLogger;
-
- try
- {
- Class loggerClass = DirectoryServer.loadClass(className);
- errorLogger = (ErrorLogger) loggerClass.newInstance();
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
- messages.add(getMessage(msgID, className, String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
-
- try
- {
- errorLogger.initializeErrorLogger(configEntry);
- }
- catch (Exception e)
- {
- if(debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- int msgID = MSGID_CONFIG_LOGGER_ERROR_INITIALIZATION_FAILED;
- messages.add(getMessage(msgID, className, String.valueOf(configEntryDN),
- String.valueOf(e)));
- resultCode = DirectoryServer.getServerErrorResultCode();
- return new ConfigChangeResult(resultCode, adminActionRequired,
- messages);
- }
-
-
- addErrorLogger(errorLogger);
- activeErrorLoggers.put(configEntryDN, errorLogger);
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
- }
-
-
- // If this is supposed to be a debug logger, then load and initialize the
- // class, and register it with the Directory Server.
- else
- {
- return new ConfigChangeResult(resultCode, adminActionRequired, messages);
- }
- }
-
-
-
- /**
- * Indicates whether it is acceptable to remove the provided configuration
- * entry.
- *
- * @param configEntry The configuration entry that will be removed
- * from the configuration.
- * @param unacceptableReason A buffer to which this method can append a
- * human-readable message explaining why the
- * proposed delete is not acceptable.
- *
- * @return <CODE>true</CODE> if the proposed entry may be removed from the
- * configuration, or <CODE>false</CODE> if not.
- */
- public boolean configDeleteIsAcceptable(ConfigEntry configEntry,
- StringBuilder unacceptableReason)
- {
- // A delete should always be acceptable, so just return true.
- return true;
- }
-
-
-
- /**
- * Attempts to apply a new configuration based on the provided deleted entry.
- *
- * @param configEntry The new configuration entry that has been deleted.
- *
- * @return Information about the result of processing the configuration
- * change.
- */
- public ConfigChangeResult applyConfigurationDelete(ConfigEntry configEntry)
- {
- DN configEntryDN = configEntry.getDN();
- ResultCode resultCode = ResultCode.SUCCESS;
- boolean adminActionRequired = false;
-
-
- // See if the entry is registered as an access logger. If so, deregister it
- // and stop the logger.
- AccessLogger accessLogger = activeAccessLoggers.remove(configEntryDN);
- if (accessLogger != null)
- {
- removeAccessLogger(accessLogger);
- accessLogger.closeAccessLogger();
- return new ConfigChangeResult(resultCode, adminActionRequired);
- }
-
-
- // See if the entry is registered as an error logger. If so, deregister it
- // and stop the logger.
- ErrorLogger errorLogger = activeErrorLoggers.remove(configEntryDN);
- if (errorLogger != null)
- {
- removeErrorLogger(errorLogger);
- errorLogger.closeErrorLogger();
- return new ConfigChangeResult(resultCode, adminActionRequired);
- }
-
-
-
-
- // If we've gotten here, then it wasn't an active logger so we can just
- // return without doing anything.
- return new ConfigChangeResult(resultCode, adminActionRequired);
}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java
index ff73df2..ad9a6a8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java
@@ -82,11 +82,11 @@
import org.opends.server.types.operation.PreParseModifyDNOperation;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
index 3eb12a8..77b7222 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
@@ -97,11 +97,10 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.CoreMessages.*;
-import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/MonitorConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/MonitorConfigManager.java
index 8c885cc..bdd17ce 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/MonitorConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/MonitorConfigManager.java
@@ -55,7 +55,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java
index 2cba184..1b7e169 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/PasswordGeneratorConfigManager.java
@@ -50,7 +50,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/PasswordValidatorConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/PasswordValidatorConfigManager.java
index eec576b..6069980 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/PasswordValidatorConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/PasswordValidatorConfigManager.java
@@ -50,7 +50,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/PluginConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/PluginConfigManager.java
index 829b63e..bad8f83 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/PluginConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/PluginConfigManager.java
@@ -78,7 +78,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.PluginMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/RootDNConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/RootDNConfigManager.java
index 94bd55a..10b38fe 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/RootDNConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/RootDNConfigManager.java
@@ -59,7 +59,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/SASLConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/SASLConfigManager.java
index f46d42a..3cbd037 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/SASLConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/SASLConfigManager.java
@@ -50,7 +50,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java
index 5009aa0..8db2e53 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java
@@ -76,7 +76,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java
index bca3da7..3998182 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java
@@ -79,7 +79,7 @@
import org.opends.server.util.TimeThread;
import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java
index e093d72..aea33a8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/TrustManagerProviderConfigManager.java
@@ -55,7 +55,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java
index 336a745..03b920a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java
@@ -41,7 +41,7 @@
import org.opends.server.types.operation.PostOperationUnbindOperation;
import org.opends.server.types.operation.PreParseUnbindOperation;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/VirtualAttributeConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/VirtualAttributeConfigManager.java
index fc4ce4f..c895ab6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/VirtualAttributeConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/VirtualAttributeConfigManager.java
@@ -55,7 +55,7 @@
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandler.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandler.java
index 403086d..c2539f5 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/AnonymousSASLMechanismHandler.java
@@ -40,7 +40,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
index 156a272..9e937d0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -108,7 +108,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.extensions.ExtensionsConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java
index 91f9df0..cb377fc 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java
@@ -70,7 +70,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroup.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroup.java
index b348072..c31bb32 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroup.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroup.java
@@ -55,7 +55,7 @@
import org.opends.server.types.SearchScope;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroupSearchThread.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroupSearchThread.java
index c780fd6..c6850d9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroupSearchThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroupSearchThread.java
@@ -48,7 +48,7 @@
import org.opends.server.types.SearchResultReference;
import org.opends.server.types.SearchScope;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/EntryCacheCommon.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/EntryCacheCommon.java
index 703f188..af0f3ab 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/EntryCacheCommon.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/EntryCacheCommon.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.extensions;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandler.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandler.java
index 8ebc86d..ee68bd1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/ErrorLogAccountStatusNotificationHandler.java
@@ -29,7 +29,7 @@
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/MD5PasswordStorageScheme.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/MD5PasswordStorageScheme.java
index 45990df..3e791c8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/MD5PasswordStorageScheme.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/MD5PasswordStorageScheme.java
@@ -49,7 +49,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java
index d09ff37..c7ea84e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java
@@ -49,7 +49,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java
index ccc3a51..99dd271 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java
@@ -50,7 +50,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageScheme.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageScheme.java
index e7b685e..7fc0669 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageScheme.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageScheme.java
@@ -50,7 +50,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java
index 7315e4b..ac9b965 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java
@@ -50,7 +50,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageScheme.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageScheme.java
index 62290e9..c46726c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageScheme.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageScheme.java
@@ -50,7 +50,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageScheme.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageScheme.java
index a852301..75ef26c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageScheme.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageScheme.java
@@ -49,7 +49,7 @@
import static org.opends.server.extensions.ExtensionsConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidator.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidator.java
index f4f7b11..079034c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidator.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidator.java
@@ -42,12 +42,8 @@
import org.opends.server.admin.std.server.SimilarityBasedPasswordValidatorCfg;
import org.opends.server.admin.server.ConfigurationChangeListener;
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java
index 26e9950..2711dcb 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/StartTLSExtendedOperation.java
@@ -43,7 +43,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/StaticGroup.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/StaticGroup.java
index 4a553cf..81e0e05 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/StaticGroup.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/StaticGroup.java
@@ -60,7 +60,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
index b0e7cec..c35971f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
@@ -58,7 +58,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ConfigMessages.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
index 2cffc9a..f320e74 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
@@ -41,7 +41,7 @@
import org.opends.server.types.Operation;
import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/Access.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/Access.java
deleted file mode 100644
index 38c5ba7..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/Access.java
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-
-
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.opends.server.api.AccessLogger;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.core.AbandonOperation;
-import org.opends.server.core.AddOperation;
-import org.opends.server.core.BindOperation;
-import org.opends.server.core.CompareOperation;
-import org.opends.server.core.DeleteOperation;
-import org.opends.server.core.ExtendedOperation;
-import org.opends.server.core.ModifyOperation;
-import org.opends.server.core.ModifyDNOperation;
-import org.opends.server.core.SearchOperation;
-import org.opends.server.core.UnbindOperation;
-import org.opends.server.types.DisconnectReason;
-import org.opends.server.types.SearchResultEntry;
-import org.opends.server.types.SearchResultReference;
-
-
-
-/**
- * This class defines the wrapper that will invoke all registered access loggers
- * for each type of request received or response sent.
- */
-public class Access
-{
- // The set of access loggers that have been registered with the server. It
- // will initially be empty.
- private static CopyOnWriteArrayList<AccessLogger> accessLoggers =
- new CopyOnWriteArrayList<AccessLogger>();
-
- // A mutex that will be used to provide threadsafe access to methods changing
- // the set of defined loggers.
- private static ReentrantLock loggerMutex = new ReentrantLock();
-
-
-
- /**
- * Adds a new access logger to which access messages should be sent.
- *
- * @param logger The access logger to which messages should be sent.
- */
- public static void addAccessLogger(AccessLogger logger)
- {
- loggerMutex.lock();
-
- try
- {
- for (AccessLogger l : accessLoggers)
- {
- if (l.equals(logger))
- {
- return;
- }
- }
-
- accessLoggers.add(logger);
- }
- catch (Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- loggerMutex.unlock();
- }
- }
-
-
-
- /**
- * Removes the provided access logger so it will no longer be sent any new
- * access messages.
- *
- * @param logger The access logger to remove from the set.
- */
- public static void removeAccessLogger(AccessLogger logger)
- {
- loggerMutex.lock();
-
- try
- {
- accessLoggers.remove(logger);
- }
- catch (Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- loggerMutex.unlock();
- }
- }
-
-
-
- /**
- * Removes all active access loggers so that no access messages will be sent
- * anywhere.
- *
- * @param closeLoggers Indicates whether the loggers should be closed as
- * they are unregistered.
- */
- public static void removeAllAccessLoggers(boolean closeLoggers)
- {
- loggerMutex.lock();
-
- try
- {
- if (closeLoggers)
- {
- AccessLogger[] loggers = new AccessLogger[accessLoggers.size()];
- accessLoggers.toArray(loggers);
-
- accessLoggers.clear();
-
- for (AccessLogger logger : loggers)
- {
- logger.closeAccessLogger();
- }
- }
- else
- {
- accessLoggers.clear();
- }
- }
- catch (Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- loggerMutex.unlock();
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about a new client
- * connection that has been established, regardless of whether it will be
- * immediately terminated.
- *
- * @param clientConnection The client connection that has been established.
- */
- public static void logConnect(ClientConnection clientConnection)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logConnect(clientConnection);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the
- * termination of an existing client connection.
- *
- * @param clientConnection The client connection that has been terminated.
- * @param disconnectReason A generic disconnect reason for the connection
- * termination.
- * @param message A human-readable message that can provide
- * additional information about the disconnect.
- */
- public static void logDisconnect(ClientConnection clientConnection,
- DisconnectReason disconnectReason,
- String message)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logDisconnect(clientConnection, disconnectReason, message);
- }
- }
-
-
- /**
- * Writes a message to the access logger with information about the abandon
- * request associated with the provided abandon operation.
- *
- * @param abandonOperation The abandon operation containing the information
- * to use to log the abandon request.
- */
- public static void logAbandonRequest(AbandonOperation abandonOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logAbandonRequest(abandonOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the result of
- * the provided abandon operation.
- *
- * @param abandonOperation The abandon operation containing the information
- * to use to log the abandon result.
- */
- public static void logAbandonResult(AbandonOperation abandonOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logAbandonResult(abandonOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the add
- * request associated with the provided add operation.
- *
- * @param addOperation The add operation containing the information to use
- * to log the add request.
- */
- public static void logAddRequest(AddOperation addOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logAddRequest(addOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the add
- * response associated with the provided add operation.
- *
- * @param addOperation The add operation containing the information to use
- * to log the add response.
- */
- public static void logAddResponse(AddOperation addOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logAddResponse(addOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the bind
- * request associated with the provided bind operation.
- *
- * @param bindOperation The bind operation containing the information to use
- * to log the bind request.
- */
- public static void logBindRequest(BindOperation bindOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logBindRequest(bindOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the bind
- * response associated with the provided bind operation.
- *
- * @param bindOperation The bind operation containing the information to use
- * to log the bind response.
- */
- public static void logBindResponse(BindOperation bindOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logBindResponse(bindOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the compare
- * request associated with the provided compare operation.
- *
- * @param compareOperation The compare operation containing the information
- * to use to log the compare request.
- */
- public static void logCompareRequest(CompareOperation compareOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logCompareRequest(compareOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the compare
- * response associated with the provided compare operation.
- *
- * @param compareOperation The compare operation containing the information
- * to use to log the compare response.
- */
- public static void logCompareResponse(CompareOperation compareOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logCompareResponse(compareOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the delete
- * request associated with the provided delete operation.
- *
- * @param deleteOperation The delete operation containing the information to
- * use to log the delete request.
- */
- public static void logDeleteRequest(DeleteOperation deleteOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logDeleteRequest(deleteOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the delete
- * response associated with the provided delete operation.
- *
- * @param deleteOperation The delete operation containing the information to
- * use to log the delete response.
- */
- public static void logDeleteResponse(DeleteOperation deleteOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logDeleteResponse(deleteOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the extended
- * request associated with the provided extended operation.
- *
- * @param extendedOperation The extended operation containing the
- * information to use to log the extended request.
- */
- public static void logExtendedRequest(ExtendedOperation extendedOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logExtendedRequest(extendedOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the extended
- * response associated with the provided extended operation.
- *
- * @param extendedOperation The extended operation containing the
- * information to use to log the extended response.
- */
- public static void logExtendedResponse(ExtendedOperation extendedOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logExtendedResponse(extendedOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the modify
- * request associated with the provided modify operation.
- *
- * @param modifyOperation The modify operation containing the information to
- * use to log the modify request.
- */
- public static void logModifyRequest(ModifyOperation modifyOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logModifyRequest(modifyOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the modify
- * response associated with the provided modify operation.
- *
- * @param modifyOperation The modify operation containing the information to
- * use to log the modify response.
- */
- public static void logModifyResponse(ModifyOperation modifyOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logModifyResponse(modifyOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the modify DN
- * request associated with the provided modify DN operation.
- *
- * @param modifyDNOperation The modify DN operation containing the
- * information to use to log the modify DN request.
- */
- public static void logModifyDNRequest(ModifyDNOperation modifyDNOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logModifyDNRequest(modifyDNOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the modify DN
- * response associated with the provided modify DN operation.
- *
- * @param modifyDNOperation The modify DN operation containing the
- * information to use to log the modify DN
- * response.
- */
- public static void logModifyDNResponse(ModifyDNOperation modifyDNOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logModifyDNResponse(modifyDNOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the search
- * request associated with the provided search operation.
- *
- * @param searchOperation The search operation containing the information to
- * use to log the search request.
- */
- public static void logSearchRequest(SearchOperation searchOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logSearchRequest(searchOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the search
- * result entry that matches the criteria associated with the provided search
- * operation.
- *
- * @param searchOperation The search operation with which the search result
- * entry is associated.
- * @param searchEntry The search result entry to be logged.
- */
- public static void logSearchResultEntry(SearchOperation searchOperation,
- SearchResultEntry searchEntry)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logSearchResultEntry(searchOperation, searchEntry);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the search
- * result reference returned while processing the associated search operation.
- *
- * @param searchOperation The search operation with which the search result
- * reference is associated.
- * @param searchReference The search result reference to be logged.
- */
- public static void logSearchResultReference(SearchOperation searchOperation,
- SearchResultReference searchReference)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logSearchResultReference(searchOperation, searchReference);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the completion
- * of the provided search operation.
- *
- * @param searchOperation The search operation containing the information
- * to use to log the search result done message.
- */
- public static void logSearchResultDone(SearchOperation searchOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logSearchResultDone(searchOperation);
- }
- }
-
-
-
- /**
- * Writes a message to the access logger with information about the unbind
- * request associated with the provided unbind operation.
- *
- * @param unbindOperation The unbind operation containing the information to
- * use to log the unbind request.
- */
- public static void logUnbind(UnbindOperation unbindOperation)
- {
- for (AccessLogger l : accessLoggers)
- {
- l.logUnbind(unbindOperation);
- }
- }
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/AccessLogger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/AccessLogger.java
new file mode 100644
index 0000000..b27e578
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/AccessLogger.java
@@ -0,0 +1,778 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers;
+
+
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+import org.opends.server.api.ClientConnection;
+import org.opends.server.api.AccessLogPublisher;
+import org.opends.server.core.*;
+import org.opends.server.types.*;
+import org.opends.server.admin.std.server.AccessLogPublisherCfg;
+import org.opends.server.admin.std.meta.AccessLogPublisherCfgDefn;
+import org.opends.server.admin.server.ConfigurationAddListener;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.server.ConfigurationDeleteListener;
+import org.opends.server.admin.ClassPropertyDefinition;
+import org.opends.server.config.ConfigException;
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
+import static org.opends.server.messages.ConfigMessages.
+ MSGID_CONFIG_LOGGER_CANNOT_CREATE_LOGGER;
+import static org.opends.server.messages.ConfigMessages.
+ MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
+import static org.opends.server.messages.MessageHandler.getMessage;
+import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
+
+
+/**
+ * This class defines the wrapper that will invoke all registered access loggers
+ * for each type of request received or response sent.
+ */
+public class AccessLogger implements
+ ConfigurationAddListener<AccessLogPublisherCfg>,
+ ConfigurationDeleteListener<AccessLogPublisherCfg>,
+ ConfigurationChangeListener<AccessLogPublisherCfg>
+{
+ // The set of access loggers that have been registered with the server. It
+ // will initially be empty.
+ static ConcurrentHashMap<DN, AccessLogPublisher> accessPublishers =
+ new ConcurrentHashMap<DN, AccessLogPublisher>();
+
+ // The singleton instance of this class for configuration purposes.
+ static final AccessLogger instance = new AccessLogger();
+
+
+ /**
+ * Retrieve the singleton instance of this class.
+ *
+ * @return The singleton instance of this logger.
+ */
+ public static AccessLogger getInstance()
+ {
+ return instance;
+ }
+
+ /**
+ * Add an access log publisher to the access logger.
+ *
+ * @param dn The DN of the configuration entry for the publisher.
+ * @param publisher The access log publisher to add.
+ */
+ public synchronized static void addAccessLogPublisher(DN dn,
+ AccessLogPublisher publisher)
+ {
+ accessPublishers.put(dn, publisher);
+ }
+
+ /**
+ * Remove an access log publisher from the access logger.
+ *
+ * @param dn The DN of the publisher to remove.
+ * @return The publisher that was removed or null if it was not found.
+ */
+ public synchronized static AccessLogPublisher removeAccessLogPublisher(DN dn)
+ {
+ AccessLogPublisher AccessLogPublisher = accessPublishers.get(dn);
+ if(AccessLogPublisher != null)
+ {
+ AccessLogPublisher.close();
+ }
+
+ return AccessLogPublisher;
+ }
+
+ /**
+ * Removes all existing access log publishers from the logger.
+ */
+ public synchronized static void removeAllAccessLogPublishers()
+ {
+ for(AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.close();
+ }
+
+ accessPublishers.clear();
+ }
+
+ /**
+ * Initializes all the access log publishers.
+ *
+ * @param configs The access log publisher configurations.
+ * @throws ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public void initializeAccessLogger(List<AccessLogPublisherCfg> configs)
+ throws ConfigException, InitializationException
+ {
+ for(AccessLogPublisherCfg config : configs)
+ {
+ config.addAccessChangeListener(this);
+
+ if(config.isEnabled())
+ {
+ AccessLogPublisher AccessLogPublisher = getAccessPublisher(config);
+
+ addAccessLogPublisher(config.dn(), AccessLogPublisher);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationAddAcceptable(AccessLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ return !config.isEnabled() ||
+ isJavaClassAcceptable(config, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(AccessLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ return !config.isEnabled() ||
+ isJavaClassAcceptable(config, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationAdd(AccessLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ config.addAccessChangeListener(this);
+
+ if(config.isEnabled())
+ {
+ try
+ {
+ AccessLogPublisher AccessLogPublisher = getAccessPublisher(config);
+
+ addAccessLogPublisher(config.dn(), AccessLogPublisher);
+ }
+ catch(ConfigException e)
+ {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ messages.add(e.getMessage());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+ catch (Exception e)
+ {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ int msgID = MSGID_CONFIG_LOGGER_CANNOT_CREATE_LOGGER;
+ messages.add(getMessage(msgID, String.valueOf(config.dn().toString()),
+ stackTraceToSingleLineString(e)));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+ }
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ AccessLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ DN dn = config.dn();
+ AccessLogPublisher AccessLogPublisher = accessPublishers.get(dn);
+
+ if(AccessLogPublisher == null)
+ {
+ if(config.isEnabled())
+ {
+ // Needs to be added and enabled.
+ return applyConfigurationAdd(config);
+ }
+ }
+ else
+ {
+ if(config.isEnabled())
+ {
+ // The publisher is currently active, so we don't need to do anything.
+ // Changes to the class name cannot be
+ // applied dynamically, so if the class name did change then
+ // indicate that administrative action is required for that
+ // change to take effect.
+ String className = config.getJavaImplementationClass();
+ if(!className.equals(AccessLogPublisher.getClass().getName()))
+ {
+ adminActionRequired = true;
+ }
+ }
+ else
+ {
+ // The publisher is being disabled so shut down and remove.
+ removeAccessLogPublisher(config.dn());
+ }
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationDeleteAcceptable(AccessLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ DN dn = config.dn();
+ AccessLogPublisher AccessLogPublisher = accessPublishers.get(dn);
+ return AccessLogPublisher != null;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationDelete(
+ AccessLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+
+ removeAccessLogPublisher(config.dn());
+
+ return new ConfigChangeResult(resultCode, adminActionRequired);
+ }
+
+ private boolean isJavaClassAcceptable(AccessLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ String className = config.getJavaImplementationClass();
+ AccessLogPublisherCfgDefn d = AccessLogPublisherCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a DebugLogPublisher.
+ Class<? extends AccessLogPublisher> theClass;
+ try {
+ theClass = pd.loadClass(className, AccessLogPublisher.class);
+ theClass.newInstance();
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // Check that the implementation class implements the correct interface.
+ try {
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ theClass.getMethod("initializeAccessLogPublisher", config.definition()
+ .getServerConfigurationClass());
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // The class is valid as far as we can tell.
+ return true;
+ }
+
+ private AccessLogPublisher getAccessPublisher(AccessLogPublisherCfg config)
+ throws ConfigException {
+ String className = config.getJavaImplementationClass();
+ AccessLogPublisherCfgDefn d = AccessLogPublisherCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a AccessLogPublisher.
+ Class<? extends AccessLogPublisher> theClass;
+ AccessLogPublisher AccessLogPublisher;
+ try {
+ theClass = pd.loadClass(className, AccessLogPublisher.class);
+ AccessLogPublisher = theClass.newInstance();
+
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ Method method = theClass.getMethod("initializeAccessLogPublisher",
+ config.definition().getServerConfigurationClass());
+ method.invoke(AccessLogPublisher, config);
+ }
+ catch (InvocationTargetException ite)
+ {
+ // Rethrow the exceptions thrown be the invoked method.
+ Throwable e = ite.getTargetException();
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ throw new ConfigException(msgID, message, e);
+ }
+ catch (Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ throw new ConfigException(msgID, message, e);
+ }
+
+ // The access publisher has been successfully initialized.
+ return AccessLogPublisher;
+ }
+
+
+
+
+ /**
+ * Writes a message to the access logger with information about a new client
+ * connection that has been established, regardless of whether it will be
+ * immediately terminated.
+ *
+ * @param clientConnection The client connection that has been established.
+ */
+ public static void logConnect(ClientConnection clientConnection)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logConnect(clientConnection);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the
+ * termination of an existing client connection.
+ *
+ * @param clientConnection The client connection that has been terminated.
+ * @param disconnectReason A generic disconnect reason for the connection
+ * termination.
+ * @param message A human-readable message that can provide
+ * additional information about the disconnect.
+ */
+ public static void logDisconnect(ClientConnection clientConnection,
+ DisconnectReason disconnectReason,
+ String message)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logDisconnect(clientConnection, disconnectReason, message);
+ }
+ }
+
+
+ /**
+ * Writes a message to the access logger with information about the abandon
+ * request associated with the provided abandon operation.
+ *
+ * @param abandonOperation The abandon operation containing the information
+ * to use to log the abandon request.
+ */
+ public static void logAbandonRequest(AbandonOperation abandonOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logAbandonRequest(abandonOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the result of
+ * the provided abandon operation.
+ *
+ * @param abandonOperation The abandon operation containing the information
+ * to use to log the abandon result.
+ */
+ public static void logAbandonResult(AbandonOperation abandonOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logAbandonResult(abandonOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the add
+ * request associated with the provided add operation.
+ *
+ * @param addOperation The add operation containing the information to use
+ * to log the add request.
+ */
+ public static void logAddRequest(AddOperation addOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logAddRequest(addOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the add
+ * response associated with the provided add operation.
+ *
+ * @param addOperation The add operation containing the information to use
+ * to log the add response.
+ */
+ public static void logAddResponse(AddOperation addOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logAddResponse(addOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the bind
+ * request associated with the provided bind operation.
+ *
+ * @param bindOperation The bind operation containing the information to use
+ * to log the bind request.
+ */
+ public static void logBindRequest(BindOperation bindOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logBindRequest(bindOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the bind
+ * response associated with the provided bind operation.
+ *
+ * @param bindOperation The bind operation containing the information to use
+ * to log the bind response.
+ */
+ public static void logBindResponse(BindOperation bindOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logBindResponse(bindOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the compare
+ * request associated with the provided compare operation.
+ *
+ * @param compareOperation The compare operation containing the information
+ * to use to log the compare request.
+ */
+ public static void logCompareRequest(CompareOperation compareOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logCompareRequest(compareOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the compare
+ * response associated with the provided compare operation.
+ *
+ * @param compareOperation The compare operation containing the information
+ * to use to log the compare response.
+ */
+ public static void logCompareResponse(CompareOperation compareOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logCompareResponse(compareOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the delete
+ * request associated with the provided delete operation.
+ *
+ * @param deleteOperation The delete operation containing the information to
+ * use to log the delete request.
+ */
+ public static void logDeleteRequest(DeleteOperation deleteOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logDeleteRequest(deleteOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the delete
+ * response associated with the provided delete operation.
+ *
+ * @param deleteOperation The delete operation containing the information to
+ * use to log the delete response.
+ */
+ public static void logDeleteResponse(DeleteOperation deleteOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logDeleteResponse(deleteOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the extended
+ * request associated with the provided extended operation.
+ *
+ * @param extendedOperation The extended operation containing the
+ * information to use to log the extended request.
+ */
+ public static void logExtendedRequest(ExtendedOperation extendedOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logExtendedRequest(extendedOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the extended
+ * response associated with the provided extended operation.
+ *
+ * @param extendedOperation The extended operation containing the
+ * information to use to log the extended response.
+ */
+ public static void logExtendedResponse(ExtendedOperation extendedOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logExtendedResponse(extendedOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the modify
+ * request associated with the provided modify operation.
+ *
+ * @param modifyOperation The modify operation containing the information to
+ * use to log the modify request.
+ */
+ public static void logModifyRequest(ModifyOperation modifyOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logModifyRequest(modifyOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the modify
+ * response associated with the provided modify operation.
+ *
+ * @param modifyOperation The modify operation containing the information to
+ * use to log the modify response.
+ */
+ public static void logModifyResponse(ModifyOperation modifyOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logModifyResponse(modifyOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the modify DN
+ * request associated with the provided modify DN operation.
+ *
+ * @param modifyDNOperation The modify DN operation containing the
+ * information to use to log the modify DN request.
+ */
+ public static void logModifyDNRequest(ModifyDNOperation modifyDNOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logModifyDNRequest(modifyDNOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the modify DN
+ * response associated with the provided modify DN operation.
+ *
+ * @param modifyDNOperation The modify DN operation containing the
+ * information to use to log the modify DN
+ * response.
+ */
+ public static void logModifyDNResponse(ModifyDNOperation modifyDNOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logModifyDNResponse(modifyDNOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the search
+ * request associated with the provided search operation.
+ *
+ * @param searchOperation The search operation containing the information to
+ * use to log the search request.
+ */
+ public static void logSearchRequest(SearchOperation searchOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logSearchRequest(searchOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the search
+ * result entry that matches the criteria associated with the provided search
+ * operation.
+ *
+ * @param searchOperation The search operation with which the search result
+ * entry is associated.
+ * @param searchEntry The search result entry to be logged.
+ */
+ public static void logSearchResultEntry(SearchOperation searchOperation,
+ SearchResultEntry searchEntry)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logSearchResultEntry(searchOperation, searchEntry);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the search
+ * result reference returned while processing the associated search operation.
+ *
+ * @param searchOperation The search operation with which the search result
+ * reference is associated.
+ * @param searchReference The search result reference to be logged.
+ */
+ public static void logSearchResultReference(SearchOperation searchOperation,
+ SearchResultReference searchReference)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logSearchResultReference(searchOperation, searchReference);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the completion
+ * of the provided search operation.
+ *
+ * @param searchOperation The search operation containing the information
+ * to use to log the search result done message.
+ */
+ public static void logSearchResultDone(SearchOperation searchOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logSearchResultDone(searchOperation);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the access logger with information about the unbind
+ * request associated with the provided unbind operation.
+ *
+ * @param unbindOperation The unbind operation containing the information to
+ * use to log the unbind request.
+ */
+ public static void logUnbind(UnbindOperation unbindOperation)
+ {
+ for (AccessLogPublisher publisher : accessPublishers.values())
+ {
+ publisher.logUnbind(unbindOperation);
+ }
+ }
+}
+
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/AsyncronousLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/AsyncronousLogPublisher.java
deleted file mode 100644
index 3cff741..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/AsyncronousLogPublisher.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import org.opends.server.api.DirectoryThread;
-import org.opends.server.api.ServerShutdownListener;
-import org.opends.server.api.LogPublisher;
-import org.opends.server.core.DirectoryServer;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-/**
- * A LogPublisher which publishes log records asynchronously to a
- * wrapped LogPublisher. In this way, any LogPublisher may be made to
- * behave asynchronously - i.e. callers of LogPublisher#publish(LogRecord) will
- * not block waiting for the record to be published. Note that this
- * means that the ErrorHandler will receive logging exceptions asynchronously
- * as well.
- */
-public class AsyncronousLogPublisher
- implements ServerShutdownListener, LogPublisher
-{
- /** The wrapped LogPublisher. */
- private final LogPublisher publisher;
-
- /** Queue to store unpublished records. */
- private final ConcurrentLinkedQueue<PublishRequest> queue;
-
- private String name;
- private int interval;
- private boolean stopRequested;
- private PublisherThread publisherThread;
-
- /**
- * Structure encapsulating a queued publish request.
- */
- private static class PublishRequest
- {
- public final LogRecord record;
- public final LoggerErrorHandler handler;
-
- PublishRequest(LogRecord record, LoggerErrorHandler handler)
- {
- this.record = record;
- this.handler = handler;
- }
- }
-
- /**
- * Construct a new AsyncronousLogPublisher wrapper.
- *
- * @param name the name of the thread.
- * @param interval the interval at which the queue will be flushed.
- * @param publisher the publisher to wrap around.
- */
- public AsyncronousLogPublisher(String name, int interval,
- LogPublisher publisher)
- {
- this.name = name;
- this.interval = interval;
- this.publisher = publisher;
-
- this.queue = new ConcurrentLinkedQueue<PublishRequest>();
- this.publisherThread = null;
- this.stopRequested = false;
-
- // We will lazily launch the publisherThread
- // to ensure initialization safety.
-
- DirectoryServer.registerShutdownListener(this);
- }
-
- /**
- * The publisher thread is responsible for emptying the queue of log records
- * waiting to published.
- */
- private class PublisherThread extends DirectoryThread
- {
- public PublisherThread()
- {
- super(name);
- }
- /**
- * the run method of the publisherThread. Run until queue is empty
- * AND we've been asked to terminate
- */
- public void run()
- {
- while (!isShuttingDown() || !queue.isEmpty()) {
- PublishRequest request= null;
- try {
- request= queue.poll();
- if (request != null) {
- publisher.publish(request.record, request.handler);
- }
- else
- {
- sleep(interval);
- }
- }
- catch (InterruptedException ex) {
- // Ignore. We'll rerun the loop
- // and presumably fall out.
- }
- catch (Throwable t) {
- // Forward exception to error handler
- if (request != null && request.handler != null) {
- LoggerErrorHandler handler= request.handler;
- handler.handleError(request.record, t);
- }
- }
- }
- }
- }
-
- // Method needs to be synchronized with _shutdown mutator, as we don't
- // want shutdown to start after we check for it, but before we queue
- // request.
- private synchronized void publishAsynchronously(LogRecord record,
- LoggerErrorHandler handler)
- {
- // If shutting down reject, otherwise publish (if we have a publisher!)
- if (isShuttingDown()) {
- if (handler != null) {
- handler.handleError(record, new Exception("Shutdown requested."));
- }
- }
- else {
- // Launch writer publisherThread if not running. Make sure start is
- // only called ONCE by a publisherThread.
- if (publisherThread == null) {
- publisherThread = new PublisherThread();
- publisherThread.start();
- }
- // Put request on queue for writer
- queue.add(new PublishRequest(record, handler));
- }
- }
-
- /**
- * Publish the log record asyncronously.
- *
- * @param record the log record to publish.
- * @param handler the error handler to use if an error occurs.
- */
- public void publish(LogRecord record, LoggerErrorHandler handler)
- {
- // No publisher? Off to the bit bucket.
- if (publisher != null) {
- try {
- // Enqueue record; writer will pick it up later.
- publishAsynchronously(record, handler);
- }
- catch (Throwable t) {
- // Forward a logging exception to the error handler
- handler.handleError(record, t);
- }
- }
- }
-
- /**
- * Retrieves the human-readable name for this shutdown listener.
- *
- * @return The human-readable name for this shutdown listener.
- */
- public String getShutdownListenerName()
- {
- return "AsyncronousLogPublisher Thread " + name;
- }
-
- /**
- * Indicates that the Directory Server has received a request to stop running
- * and that this shutdown listener should take any action necessary to prepare
- * for it.
- *
- * @param reason The human-readable reason for the shutdown.
- */
- public void processServerShutdown(String reason)
- {
- shutdown(true);
- }
-
- /**
- * Queries whether the publisher is in shutdown mode.
- */
- private synchronized boolean isShuttingDown()
- {
- return stopRequested;
- }
-
- /**
- * Tell the publisher to start shutting down.
- */
- private synchronized void startShutDown()
- {
- stopRequested = true;
- }
-
- /**
- * Shutdown the publisher.
- */
- public void shutdown()
- {
- shutdown(true);
- DirectoryServer.deregisterShutdownListener(this);
- }
-
- private void shutdown(boolean shutdownWrapped)
- {
- startShutDown();
-
- // Wait for publisher thread to terminate
- while (publisherThread != null && publisherThread.isAlive()) {
- try {
- publisherThread.join();
- }
- catch (InterruptedException ex) {
- // Ignore; we gotta wait..
- }
- }
-
- // The writer publisherThread SHOULD have drained the queue.
- // If not, handle outstanding requests ourselves,
- // indicating the request was not processed due to shutdown.
- while (!queue.isEmpty()) {
- PublishRequest request= queue.poll();
- if (request != null) {
- if (request.handler != null) {
- request.handler.handleError(request.record,
- new Exception("Shutdown requested."));
- }
- }
- }
-
- // Shutdown the wrapped publisher.
- if (shutdownWrapped && publisher != null) publisher.shutdown();
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/AsyncronousTextWriter.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/AsyncronousTextWriter.java
new file mode 100644
index 0000000..a294791
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/AsyncronousTextWriter.java
@@ -0,0 +1,267 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers;
+
+import org.opends.server.api.DirectoryThread;
+import org.opends.server.api.ServerShutdownListener;
+import org.opends.server.core.DirectoryServer;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A Text Writer which writes log records asynchronously to
+ * character-based stream.
+ */
+public class AsyncronousTextWriter
+ implements ServerShutdownListener, TextWriter
+{
+ /**
+ * The wrapped Text Writer.
+ */
+ private final TextWriter writer;
+
+ /** Queue to store unpublished records. */
+ private final LinkedBlockingQueue<String> queue;
+
+ private String name;
+ private boolean stopRequested;
+ private WriterThread writerThread;
+
+ private boolean autoFlush;
+
+ /**
+ * Construct a new AsyncronousTextWriter wrapper.
+ *
+ * @param name the name of the thread.
+ * @param capacity the size of the queue before it gets flushed.
+ * @param autoFlush indicates if the underlying writer should be flushed
+ * after the queue is flushed.
+ * @param writer a character stream used for output.
+ */
+ public AsyncronousTextWriter(String name, int capacity, boolean autoFlush,
+ TextWriter writer)
+ {
+ this.name = name;
+ this.autoFlush = autoFlush;
+ this.writer = writer;
+
+ this.queue = new LinkedBlockingQueue<String>(capacity);
+ this.writerThread = null;
+ this.stopRequested = false;
+
+ writerThread = new WriterThread();
+ writerThread.start();
+
+ DirectoryServer.registerShutdownListener(this);
+ }
+
+ /**
+ * The publisher thread is responsible for emptying the queue of log records
+ * waiting to published.
+ */
+ private class WriterThread extends DirectoryThread
+ {
+ public WriterThread()
+ {
+ super(name);
+ }
+ /**
+ * the run method of the writerThread. Run until queue is empty
+ * AND we've been asked to terminate
+ */
+ public void run()
+ {
+ String message = null;
+ while (!isShuttingDown() || !queue.isEmpty()) {
+ try
+ {
+ message = queue.poll(10, TimeUnit.SECONDS);
+ if(message != null)
+ {
+ do
+ {
+ writer.writeRecord(message);
+ message = queue.poll();
+ }
+ while(message != null);
+
+ if(autoFlush)
+ {
+ flush();
+ }
+ }
+ }
+ catch (InterruptedException ex) {
+ // Ignore. We'll rerun the loop
+ // and presumably fall out.
+ }
+ }
+ }
+ }
+
+ // Method needs to be synchronized with _shutdown mutator, as we don't
+ // want shutdown to start after we check for it, but before we queue
+ // request.
+ private synchronized void writeAsynchronously(String record)
+ {
+ // If shutting down reject, otherwise publish (if we have a publisher!)
+ while (!isShuttingDown())
+ {
+ // Put request on queue for writer
+ try
+ {
+ queue.put(record);
+ break;
+ }
+ catch(InterruptedException e)
+ {
+ // We expect this to happen. Just ignore it and hopefully
+ // drop out in the next try.
+ }
+ }
+ }
+
+ /**
+ * Write the log record asyncronously.
+ *
+ * @param record the log record to write.
+ */
+ public void writeRecord(String record)
+ {
+ // No writer? Off to the bit bucket.
+ if (writer != null) {
+ writeAsynchronously(record);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void flush()
+ {
+ writer.flush();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public long getBytesWritten()
+ {
+ return writer.getBytesWritten();
+ }
+
+ /**
+ * Retrieves the wrapped writer.
+ *
+ * @return The wrapped writer used by this asyncronous writer.
+ */
+ public TextWriter getWrappedWriter()
+ {
+ return writer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getShutdownListenerName()
+ {
+ return "AsyncronousTextWriter Thread " + name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void processServerShutdown(String reason)
+ {
+ // Don't shutdown the wrapped writer on server shutdown as it
+ // might get more write requests before the log publishers are
+ // manually shutdown just before the server process exists.
+ shutdown(false);
+ }
+
+ /**
+ * Queries whether the publisher is in shutdown mode.
+ */
+ private boolean isShuttingDown()
+ {
+ return stopRequested;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void shutdown()
+ {
+ shutdown(true);
+ }
+
+ /**
+ * Releases any resources held by the writer.
+ *
+ * @param shutdownWrapped If the wrapped writer should be closed as well.
+ */
+ public void shutdown(boolean shutdownWrapped)
+ {
+ stopRequested = true;
+
+ // Wait for publisher thread to terminate
+ while (writerThread != null && writerThread.isAlive()) {
+ try {
+ // Interrupt the thread if its blocking
+ writerThread.interrupt();
+ writerThread.join();
+ }
+ catch (InterruptedException ex) {
+ // Ignore; we gotta wait..
+ }
+ }
+
+ // The writer writerThread SHOULD have drained the queue.
+ // If not, handle outstanding requests ourselves,
+ // and push them to the writer.
+ while (!queue.isEmpty()) {
+ String message = queue.poll();
+ writer.writeRecord(message);
+ }
+
+ // Shutdown the wrapped writer.
+ if (shutdownWrapped && writer != null) writer.shutdown();
+
+ DirectoryServer.deregisterShutdownListener(this);
+ }
+
+ /**
+ * Set the auto flush setting for this writer.
+ *
+ * @param autoFlush If the writer should flush the buffer after every line.
+ */
+ public void setAutoFlush(boolean autoFlush)
+ {
+ this.autoFlush = autoFlush;
+ }
+}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryAuditLogger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryAuditLogger.java
deleted file mode 100644
index e0da784..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryAuditLogger.java
+++ /dev/null
@@ -1,873 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.opends.server.api.AccessLogger;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.api.ConfigurableComponent;
-import org.opends.server.config.BooleanConfigAttribute;
-import org.opends.server.config.ConfigAttribute;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.config.ConfigException;
-import org.opends.server.config.StringConfigAttribute;
-import org.opends.server.core.AbandonOperation;
-import org.opends.server.core.AddOperation;
-import org.opends.server.core.BindOperation;
-import org.opends.server.core.CompareOperation;
-import org.opends.server.core.DeleteOperation;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.core.ExtendedOperation;
-import org.opends.server.core.ModifyOperation;
-import org.opends.server.core.ModifyDNOperation;
-import org.opends.server.core.SearchOperation;
-import org.opends.server.core.UnbindOperation;
-import org.opends.server.protocols.asn1.ASN1OctetString;
-import org.opends.server.types.ByteString;
-import org.opends.server.types.ConfigChangeResult;
-import org.opends.server.types.DisconnectReason;
-import org.opends.server.types.DN;
-import org.opends.server.types.ModificationType;
-import org.opends.server.types.RawAttribute;
-import org.opends.server.types.RawModification;
-import org.opends.server.types.ResultCode;
-import org.opends.server.types.SearchResultEntry;
-import org.opends.server.types.SearchResultReference;
-import org.opends.server.util.Base64;
-import org.opends.server.util.StaticUtils;
-
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.messages.LoggerMessages.*;
-import static org.opends.server.messages.ConfigMessages.*;
-import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.types.ResultCode.*;
-import static org.opends.server.util.ServerConstants.*;
-
-
-
-/**
- * This class provides the implementation of the audit logger used by
- * the directory server.
- */
-public class DirectoryAuditLogger extends AccessLogger
- implements ConfigurableComponent
-{
- private static final int DEFAULT_TIME_INTERVAL = 30000;
- private static final int DEFAULT_BUFFER_SIZE = 0;
- private boolean suppressInternalOps = true;
- private Logger auditLogger = null;
- private String changedLogFileName = null;
- private DirectoryFileHandler fileHandler = null;
-
- // The DN of the config entry this component is associated with.
- private DN configDN;
-
-
- /**
- * Initializes this audit logger based on the information in the provided
- * configuration entry.
- *
- * @param configEntry The configuration entry that contains the information
- * to use to initialize this audit logger.
- *
- * @throws ConfigException If an unrecoverable problem arises in the
- * process of performing the initialization.
- */
- public void initializeAccessLogger(ConfigEntry configEntry)
- throws ConfigException
- {
- configDN = configEntry.getDN();
-
- // FIXME - read the logger name from the config
- StringConfigAttribute logFileStub =
- new StringConfigAttribute(ATTR_LOGGER_FILE,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- StringConfigAttribute logFileNameAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(logFileStub);
-
- if(logFileNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_FILE_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
- initializeAccessLogger(logFileNameAttr.activeValue(), configEntry);
-
- }
-
-
- /**
- * Closes this audit logger and releases any resources it might have held.
- */
- public void closeAccessLogger()
- {
- fileHandler.close();
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about a new client
- * connection that has been established, regardless of whether it will be
- * immediately terminated.
- *
- * @param clientConnection The client connection that has been established.
- */
- public void logConnect(ClientConnection clientConnection)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the
- * termination of an existing client connection.
- *
- * @param clientConnection The client connection that has been terminated.
- * @param disconnectReason A generic disconnect reason for the connection
- * termination.
- * @param message A human-readable message that can provide
- * additional information about the disconnect.
- */
- public void logDisconnect(ClientConnection clientConnection,
- DisconnectReason disconnectReason,
- String message)
- {
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the abandon
- * request associated with the provided abandon operation.
- *
- * @param abandonOperation The abandon operation containing the information
- * to use to log the abandon request.
- */
- public void logAbandonRequest(AbandonOperation abandonOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the result
- * of the provided abandon operation.
- *
- * @param abandonOperation The abandon operation containing the information
- * to use to log the abandon request.
- */
- public void logAbandonResult(AbandonOperation abandonOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the add
- * request associated with the provided add operation.
- *
- * @param addOperation The add operation containing the information to use
- * to log the add request.
- */
- public void logAddRequest(AddOperation addOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the add
- * response associated with the provided add operation.
- *
- * @param addOperation The add operation containing the information to use
- * to log the add response.
- */
- public void logAddResponse(AddOperation addOperation)
- {
- long connectionID = addOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
- {
- return;
- }
- ResultCode code = addOperation.getResultCode();
-
- if(code == SUCCESS)
- {
- StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("dn:");
- ByteString dnString = addOperation.getRawEntryDN();
- encodeValue(dnString, buffer);
-
- buffer.append(EOL);
- buffer.append("changetype: add");
- buffer.append(EOL);
- List<RawAttribute> rawAttributes = addOperation.getRawAttributes();
- for(RawAttribute attr : rawAttributes)
- {
- buffer.append(attr.getAttributeType());
- buffer.append(":");
- List<ASN1OctetString> values = attr.getValues();
- if (! values.isEmpty())
- {
- Iterator<ASN1OctetString> iterator = values.iterator();
- ASN1OctetString nextString = iterator.next();
- encodeValue(nextString, buffer);
- while (iterator.hasNext())
- {
- buffer.append(EOL);
- buffer.append(attr.getAttributeType());
- buffer.append(":");
- nextString = iterator.next();
- encodeValue(nextString, buffer);
- }
- }
- buffer.append(EOL);
- }
-
- auditLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
- }
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the bind
- * request associated with the provided bind operation.
- *
- * @param bindOperation The bind operation with the information to use
- * to log the bind request.
- */
- public void logBindRequest(BindOperation bindOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the bind
- * response associated with the provided bind operation.
- *
- * @param bindOperation The bind operation containing the information to use
- * to log the bind response.
- */
- public void logBindResponse(BindOperation bindOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the compare
- * request associated with the provided compare operation.
- *
- * @param compareOperation The compare operation containing the information
- * to use to log the compare request.
- */
- public void logCompareRequest(CompareOperation compareOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the compare
- * response associated with the provided compare operation.
- *
- * @param compareOperation The compare operation containing the information
- * to use to log the compare response.
- */
- public void logCompareResponse(CompareOperation compareOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the delete
- * request associated with the provided delete operation.
- *
- * @param deleteOperation The delete operation with the information to
- * use to log the delete request.
- */
- public void logDeleteRequest(DeleteOperation deleteOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the delete
- * response associated with the provided delete operation.
- *
- * @param deleteOperation The delete operation containing the information to
- * use to log the delete response.
- */
- public void logDeleteResponse(DeleteOperation deleteOperation)
- {
- long connectionID = deleteOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
- {
- return;
- }
- ResultCode code = deleteOperation.getResultCode();
-
- if(code == SUCCESS)
- {
- StringBuilder buffer = new StringBuilder(50);
- buffer.append("dn:");
- ByteString dnString = deleteOperation.getRawEntryDN();
- encodeValue(dnString, buffer);
- buffer.append(EOL);
- buffer.append("changetype: delete");
- buffer.append(EOL);
- buffer.append(EOL);
-
- auditLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
- }
-
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the extended
- * request associated with the provided extended operation.
- *
- * @param extendedOperation The extended operation containing the
- * information to use to log the extended request.
- */
- public void logExtendedRequest(ExtendedOperation extendedOperation)
- {
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the extended
- * response associated with the provided extended operation.
- *
- * @param extendedOperation The extended operation containing the
- * info to use to log the extended response.
- */
- public void logExtendedResponse(ExtendedOperation extendedOperation)
- {
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the modify
- * request associated with the provided modify operation.
- *
- * @param modifyOperation The modify operation containing the information to
- * use to log the modify request.
- */
- public void logModifyRequest(ModifyOperation modifyOperation)
- {
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the modify
- * response associated with the provided modify operation.
- *
- * @param modifyOperation The modify operation containing the information to
- * use to log the modify response.
- */
- public void logModifyResponse(ModifyOperation modifyOperation)
- {
- long connectionID = modifyOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
- {
- return;
- }
- ResultCode code = modifyOperation.getResultCode();
-
- if(code == SUCCESS)
- {
- StringBuilder buffer = new StringBuilder(50);
- buffer.append("dn:");
- ByteString dnString = modifyOperation.getRawEntryDN();
- encodeValue(dnString, buffer);
- buffer.append(EOL);
- buffer.append("changetype: modify");
- buffer.append(EOL);
- List<RawModification> modifications =
- modifyOperation.getRawModifications();
- for(RawModification modification : modifications)
- {
- ModificationType modType = modification.getModificationType();
- RawAttribute attr = modification.getAttribute();
- switch(modType)
- {
- case ADD:
- buffer.append("add: ");
- break;
- case DELETE:
- buffer.append("delete: ");
- break;
- case REPLACE:
- buffer.append("replace: ");
- break;
- default:
- break;
- }
- buffer.append(attr.getAttributeType());
- List<ASN1OctetString> values = attr.getValues();
- if (! values.isEmpty())
- {
- Iterator<ASN1OctetString> iterator = values.iterator();
- ASN1OctetString nextString = iterator.next();
- encodeValue(nextString, buffer);
- while (iterator.hasNext())
- {
- buffer.append(EOL);
- buffer.append(attr.getAttributeType());
- buffer.append(":");
- nextString = iterator.next();
- encodeValue(nextString, buffer);
- }
- }
- buffer.append(EOL);
- }
-
- buffer.append(EOL);
-
- auditLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
- }
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the modify DN
- * request associated with the provided modify DN operation.
- *
- * @param modifyDNOperation The modify DN operation containing the
- * info to use to log the modify DN request.
- */
- public void logModifyDNRequest(ModifyDNOperation modifyDNOperation)
- {
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the modify DN
- * response associated with the provided modify DN operation.
- *
- * @param modifyDNOperation The modify DN operation containing the
- * information to use to log the modify DN
- * response.
- */
- public void logModifyDNResponse(ModifyDNOperation modifyDNOperation)
- {
- long connectionID = modifyDNOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
- {
- return;
- }
- ResultCode code = modifyDNOperation.getResultCode();
-
- if(code == SUCCESS)
- {
- StringBuilder buffer = new StringBuilder(50);
- buffer.append("dn:");
- ByteString dnString = modifyDNOperation.getRawEntryDN();
- encodeValue(dnString, buffer);
- buffer.append(EOL);
- buffer.append("changetype: moddn");
- buffer.append(EOL);
- buffer.append("newrdn: ");
- ByteString newrdnString = modifyDNOperation.getRawNewRDN();
- encodeValue(newrdnString, buffer);
- buffer.append(EOL);
- buffer.append("deleteoldrdn: ");
- if(modifyDNOperation.deleteOldRDN())
- {
- buffer.append("1");
- } else
- {
- buffer.append("0");
- }
- buffer.append(EOL);
- if(modifyDNOperation.getRawNewSuperior() != null)
- {
- buffer.append("newsuperior: ");
- ByteString newSuperior = modifyDNOperation.getRawNewSuperior();
- encodeValue(newSuperior, buffer);
- buffer.append(EOL);
- }
-
- buffer.append(EOL);
-
- auditLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
- }
- }
-
-
- /**
- * Writes a message to the audit logger with information about the search
- * request associated with the provided search operation.
- *
- * @param searchOperation The search operation containing the info to
- * use to log the search request.
- */
- public void logSearchRequest(SearchOperation searchOperation)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the search
- * result entry that matches the criteria associated with the provided search
- * operation.
- *
- * @param searchOperation The search operation with which the search result
- * entry is associated.
- * @param searchEntry The search result entry to be logged.
- */
- public void logSearchResultEntry(SearchOperation searchOperation,
- SearchResultEntry searchEntry)
- {
- }
-
-
- /**
- * Writes a message to the audit logger with information about the search
- * result reference returned while processing the associated search
- * operation.
- *
- * @param searchOperation The search operation with which the search result
- * reference is associated.
- * @param searchReference The search result reference to be logged.
- */
- public void logSearchResultReference(SearchOperation searchOperation,
- SearchResultReference searchReference)
- {
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the
- * completion of the provided search operation.
- *
- * @param searchOperation The search operation containing the information
- * to use to log the search result done message.
- */
- public void logSearchResultDone(SearchOperation searchOperation)
- {
- }
-
-
-
- /**
- * Writes a message to the audit logger with information about the unbind
- * request associated with the provided unbind operation.
- *
- * @param unbindOperation The unbind operation containing the info to
- * use to log the unbind request.
- */
- public void logUnbind(UnbindOperation unbindOperation)
- {
- }
-
-
-
- /**
- * Indicates whether the provided object is equal to this audit logger.
- *
- * @param obj The object for which to make the determination.
- *
- * @return <CODE>true</CODE> if the provided object is equal
- * to this audit logger, or <CODE>false</CODE> if not.
- */
- public boolean equals(Object obj)
- {
- if(this == obj) {
- return true;
- }
-
- if((obj == null) || (obj.getClass() != this.getClass()))
- {
- return false;
- }
-
- return auditLogger.equals(obj);
- }
-
-
-
- /**
- * Retrieves the hash code for this audit logger.
- *
- * @return The hash code for this audit logger.
- */
- public int hashCode()
- {
- return auditLogger.hashCode();
- }
-
-
- /**
- * Appends the appropriately-encoded attribute value to the provided buffer.
- *
- * @param str The ASN.1 octet string containing the value to append.
- * @param buffer The buffer to which to append the value.
- */
- private void encodeValue(ByteString str, StringBuilder buffer)
- {
- byte[] byteVal = str.value();
- if(StaticUtils.needsBase64Encoding(byteVal))
- {
- buffer.append(": ");
- buffer.append(Base64.encode(byteVal));
- } else
- {
- buffer.append(" ");
- str.toString(buffer);
- }
- }
-
- /**
- * Retrieves the DN of the configuration entry with which this component is
- * associated.
- *
- * @return The DN of the configuration entry with which this component is
- * associated.
- */
- public DN getConfigurableComponentEntryDN()
- {
- return configDN;
- }
-
-
-
- /**
- * Retrieves the set of configuration attributes that are associated with this
- * configurable component.
- *
- * @return The set of configuration attributes that are associated with this
- * configurable component.
- */
- public List<ConfigAttribute> getConfigurationAttributes()
- {
- // NYI
- return null;
- }
-
-
- /**
- * Indicates whether the configuration entry that will result from a proposed
- * modification is acceptable to this change listener.
- *
- * @param configEntry The configuration entry that will result from
- * the requested update.
- * @param unacceptableReasons A buffer to which this method can append a
- * human-readable message explaining why the
- * proposed change is not acceptable.
- *
- * @return <CODE>true</CODE> if the proposed entry contains an acceptable
- * configuration, or <CODE>false</CODE> if it does not.
- */
- public boolean hasAcceptableConfiguration(ConfigEntry configEntry,
- List<String> unacceptableReasons)
- {
- try
- {
- StringConfigAttribute logFileStub =
- new StringConfigAttribute(ATTR_LOGGER_FILE,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- StringConfigAttribute logFileNameAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(logFileStub);
-
- if(logFileNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_FILE_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReasons.add(message);
- return false;
- }
- changedLogFileName = logFileNameAttr.pendingValue();
- } catch (ConfigException ce)
- {
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
- String message = getMessage(msgID, this.getClass().getName(),
- configEntry.getDN().toString(),
- String.valueOf(ce));
- unacceptableReasons.add(message);
- return false;
- }
-
- return true;
- }
-
-
-
- /**
- * Attempts to apply a new configuration to this Directory Server component
- * based on the provided changed entry.
- *
- * @param configEntry The configuration entry that containing the
- * updated configuration for this component.
- * @param detailedResults Indicates whether to provide detailed information
- * about any changes made.
- *
- * @return Information about the result of processing the configuration
- * change.
- */
- public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry,
- boolean detailedResults)
- {
- fileHandler.close();
- // reinitialize the logger.
- try
- {
- initializeAccessLogger(changedLogFileName, configEntry);
- } catch(ConfigException ce)
- {
- // TODO - log the change failure.
- return new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(),
- false);
- }
-
- return new ConfigChangeResult(ResultCode.SUCCESS, false);
- }
-
-
- /**
- * Initialize the JDK logger an associate a file handler with the
- * specified file name with it.
- *
- * @param logFileName The name of the log file to write to.
- * @param configEntry The configuration entry with the information to use to
- * initialize this logger.
- *
- * @throws ConfigException If an unrecoverable problem arises in the
- * process of performing the initialization.
- */
- private void initializeAccessLogger(String logFileName,
- ConfigEntry configEntry) throws ConfigException
- {
- auditLogger =
- Logger.getLogger("org.opends.server.loggers.DirectoryAuditLogger");
- auditLogger.setLevel(Level.ALL);
-
- File logFile = new File(logFileName);
- if(!logFile.isAbsolute())
- {
- logFile = new File (DirectoryServer.getServerRoot() + File.separator +
- logFileName);
- }
-
- BooleanConfigAttribute enabledAttr;
- try
- {
- BooleanConfigAttribute enabledStub =
- new BooleanConfigAttribute(ATTR_LOGGER_SUPPRESS_INTERNAL_OPERATIONS,
- getMessage(MSGID_CONFIG_LOGGER_SUPPRESS_INTERNAL_OPERATIONS),
- false);
- enabledAttr = (BooleanConfigAttribute)
- configEntry.getConfigAttribute(enabledStub);
-
- if (enabledAttr != null)
- {
- suppressInternalOps = enabledAttr.pendingValue();
- }
- }
- catch (Exception e)
- {
- int msgID = MSGID_CONFIG_LOGGER_INVALID_SUPPRESS_INT_OPERATION_VALUE;
- String message = getMessage(msgID, configEntry.getDN().toString(),
- String.valueOf(e));
- throw new ConfigException(msgID, message);
- }
-
-
- try
- {
- int bufferSize = RotationConfigUtil.getIntegerAttribute(configEntry,
- ATTR_LOGGER_BUFFER_SIZE, MSGID_LOGGER_BUFFER_SIZE);
- if(bufferSize == -1)
- {
- bufferSize = DEFAULT_BUFFER_SIZE;
- }
- CopyOnWriteArrayList<RotationPolicy> rp =
- RotationConfigUtil.getRotationPolicies(configEntry);
- fileHandler = new DirectoryFileHandler(configEntry,
- logFile.getAbsolutePath(),
- bufferSize);
- fileHandler.setFormatter(new DirectoryFileFormatter(true));
- auditLogger.addHandler(fileHandler);
-
- if(rp != null)
- {
- ArrayList<ActionType> actions =
- RotationConfigUtil.getPostRotationActions(configEntry);
- fileHandler.setPostRotationActions(actions);
- for(RotationPolicy rotationPolicy : rp)
- {
- if(rotationPolicy instanceof SizeBasedRotationPolicy)
- {
- long fileSize =
- ((SizeBasedRotationPolicy) rotationPolicy).getMaxFileSize();
- fileHandler.setFileSize(fileSize);
- rp.remove(rotationPolicy);
- }
- }
- }
-
- CopyOnWriteArrayList<RetentionPolicy> retentionPolicies =
- RotationConfigUtil.getRetentionPolicies(configEntry);
-
- int threadTimeInterval = RotationConfigUtil.getIntegerAttribute(
- configEntry, ATTR_LOGGER_THREAD_INTERVAL,
- MSGID_LOGGER_THREAD_INTERVAL);
- if(threadTimeInterval == -1)
- {
- threadTimeInterval = DEFAULT_TIME_INTERVAL;
- }
-
- LoggerThread lt = new LoggerThread("AuditLogger Thread",
- threadTimeInterval, fileHandler, rp,
- retentionPolicies);
- lt.start();
-
- } catch(IOException ioe) {
- int msgID = MSGID_LOG_ACCESS_CANNOT_ADD_FILE_HANDLER;
- String message = getMessage(msgID, String.valueOf(ioe));
- throw new ConfigException(msgID, message, ioe);
- }
- }
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryErrorLogger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryErrorLogger.java
deleted file mode 100644
index afb83ad..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryErrorLogger.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.opends.server.api.ConfigurableComponent;
-import org.opends.server.api.ErrorLogger;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.config.ConfigAttribute;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.config.ConfigException;
-import org.opends.server.config.MultiChoiceConfigAttribute;
-import org.opends.server.config.StringConfigAttribute;
-import org.opends.server.types.ConfigChangeResult;
-import org.opends.server.types.DN;
-import org.opends.server.types.ErrorLogCategory;
-import org.opends.server.types.ErrorLogSeverity;
-import org.opends.server.types.ResultCode;
-
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.messages.ConfigMessages.*;
-import static org.opends.server.messages.LoggerMessages.*;
-import static org.opends.server.messages.MessageHandler.*;
-
-
-
-/**
- * This class provides an implementation of an error logger.
- * JDK Loggers are used for the implementation with multiple
- * handlers and formatters based on where the messages are
- * being logged (local file, DB, syslog etc)
- */
-public class DirectoryErrorLogger extends ErrorLogger
- implements ConfigurableComponent
-{
- private static final int DEFAULT_TIME_INTERVAL = 30000;
- private static final int DEFAULT_BUFFER_SIZE = 0;
- // The JDK logger instance
- private Logger errorLogger = null;
- private DirectoryFileHandler fileHandler = null;
-
- // The hash map that will be used to define specific log severities for the
- // various categories.
- private HashMap<ErrorLogCategory,HashSet<ErrorLogSeverity>> definedSeverities;
-
- // The set of default log severities that will be used if no custom severities
- // have been defined for the associated category.
- private HashSet<ErrorLogSeverity> defaultSeverities;
-
- // The DN of the config entry this component is associated with.
- private DN configDN;
-
-
-
-
- /**
- * Initializes this error logger based on the information in the provided
- * configuration entry.
- *
- * @param configEntry The configuration entry that contains the information
- * to use to initialize this error logger.
- *
- * @throws ConfigException If an unrecoverable problem arises in the
- * process of performing the initialization.
- */
- public void initializeErrorLogger(ConfigEntry configEntry)
- throws ConfigException
- {
- configDN = configEntry.getDN();
- defaultSeverities = new HashSet<ErrorLogSeverity>();
-
- HashSet<String> allowedValues = new HashSet<String> ();
- for(ErrorLogSeverity sev : ErrorLogSeverity.values())
- {
- allowedValues.add(sev.toString().toLowerCase());
- }
- List<String> defSev = getSeverities(configEntry,
- ATTR_LOGGER_DEFAULT_SEVERITY,
- allowedValues);
- if(defSev.isEmpty())
- {
- defaultSeverities.add(ErrorLogSeverity.FATAL_ERROR);
- defaultSeverities.add(ErrorLogSeverity.SEVERE_ERROR);
- defaultSeverities.add(ErrorLogSeverity.SEVERE_WARNING);
- } else
- {
- for(String defStr : defSev)
- {
- ErrorLogSeverity errorSeverity = ErrorLogSeverity.getByName(defStr);
- if(errorSeverity != null)
- {
- defaultSeverities.add(errorSeverity);
- } else
- {
- System.err.println("Ignoring invalid severity name:" + defStr);
- }
- }
- }
-
- definedSeverities =
- new HashMap<ErrorLogCategory,HashSet<ErrorLogSeverity>>();
- HashSet<String> allowedSeverityValues = new HashSet<String>();
- for(ErrorLogCategory cat: ErrorLogCategory.values())
- {
- for(ErrorLogSeverity sev : ErrorLogSeverity.values())
- {
- String val = cat.toString().toLowerCase() + "=" +
- sev.toString().toLowerCase();
- allowedSeverityValues.add(val);
- }
- }
-
- List<String> overrideSeverities = getSeverities(configEntry,
- ATTR_LOGGER_OVERRIDE_SEVERITY,
- allowedSeverityValues);
- for(String overrideSeverity: overrideSeverities)
- {
- if(overrideSeverity != null)
- {
- int equalPos = overrideSeverity.indexOf('=');
- if (equalPos < 0)
- {
- System.err.println("Invalid override of severity level. Ignoring...");
- } else
- {
- String categoryName = overrideSeverity.substring(0, equalPos);
- ErrorLogCategory category = ErrorLogCategory.getByName(categoryName);
- if (category == null)
- {
- System.err.println("Invalid error log category " + categoryName +
- ". Ignoring ...");
- } else
- {
- HashSet<ErrorLogSeverity> severities =
- new HashSet<ErrorLogSeverity>();
- StringTokenizer sevTokenizer =
- new StringTokenizer(overrideSeverity.substring(equalPos+1), ",");
- while (sevTokenizer.hasMoreElements())
- {
- String severityName = sevTokenizer.nextToken();
- ErrorLogSeverity severity =
- ErrorLogSeverity.getByName(severityName);
- if (severity == null)
- {
- System.err.println("Invalid error log severity " +
- severityName + ". Ignoring ...");
- } else
- {
- severities.add(severity);
- }
- }
- definedSeverities.put(category, severities);
- }
- }
- }
- }
-
- StringConfigAttribute logFileStub =
- new StringConfigAttribute(ATTR_LOGGER_FILE,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
-
- StringConfigAttribute logFileNameAttr =
- (StringConfigAttribute) configEntry.getConfigAttribute(logFileStub);
-
- if(logFileNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_FILE_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
-
-
- errorLogger =
- Logger.getLogger("org.opends.server.loggers.DirectoryErrorLogger");
- errorLogger.setLevel(Level.ALL);
-
- File logFile = new File(logFileNameAttr.activeValue());
- if(!logFile.isAbsolute())
- {
- logFile = new File(DirectoryServer.getServerRoot() + File.separator +
- logFileNameAttr.activeValue());
- }
-
- // Add Handler (based on config entry)
- try
- {
- CopyOnWriteArrayList<RotationPolicy> rp =
- RotationConfigUtil.getRotationPolicies(configEntry);
- int bufferSize = RotationConfigUtil.getIntegerAttribute(configEntry,
- ATTR_LOGGER_BUFFER_SIZE, MSGID_LOGGER_BUFFER_SIZE);
- if(bufferSize == -1)
- {
- bufferSize = DEFAULT_BUFFER_SIZE;
- }
-
- fileHandler = new DirectoryFileHandler(configEntry,
- logFile.getAbsolutePath(),
- bufferSize);
- fileHandler.setFormatter(new DirectoryFileFormatter(false));
- errorLogger.addHandler(fileHandler);
- if(rp != null)
- {
- ArrayList<ActionType> actions =
- RotationConfigUtil.getPostRotationActions(configEntry);
-
- fileHandler.setPostRotationActions(actions);
-
- for(RotationPolicy rotationPolicy : rp)
- {
- if(rotationPolicy instanceof SizeBasedRotationPolicy)
- {
- long fileSize =
- ((SizeBasedRotationPolicy) rotationPolicy).getMaxFileSize();
- fileHandler.setFileSize(fileSize);
- rp.remove(rotationPolicy);
- }
- }
- }
-
- CopyOnWriteArrayList<RetentionPolicy> retentionPolicies =
- RotationConfigUtil.getRetentionPolicies(configEntry);
-
- int threadTimeInterval = RotationConfigUtil.getIntegerAttribute(
- configEntry, ATTR_LOGGER_THREAD_INTERVAL,
- MSGID_LOGGER_THREAD_INTERVAL);
- if(threadTimeInterval == -1)
- {
- threadTimeInterval = DEFAULT_TIME_INTERVAL;
- }
- LoggerThread lt = new LoggerThread("ErrorLogger Thread",
- threadTimeInterval, fileHandler, rp,
- retentionPolicies);
- lt.start();
-
- } catch(IOException ioe) {
- int msgID = MSGID_LOG_ERROR_CANNOT_ADD_FILE_HANDLER;
- String message = getMessage(msgID, String.valueOf(ioe));
- throw new ConfigException(msgID, message, ioe);
- }
- }
-
-
-
- /**
- * Closes this error logger and releases any resources it might have held.
- */
- public void closeErrorLogger()
- {
- // FIXME -- Take any appropriate action here.
- fileHandler.close();
- }
-
-
- /**
- * Writes a message to the error log using the provided information.
- *
- * @param category The category that may be used to determine whether to
- * actually log this message.
- * @param severity The severity that may be used to determine whether to
- * actually log this message.
- * @param message The message to be logged.
- * @param errorID The error ID that uniquely identifies the format string
- * used to generate the provided message.
- */
- public void logError(ErrorLogCategory category,
- ErrorLogSeverity severity, String message,
- int errorID)
- {
- HashSet<ErrorLogSeverity> severities = definedSeverities.get(category);
- if(severities == null)
- {
- severities = defaultSeverities;
- }
-
- if(severities.contains(severity))
- {
-
- StringBuilder sb = new StringBuilder();
- sb.append("category=").append(category.getCategoryName()).
- append(" severity=").append(severity.getSeverityName()).
- append(" msgID=").append(String.valueOf(errorID)).
- append(" msg=").append(message);
-
- // FIXME - lookup the level based on the severity
- errorLogger.log(DirectoryLogLevel.FATAL_ERROR, sb.toString());
- }
- }
-
- /**
- * Indicates whether the provided object is equal to this error logger.
- *
- * @param o The object for which to make the determination.
- *
- * @return <CODE>true</CODE> if the provided object is determined to be equal
- * to this error logger, or <CODE>false</CODE> if not.
- */
- public boolean equals(Object o)
- {
- if(this == o)
- {
- return true;
- }
- if((o == null) || (o.getClass() != this.getClass()))
- {
- return false;
- }
-
- return errorLogger.equals(o);
- }
-
-
- /**
- * Retrieves the hash code for this error logger.
- *
- * @return The hash code for this error logger.
- */
- public int hashCode()
- {
- return errorLogger.hashCode();
- }
-
-
- /**
- * Retrieves the DN of the configuration entry with which this component is
- * associated.
- *
- * @return The DN of the configuration entry with which this component is
- * associated.
- */
- public DN getConfigurableComponentEntryDN()
- {
- return configDN;
- }
-
-
-
- /**
- * Retrieves the set of configuration attributes that are associated with this
- * configurable component.
- *
- * @return The set of configuration attributes that are associated with this
- * configurable component.
- */
- public List<ConfigAttribute> getConfigurationAttributes()
- {
- // NYI
- return null;
- }
-
-
- /**
- * Indicates whether the configuration entry that will result from a proposed
- * modification is acceptable to this change listener.
- *
- * @param configEntry The configuration entry that will result from
- * the requested update.
- * @param unacceptableReasons A buffer to which this method can append a
- * human-readable message explaining why the
- * proposed change is not acceptable.
- *
- * @return <CODE>true</CODE> if the proposed entry contains an acceptable
- * configuration, or <CODE>false</CODE> if it does not.
- */
- public boolean hasAcceptableConfiguration(ConfigEntry configEntry,
- List<String> unacceptableReasons)
- {
- try
- {
- StringConfigAttribute logFileStub =
- new StringConfigAttribute(ATTR_LOGGER_FILE,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- StringConfigAttribute logFileNameAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(logFileStub);
-
- if(logFileNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_FILE_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReasons.add(message);
- return false;
- }
- } catch (ConfigException ce)
- {
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
- String message = getMessage(msgID, this.getClass().getName(),
- configEntry.getDN().toString(),
- String.valueOf(ce));
- unacceptableReasons.add(message);
- return false;
- }
- return true;
- }
-
-
-
- /**
- * Attempts to apply a new configuration to this Directory Server component
- * based on the provided changed entry.
- *
- * @param configEntry The configuration entry that containing the
- * updated configuration for this component.
- * @param detailedResults Indicates whether to provide detailed information
- * about any configuration changes applied.
- *
- * @return Information about the result of processing the configuration
- * change.
- */
- public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry,
- boolean detailedResults)
- {
- fileHandler.close();
- try
- {
- initializeErrorLogger(configEntry);
- } catch(ConfigException ce)
- {
- // TODO - log the change failure.
- return new ConfigChangeResult(
- DirectoryServer.getServerErrorResultCode(), false);
-
- }
-
- return new ConfigChangeResult(ResultCode.SUCCESS, false);
- }
-
- /**
- * Return the severities based on the attribute name from the specified
- * config entry.
- *
- * @param configEntry The configuration entry that containing the updated
- * configuration for this component.
- * @param attrName The attribute name for which to return the severity
- * values.
- * @param allowedValues The set of possible severity values that may be
- * used.
- *
- *
- * @return The list of values for the severity attribute.
- */
-
- private List<String> getSeverities(ConfigEntry configEntry, String attrName,
- Set<String> allowedValues)
- {
- ArrayList<String> values = new ArrayList<String>();
- MultiChoiceConfigAttribute severityStub =
- new MultiChoiceConfigAttribute(attrName,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- false, true, true, allowedValues);
-
- MultiChoiceConfigAttribute severityAttr = null;
- try
- {
- severityAttr = (MultiChoiceConfigAttribute)
- configEntry.getConfigAttribute(severityStub);
- } catch(ConfigException ce)
- {
- ce.printStackTrace();
- // FIXME - handle exception
- System.err.println("Cannot retrieve the config value for:" + attrName);
- return values;
- }
-
- if(severityAttr == null)
- {
- return values;
- }
-
- return severityAttr.activeValues();
- }
-
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryFileFormatter.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryFileFormatter.java
deleted file mode 100644
index 02b804a..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryFileFormatter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-
-import java.util.logging.Formatter;
-import java.util.logging.LogRecord;
-
-import org.opends.server.util.StaticUtils;
-import org.opends.server.util.TimeThread;
-
-import static org.opends.server.util.ServerConstants.*;
-
-/**
- * Print a brief summary of the LogRecord in a human readable
- * format. The summary will typically be 1 or 2 lines.
- */
-public class DirectoryFileFormatter extends Formatter
-{
-
- private boolean auditFormat = false;
-
-
-
- /**
- * Creates a new directory file formatter.
- *
- * @param audit Indicates whether this file formatter is to be used with an
- * audit logger.
- */
- public DirectoryFileFormatter(boolean audit)
- {
- auditFormat = audit;
- }
-
-
-
- /**
- * Format the given LogRecord.
- * @param record the log record to be formatted.
- * @return a formatted log record
- */
- public String format(LogRecord record)
- {
- StringBuilder sb = new StringBuilder();
- if(!auditFormat)
- {
- sb.append("[");
- sb.append(TimeThread.getLocalTime());
- sb.append("]");
- sb.append(" ");
- }
- String message = record.getMessage();
- sb.append(message);
- sb.append(EOL);
- if(!auditFormat)
- {
- if (record.getThrown() != null) {
- sb.append(StaticUtils.stackTraceToString(record.getThrown()));
- }
- }
- return sb.toString();
- }
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryFileHandler.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryFileHandler.java
deleted file mode 100644
index 67bdd2c..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryFileHandler.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.logging.ErrorManager;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import org.opends.server.api.InvokableComponent;
-import org.opends.server.config.ConfigAttribute;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.types.DirectoryException;
-import org.opends.server.types.DN;
-import org.opends.server.types.InvokableMethod;
-import org.opends.server.types.ResultCode;
-import org.opends.server.util.TimeThread;
-
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.messages.ConfigMessages.*;
-import static org.opends.server.messages.MessageHandler.*;
-
-/**
- * Simple file logging <tt>Handler</tt>.
- * The <tt>DirectoryFileHandler</tt> can write to a specified file,
- * and can handle rotating the file based on predefined policies.
- */
-public class DirectoryFileHandler extends Handler
- implements LoggerAlarmHandler, InvokableComponent
-{
- private Writer writer;
- private MeteredStream meter;
- private boolean append;
- private String filename;
- private int bufferSize = 65536;
- private long limit = 0;
- private File file;
- private ArrayList<ActionType> actions;
- private ConfigEntry configEntry;
-
-
- /**
- * Initialize a DirectoryFileHandler to write to the given filename.
- *
- * @param configEntry The configuration entry for the associated logger.
- * @param filename the name of the output file.
- * @param bufferSize the buffer size before flushing data to the file.
- * @exception IOException if there are IO problems opening the files.
- * @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
- */
- public DirectoryFileHandler(ConfigEntry configEntry,
- String filename, int bufferSize)
- throws IOException, SecurityException
- {
- this.configEntry = configEntry;
- this.bufferSize = bufferSize;
- configure();
- this.filename = filename;
- openFile();
- }
-
- /**
- * Initialize a DirectoryFileHandler to write to the given filename,
- * with optional append.
- *
- * @param configEntry The configuration entry for the associated logger.
- * @param filename the name of the output file
- * @param append specifies append mode
- * @param bufferSize the buffer size before flushing data to the file.
- * @exception IOException if there are IO problems opening the files.
- * @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
- */
- public DirectoryFileHandler(ConfigEntry configEntry,
- String filename, boolean append, int bufferSize)
- throws IOException, SecurityException
- {
- this.configEntry = configEntry;
- this.bufferSize = bufferSize;
- configure();
- this.filename = filename;
- this.append = append;
- openFile();
- }
-
-
- /**
- * Set the maximum file size limit.
- *
- * @param limit The maximum file size.
- */
- public void setFileSize(long limit)
- {
- this.limit = limit;
- }
-
-
- /**
- * Private method to open the set of output files, based on the
- * configured instance variables.
- *
- * @exception IOException If there was an error while opening the file.
- * @exception SecurityException If a security manager exists and if
- * the caller does not have LoggingPermission.
- */
- private void openFile() throws IOException, SecurityException
- {
- // We register our own ErrorManager during initialization
- // so we can record exceptions.
- InitializationErrorManager em = new InitializationErrorManager();
- setErrorManager(em);
-
- file = new File(filename);
-
- // Create the initial log file.
- if (append)
- {
- open(file, true);
- } else
- {
- // FIXME - Should we rotate?
- open(file, false);
- }
-
- // Did we detect any exceptions during initialization?
- Exception ex = em.lastException;
- if (ex != null)
- {
- if (ex instanceof IOException)
- {
- throw (IOException) ex;
- } else if (ex instanceof SecurityException)
- {
- throw (SecurityException) ex;
- } else
- {
- throw new IOException("Exception: " + ex);
- }
- }
-
- // Install the normal default ErrorManager.
- setErrorManager(new ErrorManager());
- }
-
-
- /**
- * Rotate the current file to the specified new file name.
- * @param newFile The name of the new file to rotate to.
- */
- public void rotate(String newFile)
- {
- close();
- File f1 = file;
- File f2 = new File(newFile);
- if (f1.exists())
- {
- if (f2.exists())
- {
- System.err.println("File:" + f2 + " already exists. Renaming...");
- File f3 = new File(newFile + ".sav");
- f2.renameTo(f3);
- }
- f1.renameTo(f2);
- }
- try
- {
- open(file, false);
- } catch (IOException ix)
- {
- // We don't want to throw an exception here, but we
- // report the exception to any registered ErrorManager.
- reportError(null, ix, ErrorManager.OPEN_FAILURE);
- }
- }
-
- /**
- * Format and publish a <tt>LogRecord</tt>.
- *
- * @param record Description of the log event. A null record is
- * silently ignored and is not published.
- *
- */
- public void publish(LogRecord record)
- {
- String msg;
- try
- {
- msg = getFormatter().format(record);
- } catch (Exception ex)
- {
- reportError(null, ex, ErrorManager.WRITE_FAILURE);
- return;
- }
-
- synchronized(this)
- {
- try
- {
- writer.write(msg);
- } catch (Exception ex)
- {
- reportError(null, ex, ErrorManager.WRITE_FAILURE);
- return;
- }
-
- if(limit > 0 && meter.written >= limit)
- {
- rollover();
- }
- }
- }
-
-
- /**
- * Return the number of bytes written to the current file.
- *
- * @return The number of bytes written to the current file.
- */
- public long getFileSize()
- {
- return meter.written;
- }
-
- /**
- * This method is called from by the logger thread when a
- * file rotation needs to happen.
- */
- public void rollover()
- {
- String newfilename = filename + "." + getFileExtension();
- rotate(newfilename);
-
- RotationActionThread rotThread =
- new RotationActionThread(newfilename, actions, configEntry);
- rotThread.start();
-
- }
-
- /**
- * This method sets the actions that need to be executed after rotation.
- *
- * @param actions An array of actions that need to be executed on rotation.
- */
- public void setPostRotationActions(ArrayList<ActionType> actions)
- {
- this.actions = actions;
- }
-
-
- /**
- * Retrieves the DN of the configuration entry with which this component is
- * associated.
- *
- * @return The DN of the configuration entry with which this component is
- * associated.
- */
- public DN getInvokableComponentEntryDN()
- {
- return configEntry.getDN();
- }
-
-
-
- /**
- * Retrieves a list of the methods that may be invoked for this component.
- *
- * @return A list of the methods that may be invoked for this component.
- */
- public InvokableMethod[] getOperationSignatures()
- {
- InvokableMethod[] methods = new InvokableMethod[1];
- methods[0] = new InvokableMethod("rotateNow",
- "Rotate the log file immediately",
- null, "void", true, true);
- return methods;
- }
-
-
-
- /**
- * Invokes the specified method with the provided arguments.
- *
- * @param methodName The name of the method to invoke.
- * @param arguments The set of configuration attributes holding the
- * arguments to use for the method.
- *
- * @return The return value for the method, or <CODE>null</CODE> if it did
- * not return a value.
- *
- * @throws DirectoryException If there was no such method, or if an error
- * occurred while attempting to invoke it.
- */
- public Object invokeMethod(String methodName, ConfigAttribute[] arguments)
- throws DirectoryException
- {
- if(!methodName.equals("rotateNow"))
- {
- int msgID = MSGID_CONFIG_JMX_NO_METHOD;
- throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
- getMessage(msgID), msgID);
- }
-
- rollover();
-
- return null;
- }
-
-
- /**
- * Close the current output stream.
- *
- */
- public void close()
- {
- flushAndClose();
- }
-
-
- /**
- * Return the extension for the target filename for the rotated file.
- *
- * @return The extension for the target filename for the rotated file.
- */
- private String getFileExtension()
- {
- return TimeThread.getGMTTime();
- }
-
-
- /**
- * Open the file and set the appropriate output stream.
- *
- * @param fname The path and name of the file to be written.
- * @param append Indicates whether to append to the existing file or to
- * overwrite it.
- *
- * @throws IOException If a problem occurs while opening the file.
- */
- private void open(File fname, boolean append) throws IOException
- {
- long len = 0;
- if (append)
- {
- len = fname.length();
- }
- FileOutputStream fout = new FileOutputStream(fname, append);
- BufferedOutputStream bout = null;
- if(bufferSize <= 0)
- {
- bout = new BufferedOutputStream(fout);
- } else
- {
- bout = new BufferedOutputStream(fout, bufferSize);
- }
- meter = new MeteredStream(bout, len);
- // flushAndClose();
- writer = new BufferedWriter(new OutputStreamWriter(meter));
- }
-
-
- /**
- * Private method to configure a DirectoryFileHandler
- * with default values.
- */
- private void configure()
- {
- setLevel(Level.ALL);
- this.append = true;
- }
-
-
- /**
- * Flush any buffered messages and close the output stream.
- */
- private void flushAndClose()
- {
- if (writer != null)
- {
- try
- {
- writer.flush();
- writer.close();
- } catch (Exception ex) {
- // We don't want to throw an exception here, but we
- // report the exception to any registered ErrorManager.
- reportError(null, ex, ErrorManager.CLOSE_FAILURE);
- }
- writer = null;
- }
-
- }
-
- /**
- * Flush any buffered messages.
- */
- public void flush()
- {
- if (writer != null)
- {
- try
- {
- writer.flush();
- } catch (Exception ex) {
- // We don't want to throw an exception here, but we
- // report the exception to any registered ErrorManager.
- reportError(null, ex, ErrorManager.FLUSH_FAILURE);
- }
- }
- }
-
-
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryLogLevel.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryLogLevel.java
deleted file mode 100644
index 819a59f..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryLogLevel.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-
-import java.util.logging.Level;
-
-import org.opends.server.messages.CoreMessages;
-
-
-
-/**
- * This class extends the JDK logging levels with directory server
- * defined levels.
- */
-public class DirectoryLogLevel extends Level
-{
- private static final long serialVersionUID = 3509000330296517508L;
-
-
-
- /**
- * The log level that will be used for fatal error messages.
- */
- public static final Level FATAL_ERROR = new DirectoryLogLevel(
- "FATAL_ERROR", CoreMessages.MSGID_ERROR_SEVERITY_FATAL_ERROR);
-
-
-
- /**
- * The log level that will be used for debugging messages.
- */
- public static final Level GENERIC_DEBUG = new DirectoryLogLevel(
- "DEBUG", CoreMessages.MSGID_ERROR_SEVERITY_GENERIC_DEBUG);
-
-
-
- /**
- * The log level that will be used for informational messages.
- */
- public static final Level INFORMATIONAL = new DirectoryLogLevel(
- "INFO", CoreMessages.MSGID_ERROR_SEVERITY_INFORMATIONAL);
-
-
-
- /**
- * The log level that will be used for mild error messages.
- */
- public static final Level MILD_ERROR = new DirectoryLogLevel(
- "MILD_ERROR", CoreMessages.MSGID_ERROR_SEVERITY_MILD_ERROR);
-
-
-
- /**
- * The log level that will be used for mild warning messages.
- */
- public static final Level MILD_WARNING = new DirectoryLogLevel(
- "MILD_WARNING", CoreMessages.MSGID_ERROR_SEVERITY_MILD_WARNING);
-
-
-
- /**
- * The log level that will be used for severe error messages.
- */
- public static final Level SEVERE_ERROR = new DirectoryLogLevel(
- "SEVERE_ERROR", CoreMessages.MSGID_ERROR_SEVERITY_SEVERE_ERROR);
-
-
-
- /**
- * The log level that will be used for severe warning messages.
- */
- public static final Level SEVERE_WARNING = new DirectoryLogLevel(
- "SEVERE_WARNING", CoreMessages.MSGID_ERROR_SEVERITY_SEVERE_WARNING);
-
-
-
- /**
- * The log level that will be used for messages related to the Directory
- * Server shutdown process.
- */
- public static final Level SHUTDOWN_DEBUG = new DirectoryLogLevel(
- "SHUTDOWN", CoreMessages.MSGID_ERROR_SEVERITY_SHUTDOWN_DEBUG);
-
-
-
- /**
- * The log level that will be used for messages related to the Directory
- * Server startup process.
- */
- public static final Level STARTUP_DEBUG = new DirectoryLogLevel(
- "STARTUP", CoreMessages.MSGID_ERROR_SEVERITY_STARTUP_DEBUG);
-
-
- /**
- * Constructor for the DirectoryLogLevel class.
- *
- * @param name The name of the level.
- * @param value The value of the level.
- */
- public DirectoryLogLevel(String name, int value)
- {
- super(name, value);
- }
-
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/Error.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/Error.java
deleted file mode 100644
index a52412a..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/Error.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-
-
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.opends.server.api.ErrorLogger;
-import org.opends.server.messages.MessageHandler;
-import org.opends.server.types.ErrorLogCategory;
-import org.opends.server.types.ErrorLogSeverity;
-
-
-
-/**
- * This class defines the wrapper that will invoke all registered error loggers
- * for each type of request received or response sent.
- */
-public class Error
-{
- // The set of error loggers that have been registered with the server. It
- // will initially be empty.
- private static CopyOnWriteArrayList<ErrorLogger> errorLoggers =
- new CopyOnWriteArrayList<ErrorLogger>();
-
- // A mutex that will be used to provide threadsafe error to methods changing
- // the set of defined loggers.
- private static ReentrantLock loggerMutex = new ReentrantLock();
-
-
-
- /**
- * Adds a new error logger to which error messages should be sent.
- *
- * @param logger The error logger to which messages should be sent.
- */
- public static void addErrorLogger(ErrorLogger logger)
- {
- loggerMutex.lock();
-
- try
- {
- for (ErrorLogger l : errorLoggers)
- {
- if (l.equals(logger))
- {
- return;
- }
- }
-
- errorLoggers.add(logger);
- }
- catch (Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- loggerMutex.unlock();
- }
- }
-
-
-
- /**
- * Removes the provided error logger so it will no longer be sent any new
- * error messages.
- *
- * @param logger The error logger to remove from the set.
- */
- public static void removeErrorLogger(ErrorLogger logger)
- {
- loggerMutex.lock();
-
- try
- {
- errorLoggers.remove(logger);
- }
- catch (Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- loggerMutex.unlock();
- }
- }
-
-
-
- /**
- * Removes all active error loggers so that no error messages will be sent
- * anywhere.
- *
- * @param closeLoggers Indicates whether the loggers should be closed as
- * they are unregistered.
- */
- public static void removeAllErrorLoggers(boolean closeLoggers)
- {
- loggerMutex.lock();
-
- try
- {
- if (closeLoggers)
- {
- ErrorLogger[] loggers = new ErrorLogger[errorLoggers.size()];
- errorLoggers.toArray(loggers);
-
- errorLoggers.clear();
-
- for (ErrorLogger logger : loggers)
- {
- logger.closeErrorLogger();
- }
- }
- else
- {
- errorLoggers.clear();
- }
- }
- catch (Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- loggerMutex.unlock();
- }
- }
-
-
-
- /**
- * Writes a message to the error log using the provided information.
- *
- * @param category The category that may be used to determine whether to
- * actually log this message.
- * @param severity The severity that may be used to determine whether to
- * actually log this message.
- * @param errorID The error ID that uniquely identifies the provided format
- * string.
- */
- public static void logError(ErrorLogCategory category,
- ErrorLogSeverity severity, int errorID)
- {
- String message = MessageHandler.getMessage(errorID);
-
- for (ErrorLogger l : errorLoggers)
- {
- l.logError(category, severity, message, errorID);
- }
- }
-
-
-
- /**
- * Writes a message to the error log using the provided information.
- *
- * @param category The category that may be used to determine whether to
- * actually log this message.
- * @param severity The severity that may be used to determine whether to
- * actually log this message.
- * @param errorID The error ID that uniquely identifies the provided format
- * string.
- * @param args The set of arguments to use for the provided format
- * string.
- */
- public static void logError(ErrorLogCategory category,
- ErrorLogSeverity severity, int errorID,
- Object... args)
- {
- String message = MessageHandler.getMessage(errorID, args);
-
- for (ErrorLogger l : errorLoggers)
- {
- l.logError(category, severity, message, errorID);
- }
- }
-
-
-
- /**
- * Writes a message to the error log using the provided information.
- *
- * @param category The category that may be used to determine whether to
- * actually log this message.
- * @param severity The severity that may be used to determine whether to
- * actually log this message.
- * @param message The message to be logged.
- * @param errorID The error ID that uniquely identifies the format string
- * used to generate the provided message.
- */
- public static void logError(ErrorLogCategory category,
- ErrorLogSeverity severity, String message,
- int errorID)
- {
- for (ErrorLogger l : errorLoggers)
- {
- l.logError(category, severity, message, errorID);
- }
- }
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/ErrorLogger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/ErrorLogger.java
new file mode 100644
index 0000000..656b072
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/ErrorLogger.java
@@ -0,0 +1,444 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers;
+
+
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+import org.opends.server.api.ErrorLogPublisher;
+import org.opends.server.messages.MessageHandler;
+import org.opends.server.types.*;
+import org.opends.server.admin.std.server.ErrorLogPublisherCfg;
+import org.opends.server.admin.std.meta.ErrorLogPublisherCfgDefn;
+import org.opends.server.admin.server.ConfigurationAddListener;
+import org.opends.server.admin.server.ConfigurationDeleteListener;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.ClassPropertyDefinition;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.DirectoryServer;
+
+import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.messages.ConfigMessages.*;
+import static org.opends.server.util.StaticUtils.*;
+import static org.opends.server.messages.MessageHandler.getMessage;
+
+/**
+ * This class defines the wrapper that will invoke all registered error loggers
+ * for each type of request received or response sent. If no error log
+ * publishers are registered, messages will be directed to standard out.
+ */
+public class ErrorLogger implements
+ ConfigurationAddListener<ErrorLogPublisherCfg>,
+ ConfigurationDeleteListener<ErrorLogPublisherCfg>,
+ ConfigurationChangeListener<ErrorLogPublisherCfg>
+{
+ // The set of error loggers that have been registered with the server. It
+ // will initially be empty.
+ private static ConcurrentHashMap<DN, ErrorLogPublisher> errorPublishers =
+ new ConcurrentHashMap<DN, ErrorLogPublisher>();
+
+ // The singleton instance of this class for configuration purposes.
+ private static final ErrorLogger instance = new ErrorLogger();
+
+ /**
+ * Retrieve the singleton instance of this class.
+ *
+ * @return The singleton instance of this logger.
+ */
+ public static ErrorLogger getInstance()
+ {
+ return instance;
+ }
+
+ /**
+ * Add an error log publisher to the error logger.
+ *
+ * @param dn The DN of the configuration entry for the publisher.
+ * @param publisher The error log publisher to add.
+ */
+ public synchronized static void addErrorLogPublisher(DN dn,
+ ErrorLogPublisher publisher)
+ {
+ errorPublishers.put(dn, publisher);
+ }
+
+ /**
+ * Remove an error log publisher from the error logger.
+ *
+ * @param dn The DN of the publisher to remove.
+ * @return The publisher that was removed or null if it was not found.
+ */
+ public synchronized static ErrorLogPublisher removeErrorLogPublisher(DN dn)
+ {
+ ErrorLogPublisher errorLogPublisher = errorPublishers.remove(dn);
+ if(errorLogPublisher != null)
+ {
+ errorLogPublisher.close();
+ }
+
+ return errorLogPublisher;
+ }
+
+ /**
+ * Removes all existing error log publishers from the logger.
+ */
+ public synchronized static void removeAllErrorLogPublishers()
+ {
+ for(ErrorLogPublisher publisher : errorPublishers.values())
+ {
+ publisher.close();
+ }
+
+ errorPublishers.clear();
+ }
+
+ /**
+ * Initializes all the error log publishers.
+ *
+ * @param configs The error log publisher configurations.
+ * @throws ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public void initializeErrorLogger(List<ErrorLogPublisherCfg> configs)
+ throws ConfigException, InitializationException
+ {
+ for(ErrorLogPublisherCfg config : configs)
+ {
+ config.addErrorChangeListener(this);
+
+ if(config.isEnabled())
+ {
+ ErrorLogPublisher errorLogPublisher = getErrorPublisher(config);
+
+ addErrorLogPublisher(config.dn(), errorLogPublisher);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationAddAcceptable(ErrorLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ return !config.isEnabled() ||
+ isJavaClassAcceptable(config, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(ErrorLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ return !config.isEnabled() ||
+ isJavaClassAcceptable(config, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationAdd(ErrorLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ config.addErrorChangeListener(this);
+
+ if(config.isEnabled())
+ {
+ try
+ {
+ ErrorLogPublisher errorLogPublisher = getErrorPublisher(config);
+
+ addErrorLogPublisher(config.dn(), errorLogPublisher);
+ }
+ catch(ConfigException e)
+ {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ messages.add(e.getMessage());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+ catch (Exception e)
+ {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ int msgID = MSGID_CONFIG_LOGGER_CANNOT_CREATE_LOGGER;
+ messages.add(getMessage(msgID, String.valueOf(config.dn().toString()),
+ stackTraceToSingleLineString(e)));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+ }
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ ErrorLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ DN dn = config.dn();
+ ErrorLogPublisher errorLogPublisher = errorPublishers.get(dn);
+
+ if(errorLogPublisher == null)
+ {
+ if(config.isEnabled())
+ {
+ // Needs to be added and enabled.
+ return applyConfigurationAdd(config);
+ }
+ }
+ else
+ {
+ if(config.isEnabled())
+ {
+ // The publisher is currently active, so we don't need to do anything.
+ // Changes to the class name cannot be
+ // applied dynamically, so if the class name did change then
+ // indicate that administrative action is required for that
+ // change to take effect.
+ String className = config.getJavaImplementationClass();
+ if(!className.equals(errorLogPublisher.getClass().getName()))
+ {
+ adminActionRequired = true;
+ }
+ }
+ else
+ {
+ // The publisher is being disabled so shut down and remove.
+ removeErrorLogPublisher(config.dn());
+ }
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationDeleteAcceptable(ErrorLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ DN dn = config.dn();
+ ErrorLogPublisher errorLogPublisher = errorPublishers.get(dn);
+ return errorLogPublisher != null;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationDelete(
+ ErrorLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+
+ removeErrorLogPublisher(config.dn());
+
+ return new ConfigChangeResult(resultCode, adminActionRequired);
+ }
+
+ private boolean isJavaClassAcceptable(ErrorLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ String className = config.getJavaImplementationClass();
+ ErrorLogPublisherCfgDefn d = ErrorLogPublisherCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a DebugLogPublisher.
+ Class<? extends ErrorLogPublisher> theClass;
+ try {
+ theClass = pd.loadClass(className, ErrorLogPublisher.class);
+ theClass.newInstance();
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // Check that the implementation class implements the correct interface.
+ try {
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ theClass.getMethod("initializeErrorLogPublisher", config.definition()
+ .getServerConfigurationClass());
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // The class is valid as far as we can tell.
+ return true;
+ }
+
+ private ErrorLogPublisher getErrorPublisher(ErrorLogPublisherCfg config)
+ throws ConfigException {
+ String className = config.getJavaImplementationClass();
+ ErrorLogPublisherCfgDefn d = ErrorLogPublisherCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a ErrorLogPublisher.
+ Class<? extends ErrorLogPublisher> theClass;
+ ErrorLogPublisher errorLogPublisher;
+ try {
+ theClass = pd.loadClass(className, ErrorLogPublisher.class);
+ errorLogPublisher = theClass.newInstance();
+
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ Method method = theClass.getMethod("initializeErrorLogPublisher",
+ config.definition().getServerConfigurationClass());
+ method.invoke(errorLogPublisher, config);
+ }
+ catch (InvocationTargetException ite)
+ {
+ // Rethrow the exceptions thrown be the invoked method.
+ Throwable e = ite.getTargetException();
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ throw new ConfigException(msgID, message, e);
+ }
+ catch (Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ERROR_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ throw new ConfigException(msgID, message, e);
+ }
+
+ // The error publisher has been successfully initialized.
+ return errorLogPublisher;
+ }
+
+
+
+ /**
+ * Writes a message to the error log using the provided information.
+ *
+ * @param category The category that may be used to determine whether to
+ * actually log this message.
+ * @param severity The severity that may be used to determine whether to
+ * actually log this message.
+ * @param errorID The error ID that uniquely identifies the provided format
+ * string.
+ */
+ public static void logError(ErrorLogCategory category,
+ ErrorLogSeverity severity, int errorID)
+ {
+ String message = MessageHandler.getMessage(errorID);
+
+ for (ErrorLogPublisher publisher : errorPublishers.values())
+ {
+ publisher.logError(category, severity, message, errorID);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the error log using the provided information.
+ *
+ * @param category The category that may be used to determine whether to
+ * actually log this message.
+ * @param severity The severity that may be used to determine whether to
+ * actually log this message.
+ * @param errorID The error ID that uniquely identifies the provided format
+ * string.
+ * @param args The set of arguments to use for the provided format
+ * string.
+ */
+ public static void logError(ErrorLogCategory category,
+ ErrorLogSeverity severity, int errorID,
+ Object... args)
+ {
+ String message = MessageHandler.getMessage(errorID, args);
+
+ for (ErrorLogPublisher publisher : errorPublishers.values())
+ {
+ publisher.logError(category, severity, message, errorID);
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the error log using the provided information.
+ *
+ * @param category The category that may be used to determine whether to
+ * actually log this message.
+ * @param severity The severity that may be used to determine whether to
+ * actually log this message.
+ * @param message The message to be logged.
+ * @param errorID The error ID that uniquely identifies the format string
+ * used to generate the provided message.
+ */
+ public static void logError(ErrorLogCategory category,
+ ErrorLogSeverity severity, String message,
+ int errorID)
+ {
+ for (ErrorLogPublisher publisher : errorPublishers.values())
+ {
+ publisher.logError(category, severity, message, errorID);
+ }
+ }
+}
+
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/FileNamingPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/FileNamingPolicy.java
index ba76ea8..86f8874 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/FileNamingPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/FileNamingPolicy.java
@@ -27,6 +27,7 @@
package org.opends.server.loggers;
import java.io.File;
+import java.io.FilenameFilter;
/**
* A FileNamingPolicy is used by a MultiFileWriter to generate the
@@ -47,4 +48,21 @@
* @return the next file.
*/
public File getNextName();
+
+ /**
+ * Gets the filename filter that can be used to filter files named by this
+ * policy.
+ *
+ * @return The FilenameFilter that can filter files named by this policy.
+ */
+ public FilenameFilter getFilenameFilter();
+
+ /**
+ * Gets all the existing files named by this policy.
+ *
+ * @return The files named by this policy.
+ */
+ public File[] listFiles();
+
+
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/FileNumberRetentionPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/FileNumberRetentionPolicy.java
index 332d49a..9639fe7 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/FileNumberRetentionPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/FileNumberRetentionPolicy.java
@@ -26,57 +26,91 @@
*/
package org.opends.server.loggers;
+import org.opends.server.admin.std.server.FileCountLogRetentionPolicyCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+
import java.io.File;
import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.ResultCode;
/**
* This class implements a retention policy based on the number of files.
* Files will be cleaned up based on the number of files on disk.
*/
-public class FileNumberRetentionPolicy implements RetentionPolicy
+public class FileNumberRetentionPolicy implements
+ RetentionPolicy<FileCountLogRetentionPolicyCfg>,
+ ConfigurationChangeListener<FileCountLogRetentionPolicyCfg>
{
private int numFiles = 0;
- private File directory = null;
- private String prefix = null;
/**
- * Create the retention policy based on the number of files.
- *
- * @param dir The directory in which the log files reside.
- * @param prefix The prefix for the log file names.
- * @param numFiles The number of files on disk.
+ * {@inheritDoc}
*/
- public FileNumberRetentionPolicy(String dir, String prefix, int numFiles)
+ public void initializeLogRetentionPolicy(
+ FileCountLogRetentionPolicyCfg config)
{
- this.numFiles = numFiles;
- this.directory = new File(dir);
- this.prefix = prefix;
+ numFiles = config.getNumberOfFiles();
+
+ config.addFileCountChangeListener(this);
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ FileCountLogRetentionPolicyCfg config,
+ List<String> unacceptableReasons)
+ {
+ // Changes should always be OK
+ return true;
+ }
/**
- * This method deletes files based on the policy.
- *
- * @return number of files deleted.
+ * {@inheritDoc}
*/
- public int deleteFiles()
+ public ConfigChangeResult applyConfigurationChange(
+ FileCountLogRetentionPolicyCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ numFiles = config.getNumberOfFiles();
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int deleteFiles(MultifileTextWriter writer)
{
int count = 0;
+ File[] files = writer.getNamingPolicy().listFiles();
- File[] selectedFiles = directory.listFiles(new LogFileFilter(prefix));
- if (selectedFiles.length <= numFiles)
+ if (files.length <= numFiles)
{
return 0;
}
// Sort files based on last modified time.
- Arrays.sort(selectedFiles, new FileComparator());
+ Arrays.sort(files, new FileComparator());
- for (int j = numFiles; j < selectedFiles.length; j++)
+ for (int j = numFiles; j < files.length; j++)
{
- // System.out.println("Deleting log file:" + selectedFiles[j]);
- selectedFiles[j].delete();
+ if(debugEnabled())
+ {
+ debugInfo("Deleting log file:", files[j]);
+ }
+ files[j].delete();
count++;
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/FixedTimeRotationPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/FixedTimeRotationPolicy.java
index a15fb86..e35d86f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/FixedTimeRotationPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/FixedTimeRotationPolicy.java
@@ -26,117 +26,127 @@
*/
package org.opends.server.loggers;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
+import java.util.*;
import org.opends.server.util.TimeThread;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
+import org.opends.server.admin.std.server.FixedTimeLogRotationPolicyCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.ResultCode;
/**
* This class implements a rotation policy based on fixed
* day/time of day.
*/
-public class FixedTimeRotationPolicy implements RotationPolicy
+public class FixedTimeRotationPolicy implements
+ RotationPolicy<FixedTimeLogRotationPolicyCfg>,
+ ConfigurationChangeListener<FixedTimeLogRotationPolicyCfg>
{
- private static final long NEXT_DAY = 24 * 3600 * 1000;
+ private static final long MS_IN_DAY = 24 * 3600 * 1000;
+ // The scheduled rotation times as ms offsets from the beginnging of the day.
private long[] rotationTimes;
- private long nextRotationTime = 0;
/**
- * Time in HHmm format. Will be calculated as (hourOfDay*100) +
- * minuteOfHour.
- *
- * @param timeOfDays The times at which log rotation should occur.
- */
-
- public FixedTimeRotationPolicy(int[] timeOfDays)
+ * {@inheritDoc}
+ */
+ public void initializeLogRotationPolicy(FixedTimeLogRotationPolicyCfg config)
{
- Calendar cal = new GregorianCalendar();
- cal.set( Calendar.MILLISECOND, 0 );
- cal.set( Calendar.SECOND, 0 );
- cal.set( Calendar.MINUTE, 0 );
- cal.set( Calendar.HOUR_OF_DAY, 0 );
- long timeFromStartOfDay = cal.getTime().getTime();
+ rotationTimes = new long[config.getTimeOfDay().size()];
- rotationTimes = new long[timeOfDays.length];
-
- for(int i = 0; i < timeOfDays.length; i++)
+ int i = 0;
+ for(String time : config.getTimeOfDay())
{
- int hour = timeOfDays[i]/100;
- int min = timeOfDays[i] - hour*100;
+ int hour = Integer.valueOf(time)/100;
+ int min = Integer.valueOf(time) - hour*100;
- rotationTimes[i] = timeFromStartOfDay + hour*3600*1000 + min*60*1000;
+ rotationTimes[i++] = hour*3600*1000 + min*60*1000;
}
- long currTime = TimeThread.getTime();
+ Arrays.sort(rotationTimes);
- nextRotationTime = getNextRotationTime(currTime, 0);
-
+ config.addFixedTimeChangeListener(this);
}
/**
- * This method indicates if the log file should be
- * rotated or not.
- *
- * @return true if the file needs to be rotated, false otherwise.
+ * {@inheritDoc}
*/
- public boolean rotateFile()
+ public boolean isConfigurationChangeAcceptable(
+ FixedTimeLogRotationPolicyCfg config, List<String> unacceptableReasons)
{
- long currTime = TimeThread.getTime();
- if (debugEnabled())
- {
- debugInfo("Rotation at fixed time: %d nextRotationTime: %d",
- currTime, nextRotationTime);
- }
-
- if(currTime > nextRotationTime)
- {
- nextRotationTime = getNextRotationTime(currTime, nextRotationTime);
- if (debugEnabled())
- {
- debugInfo("Setting next rotation to : %d", nextRotationTime);
- }
- return true;
- }
- return false;
+ // Changes should always be OK
+ return true;
}
/**
- * Get the next rotation time.
- *
- * @param currTime The current time.
- * @param currRotationTime The time we currently believe should be the next
- * rotation time.
- *
- * @return The time that should be used for the next log file rotation.
+ * {@inheritDoc}
*/
- private long getNextRotationTime(long currTime, long currRotationTime)
+ public ConfigChangeResult applyConfigurationChange(
+ FixedTimeLogRotationPolicyCfg config)
{
- long prevRotationTime = currRotationTime;
- for(int j = 0; j < rotationTimes.length; j++)
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ rotationTimes = new long[config.getTimeOfDay().size()];
+
+ int i = 0;
+ for(String time : config.getTimeOfDay())
{
- if (currTime < rotationTimes[j])
+ int hour = Integer.valueOf(time)/100;
+ int min = Integer.valueOf(time) - hour*100;
+
+ rotationTimes[i++] = hour*3600*1000 + min*60*1000;
+ }
+
+ Arrays.sort(rotationTimes);
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean rotateFile(MultifileTextWriter writer)
+ {
+ long currTime = TimeThread.getTime();
+ long lastRotationTime = writer.getLastRotationTime();
+ long dayOfLastRotation = MS_IN_DAY * (lastRotationTime / MS_IN_DAY);
+ long hourOfLastRotation = lastRotationTime - dayOfLastRotation;
+
+ // Find a scheduled rotation time thats right after the last rotation time.
+ long hourOfNextRotation = 0;
+ for(long time : rotationTimes)
+ {
+ if(time > hourOfLastRotation)
{
- currRotationTime = rotationTimes[j];
+ hourOfNextRotation = time;
break;
}
}
- if(currRotationTime == prevRotationTime)
+ if(hourOfNextRotation <= 0)
{
- for(int k = 0; k < rotationTimes.length; k++)
- {
- rotationTimes[k] += NEXT_DAY;
- }
- currRotationTime = rotationTimes[0];
+ // Rotation alrealy happened after the latest fixed time for that day.
+ // Set it the first rotation time for the next day.
+ hourOfNextRotation = rotationTimes[0] + MS_IN_DAY;
}
- return currRotationTime;
- }
+ long nextRotationTime = dayOfLastRotation + hourOfNextRotation;
+ if (debugEnabled())
+ {
+ debugInfo("As of %d, the next rotation at fixed time is: %d",
+ currTime, nextRotationTime);
+ }
+
+ return currTime > nextRotationTime;
+
+ }
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/FreeDiskSpaceRetentionPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/FreeDiskSpaceRetentionPolicy.java
index 2def134..b3cc34e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/FreeDiskSpaceRetentionPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/FreeDiskSpaceRetentionPolicy.java
@@ -29,54 +29,92 @@
import java.io.File;
import java.lang.reflect.Method;
import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.List;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
import org.opends.server.types.DebugLogLevel;
+import org.opends.server.types.ResultCode;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.admin.std.server.FreeDiskSpaceLogRetentionPolicyCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
/**
* This class implements a retention policy based on the free disk
* space available expressed as a percentage. This policy is only
* available on Java 6.
*/
-public class FreeDiskSpaceRetentionPolicy implements RetentionPolicy
+public class FreeDiskSpaceRetentionPolicy implements
+ RetentionPolicy<FreeDiskSpaceLogRetentionPolicyCfg>,
+ ConfigurationChangeListener<FreeDiskSpaceLogRetentionPolicyCfg>
{
private long freeDiskSpace = 0;
- private File directory = null;
- private String prefix = null;
/**
- * Create the retention policy based on the free disk space available.
- *
- * @param dir The directory in which the log files reside.
- * @param prefix The prefix for the log file names.
- * @param freeDiskSpace The free disk space needed.
+ * {@inheritDoc}
*/
- public FreeDiskSpaceRetentionPolicy(String dir, String prefix,
- long freeDiskSpace)
+ public void initializeLogRetentionPolicy(
+ FreeDiskSpaceLogRetentionPolicyCfg config)
{
- this.directory = new File(dir);
- this.freeDiskSpace = freeDiskSpace;
- this.prefix = prefix;
+ freeDiskSpace = config.getFreeDiskSpace();
+
+ config.addFreeDiskSpaceChangeListener(this);
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ FreeDiskSpaceLogRetentionPolicyCfg config,
+ List<String> unacceptableReasons)
+ {
+ // Changes should always be OK
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ FreeDiskSpaceLogRetentionPolicyCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ freeDiskSpace = config.getFreeDiskSpace();
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
/**
* This method deletes files based on the policy.
*
+ * @param writer the multi file text writer writing the log files.
* @return number of files deleted.
*/
- public int deleteFiles()
+ public int deleteFiles(MultifileTextWriter writer)
{
+ File[] files = writer.getNamingPolicy().listFiles();
+
+ if(files.length <= 0)
+ {
+ return 0;
+ }
+
int count = 0;
long freeSpace = 0;
+
try
{
// Use reflection to see use the getFreeSpace method if available.
// this method is only available on Java 6.
Method meth = File.class.getMethod("getFreeSpace", new Class[0]);
- Object value = meth.invoke(this.directory);
+ Object value = meth.invoke(files[0]);
freeSpace = ((Long) value).longValue();
}
catch (Exception e)
@@ -88,6 +126,12 @@
return 0;
}
+ if(debugEnabled())
+ {
+ debugInfo("Current free disk space: %d, Required: %d", freeSpace,
+ freeDiskSpace);
+ }
+
if (freeSpace > freeDiskSpace)
{
// No cleaning needed.
@@ -95,17 +139,19 @@
}
long freeSpaceNeeded = freeDiskSpace - freeSpace;
- File[] selectedFiles = directory.listFiles(new LogFileFilter(prefix));
// Sort files based on last modified time.
- Arrays.sort(selectedFiles, new FileComparator());
+ Arrays.sort(files, new FileComparator());
long freedSpace = 0;
- for (int j = selectedFiles.length - 1; j < 1; j--)
+ for (int j = files.length - 1; j < 1; j--)
{
- freedSpace += selectedFiles[j].length();
- // System.out.println("Deleting log file:" + selectedFiles[j]);
- selectedFiles[j].delete();
+ freedSpace += files[j].length();
+ if(debugEnabled())
+ {
+ debugInfo("Deleting log file:", files[j]);
+ }
+ files[j].delete();
if (freedSpace >= freeSpaceNeeded)
{
break;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/InitializationErrorManager.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/InitializationErrorManager.java
deleted file mode 100644
index 1f4f4c8..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/InitializationErrorManager.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import java.util.logging.ErrorManager;
-
-/**
- * Error manager for the file handler.
- */
-
-class InitializationErrorManager extends ErrorManager
-{
- Exception lastException;
-
-
- /**
- * Notes an error based on the provided information.
- *
- * @param msg A message explaining the problem that occurred.
- * @param ex The exception that was thrown.
- * @param code The error code.
- */
- public void error(String msg, Exception ex, int code)
- {
- lastException = ex;
- }
-}
-
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java
new file mode 100644
index 0000000..88b7259
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java
@@ -0,0 +1,119 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers;
+
+import org.opends.server.types.DN;
+
+import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.messages.LoggerMessages.*;
+import static org.opends.server.util.StaticUtils.*;
+
+import java.io.File;
+
+/**
+ * A LogPublisherErrorHandler is used for notification of exceptions which
+ * occur during the publishing of a record.
+ *
+ * The advantage of using a handler is that we can handle exceptions
+ * asynchronously (useful when dealing with an AsynchronousPublisher).
+ */
+public class LogPublisherErrorHandler
+{
+ private DN publisherConfigDN;
+ private boolean writeErrorOccured = false;
+
+ /**
+ * Construct a new log publisher error handler for a log publisher
+ * with the provided configuration DN.
+ *
+ * @param publisherConfigDN The DN of the managed object for the
+ * log publisher.
+ */
+ public LogPublisherErrorHandler(DN publisherConfigDN)
+ {
+ this.publisherConfigDN = publisherConfigDN;
+ }
+
+ /**
+ * Handle an exception which occurred during the publishing
+ * of a log record.
+ * @param record - the record which was being published.
+ * @param ex - the exception occurred.
+ */
+ public void handleWriteError(String record, Throwable ex)
+ {
+ if(!writeErrorOccured)
+ {
+ int msgID = MSGID_LOGGER_ERROR_WRITING_RECORD;
+ String msg = getMessage(msgID, publisherConfigDN.toString(),
+ stackTraceToSingleLineString(ex));
+ System.err.println(msg);
+ writeErrorOccured = true;
+ }
+ }
+
+ /**
+ * Handle an exception which occured while trying to open a log
+ * file.
+ * @param file - the file which was being opened.
+ * @param ex - the exception occured.
+ */
+ public void handleOpenError(File file, Throwable ex)
+ {
+ int msgID = MSGID_LOGGER_ERROR_OPENING_FILE;
+ String msg = getMessage(msgID, file.toString(),
+ publisherConfigDN.toString(),
+ stackTraceToSingleLineString(ex));
+ System.err.println(msg);
+ }
+
+ /**
+ * Handle an exception which occured while trying to close a log
+ * file.
+ * @param ex - the exception occured.
+ */
+ public void handleCloseError(Throwable ex)
+ {
+ int msgID = MSGID_LOGGER_ERROR_CLOSING_FILE;
+ String msg = getMessage(msgID, publisherConfigDN.toString(),
+ stackTraceToSingleLineString(ex));
+ System.err.println(msg);
+ }
+
+ /**
+ * Handle an exception which occured while trying to flush the
+ * writer buffer.
+ * @param ex - the exception occured.
+ */
+ public void handleFlushError(Throwable ex)
+ {
+ int msgID = MSGID_LOGGER_ERROR_FLUSHING_BUFFER;
+ String msg = getMessage(msgID, publisherConfigDN.toString(),
+ stackTraceToSingleLineString(ex));
+ System.err.println(msg);
+ }
+}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/LogRecord.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/LogRecord.java
deleted file mode 100644
index 0daf101..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/LogRecord.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-/**
- * A LogRecord is reponsible for passing log messages from the individual
- * Loggers to the LogPublishers.
- */
-public class LogRecord
-{
- /**
- * Non-localized raw message text.
- */
- private String message;
-
- /**
- * The logger that generated the record.
- */
- private Logger logger;
-
- /**
- * The object that generated the record.
- */
- private Object caller;
-
- /**
- * Construct a LogRecord with the given message value.
- *
- * All other properties will be initialized to "null".
- *
- * @param msg the raw non-localized logging message (may be null).
- */
- public LogRecord(String msg)
- {
- this(null, null, msg);
- }
-
- /**
- * Construct a LogRecord with the given source logger
- * and message values.
- *
- * @param logger the source logger (may be null).
- * @param msg the raw non-localized logging message.
- */
- public LogRecord(Logger logger, String msg)
- {
- this(null, logger, msg);
- }
-
- /**
- * Construct a LogRecord with the given source object, source logger
- * and message values.
- *
- * All other properties will be initialized to "null".
- *
- * @param caller the source object (may be null).
- * @param logger the source logger (may be null).
- * @param msg the raw non-localized logging message (may be null).
- */
- public LogRecord(Object caller, Logger logger, String msg)
- {
- this.caller = caller;
- this.logger = logger;
- this.message = msg;
- }
-
- /**
- * Get the source Logger.
- *
- * @return source logger (may be null).
- */
- public Logger getLogger()
- {
- return logger;
- }
-
- /**
- * Set the source Logger.
- *
- * @param logger logger object that generated the record.
- */
- public void setLogger(Logger logger)
- {
- this.logger = logger;
- }
-
- /**
- * Get the "raw" log message, before localization or formatting.
- * <p>
- * May be null, which is equivalent to the empty string "".
- * with the localized value.
- *
- * @return the raw message string
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Set the "raw" log message, before localization or formatting.
- *
- * @param message the raw message string (may be null).
- */
- public void setMessage(String message) {
- this.message = message;
- }
-
- /**
- * Get the source caller.
- * <p>
- * Source caller is the object that generated this log record
- *
- * @return the source caller
- */
- public Object getCaller() {
- return caller;
- }
-
- /**
- * Set the source caller.
- * <p>
- * Source caller is the object that generated this log record
- *
- * @param caller source caller
- */
- public void setCaller(Object caller) {
- this.caller = caller;
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/Logger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/Logger.java
deleted file mode 100644
index c399cb8..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/Logger.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import org.opends.server.api.LogPublisher;
-
-import java.util.List;
-
-/**
- * A Logger is the entry point into a message distribution
- * system. The Logger receives messages from an external source, optionally
- * filters out undesired messages using a RecordFilter, and
- * sends them to a LogPublisher for further distribution.
- * Any logging exceptions encountered will be sent to a
- * LoggerErrorHandler.
- */
-public abstract class Logger
-{
- /**
- * Whether the debug logger is enabled or disabled.
- */
- protected boolean enabled;
-
- /**
- * The logging error handler.
- */
- protected LoggerErrorHandler handler;
-
- /**
- * The set of publishers.
- */
- protected List<LogPublisher> publishers;
-
- /**
- * Construct a new logger object.
- *
- * @param config the logger configuration to use when construting the new
- * logger object.
- */
- protected Logger(LoggerConfiguration config)
- {
- this.enabled = config.getEnabled();
- this.publishers = config.getPublishers();
- this.handler = config.getErrorHandler();
- }
-
- /**
- * Publish a record to all the registered publishers.
- *
- * @param record The log record to publish.
- */
- public void publishRecord(LogRecord record)
- {
- for(LogPublisher p : publishers)
- {
- p.publish(record, handler);
- }
- }
-
- /**
- * Update this logger with the provided configuration.
- *
- * @param config the new configuration to use for this logger.
- */
- protected void updateConfiguration(LoggerConfiguration config)
- {
- boolean newEnabled = config.getEnabled();
- if(enabled && !newEnabled)
- {
- //it is now disabled. Close all publishers if any.
- for(LogPublisher publisher : publishers)
- {
- publisher.shutdown();
- publishers.remove(publisher);
- }
- }
-
- if(newEnabled)
- {
- List<LogPublisher> newPublishers = config.getPublishers();
- for(LogPublisher oldPublisher : publishers)
- {
- if(!newPublishers.contains(oldPublisher))
- {
- //A publisher was removed. Make sure to close it before removing it.
- oldPublisher.shutdown();
- }
- }
- this.publishers = config.getPublishers();
- this.handler = config.getErrorHandler();
- }
-
- enabled = newEnabled;
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerConfiguration.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerConfiguration.java
deleted file mode 100644
index 52877ef..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerConfiguration.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import org.opends.server.api.LogPublisher;
-
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.*;
-
-/**
- * A LoggerConfiguration encapsulates the information defining an
- * abstract log messaging system. A LoggerConfiguration maintains at
- * least three things:
- * <ul>
- * <li>a destination to send log messages to (a LogPublisher).</li>
- * <li>an optional filter used to restrict the log messages sent
- * (a RecordFilter).</li>
- * <li>an error handler to be notified in the case of any logging
- * exceptions (a LoggerErrorHandler).</li>
- * </ul>
- *
- * A Logger will use this information to initialize the log messaging
- * system. Additionally, a Logger will register with the LoggerConfiguration
- * object it used to allow the LoggerConfiguration to provide a single
- * point of configuration management. On configuration changes, registered
- * Loggers will be notified.
- *
- */
-public class LoggerConfiguration {
-
- /**
- * Whether the debug logger is enabled or disabled.
- */
- protected boolean enabled;
-
- /** The log destination for this configuration. */
- protected CopyOnWriteArrayList<LogPublisher> publishers;
-
- /**
- * A mutex that will be used to provide threadsafe access to methods
- * changing the set of defined publishers.
- */
- protected ReentrantLock publisherMutex;
-
- /**
- * The logging error handler.
- */
- protected LoggerErrorHandler handler;
-
- /** The record filter for this configuration. */
- //protected RecordFilter _filter;
-
- /** The loggers that need notification of configuration changes. */
- protected Set<Logger> loggers;
-
- /**
- * Creates a LoggerConfiguration describing an disabled logging system.
- *
- * @param handler the error handler to use for the logger configured by this
- * configuration.
- */
- public LoggerConfiguration(LoggerErrorHandler handler)
- {
- this.enabled = false;
- this.publishers = new CopyOnWriteArrayList<LogPublisher>();
- this.publisherMutex = new ReentrantLock();
- this.handler = handler;
- this.loggers = new HashSet<Logger>();
- }
-
- /**
- * Enable or disable the debug logger.
- *
- * @param enable if the debug logger should be enabled.
- */
- public void setEnabled(boolean enable)
- {
- this.enabled = enable;
- }
-
- /**
- * Obtain the status of this logger singleton.
- *
- * @return the status of this logger.
- */
- public boolean getEnabled()
- {
- return enabled;
- }
-
- /**
- * Adds a new publisher to which log records should be sent.
- *
- * @param publisher The publisher to which records should be sent.
- */
- public void addPublisher(LogPublisher publisher)
- {
- publisherMutex.lock();
-
- try
- {
- for (LogPublisher p : publishers)
- {
- if (p.equals(publisher))
- {
- return;
- }
- }
-
- publishers.add(publisher);
- }
- catch (Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- publisherMutex.unlock();
- }
- }
-
- /**
- * Removes the provided publisher so records will no longer be sent to it.
- *
- * @param publisher The publisher to remove.
- */
- public void removePublisher(LogPublisher publisher)
- {
- publisherMutex.lock();
-
- try
- {
- publishers.remove(publisher);
- }
- catch (Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- publisherMutex.unlock();
- }
- }
-
- /**
- * Removes all publishers so records are not sent anywhere.
- *
- * @param closePublishers whether to close the publishers when removing them.
- */
- public void removeAllPublishers(boolean closePublishers)
- {
- publisherMutex.lock();
-
- try
- {
- if(closePublishers)
- {
- LogPublisher[] pubs = new LogPublisher[publishers.size()];
- publishers.toArray(pubs);
-
- publishers.clear();
-
- for(LogPublisher pub : pubs)
- {
- pub.shutdown();
- }
- }
- else
- {
- publishers.clear();
- }
- }
- catch(Exception e)
- {
- // This should never happen.
- e.printStackTrace();
- }
- finally
- {
- publisherMutex.unlock();
- }
- }
-
- /**
- * Retrieves the set of publishers included in this configuration.
- *
- * @return the set of publishers included in this configuration.
- */
- public List<LogPublisher> getPublishers()
- {
- return Collections.unmodifiableList(publishers);
- }
-
- /**
- * Retrieves the error handler included in this configuration.
- *
- * @return the error handler used by this configuration.
- */
- public LoggerErrorHandler getErrorHandler()
- {
- return handler;
- }
-
- /**
- * Set an error handler for this configuration.
- *
- * @param handler the error handler to set for this configuration.
- */
- public void setErrorHandler(LoggerErrorHandler handler)
- {
- this.handler= handler;
- notifyLoggers();
- }
-
- /**
- * Request that a logger be notified of configuration changes.
- *
- * @param logger - The Logger interested in configuration change
- * notifications.
- */
- public synchronized void registerLogger(Logger logger)
- {
- loggers.add(logger);
- }
-
- /**
- * Request that a logger no longer be notifed of configuration changes.
- *
- * @param logger - The Logger no longer interested in configuration change
- * notifications.
- */
- public synchronized void deregisterLogger(Logger logger)
- {
- loggers.remove(logger);
- }
-
- /**
- * Notify all registered loggers that the configuration has changed.
- */
- protected synchronized void notifyLoggers()
- {
- for(Logger logger : loggers)
- {
- logger.updateConfiguration(this);
- }
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerErrorHandler.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerErrorHandler.java
deleted file mode 100644
index af36c76..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerErrorHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-/**
- * A LoggerErrorHandler is used for notification of exceptions which
- * occur during the publishing of a record.
- *
- * The advantage of using a handler is that we can handle exceptions
- * asynchronously (useful when dealing with an AsynchronousPublisher).
- */
-public interface LoggerErrorHandler
-{
- /**
- * Handle an exception which occurred during the publishing
- * of a log record.
- * @param record - the record which was being published.
- * @param ex - the exception which occurred.
- */
- public void handleError(LogRecord record, Throwable ex);
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerThread.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerThread.java
deleted file mode 100644
index 45f1d1e..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/LoggerThread.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.opends.server.api.DirectoryThread;
-import org.opends.server.api.ServerShutdownListener;
-import org.opends.server.core.DirectoryServer;
-
-import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import org.opends.server.types.DebugLogLevel;
-
-/**
- * This class defines a thread that will be used for performing asynchronous
- * operations on the log files.
- */
-public class LoggerThread extends DirectoryThread
- implements ServerShutdownListener
-{
-
- private CopyOnWriteArrayList<RotationPolicy> rotationPolicies;
- private CopyOnWriteArrayList<RetentionPolicy> retentionPolicies;
- private LoggerAlarmHandler handler;
- private int time;
- private boolean stopRequested;
- private Thread loggerThread;
-
- /**
- * Create the logger thread along with the specified sleep time,
- * the handler for the alarm that this thread generates and the
- * rotation policy.
- *
- * @param name The name to use for this logger thread.
- * @param time The length of time in milliseconds to sleep between
- * checks to see if any action is needed.
- * @param handler The alarm handler to use if a problem occurs.
- * @param policies The set of rotation policies to be enforced.
- * @param rp The set of retention policies to be enforced.
- */
- public LoggerThread(String name, int time, LoggerAlarmHandler handler,
- CopyOnWriteArrayList<RotationPolicy> policies,
- CopyOnWriteArrayList<RetentionPolicy> rp)
- {
- super(name);
-
- this.time = time;
- this.handler = handler;
- this.rotationPolicies = policies;
- this.retentionPolicies = rp;
-
- loggerThread = null;
- stopRequested = false;
-
- DirectoryServer.registerShutdownListener(this);
- }
-
- /**
- * The run method of the thread. It wakes up periodically and
- * checks whether the file needs to be rotated based on the
- * rotation policy.
- */
- public void run()
- {
- this.loggerThread = Thread.currentThread();
-
- while (!stopRequested)
- {
- try
- {
- sleep(time);
- }
- catch (InterruptedException e)
- {
- // We expect this to happen.
- }
- catch (Exception e)
- {
- if (debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
- }
-
- handler.flush();
-
- if (rotationPolicies != null)
- {
- for (RotationPolicy rotationPolicy : rotationPolicies)
- {
- if (rotationPolicy.rotateFile())
- {
- handler.rollover();
- }
- }
- }
-
- if (retentionPolicies != null)
- {
- for (RetentionPolicy retentionPolicy : retentionPolicies)
- {
- int numFilesDeleted = retentionPolicy.deleteFiles();
- System.out.println(numFilesDeleted + " files deleted");
- }
- }
- }
- }
-
-
-
- /**
- * Retrieves the human-readable name for this shutdown listener.
- *
- * @return The human-readable name for this shutdown listener.
- */
- public String getShutdownListenerName()
- {
- return "Logger Thread " + getName();
- }
-
-
-
- /**
- * Indicates that the Directory Server has received a request to stop running
- * and that this shutdown listener should take any action necessary to prepare
- * for it.
- *
- * @param reason The human-readable reason for the shutdown.
- */
- public void processServerShutdown(String reason)
- {
- stopRequested = true;
-
- try
- {
- if (loggerThread != null)
- {
- loggerThread.interrupt();
- }
- }
- catch (Exception e)
- {
- if (debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
- }
- }
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/MultifileTextWriter.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/MultifileTextWriter.java
index c84025a..5ee2004 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/MultifileTextWriter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/MultifileTextWriter.java
@@ -29,21 +29,20 @@
import org.opends.server.api.DirectoryThread;
import org.opends.server.api.ServerShutdownListener;
import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.DebugLogLevel;
-import org.opends.server.config.ConfigAttribute;
-import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InvokableMethod;
-import org.opends.server.types.ResultCode;
+import org.opends.server.types.*;
+import org.opends.server.types.FilePermission;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.debugVerbose;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
-import static org.opends.server.messages.ConfigMessages.*;
-import static org.opends.server.messages.MessageHandler.getMessage;
+import org.opends.server.admin.std.server.SizeLimitLogRotationPolicyCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.util.TimeThread;
import java.io.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.ArrayList;
+import java.util.List;
/**
* A MultiFileTextWriter is a specialized TextWriter which supports publishing
@@ -54,15 +53,20 @@
* When a switch is required, the writer closes the current file and opens a
* new one named in accordance with a specified FileNamingPolicy.
*/
-public class MultifileTextWriter extends TextWriter
- implements ServerShutdownListener
+public class MultifileTextWriter
+ implements ServerShutdownListener, TextWriter,
+ ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg>
{
private static final String UTF8_ENCODING= "UTF-8";
- private static final int BUFFER_SIZE= 65536;
- private CopyOnWriteArrayList<RotationPolicy> rotationPolicies;
- private CopyOnWriteArrayList<RetentionPolicy> retentionPolicies;
+ private CopyOnWriteArrayList<RotationPolicy> rotationPolicies =
+ new CopyOnWriteArrayList<RotationPolicy>();
+ private CopyOnWriteArrayList<RetentionPolicy> retentionPolicies =
+ new CopyOnWriteArrayList<RetentionPolicy>();
+
private FileNamingPolicy namingPolicy;
+ private FilePermission filePermissions;
+ private LogPublisherErrorHandler errorHandler;
//TODO: Implement actions.
private ArrayList<ActionType> actions;
@@ -71,82 +75,22 @@
private int bufferSize;
private boolean autoFlush;
private boolean append;
- private int interval;
+ private long interval;
private boolean stopRequested;
+ private long sizeLimit = 0;
private Thread rotaterThread;
- /**
- * Get the writer for the initial log file and initialize the
- * rotation policy.
- * @param naming - the file naming policy in use
- * @param encoding - the encoding to use when writing log records.
- * @param autoFlush - indicates whether the file should be flushed
- * after every record written.
- * @param append - indicates whether to append to the existing file or to
- * overwrite it.
- * @param bufferSize - the buffer size to use for the writer.
- * @return a PrintWriter for the initial log file
- * @throws IOException if the initial log file could not be opened
- */
- private static PrintWriter getInitialWriter(FileNamingPolicy naming,
- String encoding,
- boolean autoFlush,
- boolean append,
- int bufferSize)
- throws IOException
- {
- File file = naming.getInitialName();
- return constructWriter(file, encoding, autoFlush, append, bufferSize);
- }
+ private long lastRotationTime = TimeThread.getTime();
+ private long lastCleanTime = TimeThread.getTime();
+ private long lastCleanCount = 0;
+ private long totalFilesRotated = 0;
+ private long totalFilesCleaned = 0;
- /**
- * Construct a PrintWriter for a file.
- * @param file - the file to open for writing
- * @param encoding - the encoding to use when writing log records.
- * @param autoFlush - indicates whether the file should be flushed
- * after every record written.
- * @param append - indicates whether the file should be appended to or
- * truncated.
- * @param bufferSize - the buffer size to use for the writer.
- * @return a PrintWriter for the specified file.
- * @throws IOException if the PrintWriter could not be constructed
- * or if the file already exists and it was indicated this should be
- * an error.
- */
- private static PrintWriter constructWriter(File file, String encoding,
- boolean autoFlush, boolean append,
- int bufferSize)
- throws IOException
- {
- FileOutputStream fos= new FileOutputStream(file, append);
- OutputStreamWriter osw= new OutputStreamWriter(fos, encoding);
- BufferedWriter bw = null;
- if(bufferSize <= 0)
- {
- bw= new BufferedWriter(osw);
- }
- else
- {
- bw= new BufferedWriter(osw, bufferSize);
- }
- return new PrintWriter(bw, autoFlush);
- }
-
- /**
- * Creates a new instance of MultiFileTextWriter with the supplied policies.
- *
- * @param name the name of the log rotation thread.
- * @param namingPolicy the file naming policy to use to name rotated log
- * files.
- * @throws IOException if an error occurs while creating the log file.
- */
- public MultifileTextWriter(String name, FileNamingPolicy namingPolicy)
- throws IOException
- {
- this(name, 5000, namingPolicy, UTF8_ENCODING,
- true, true, BUFFER_SIZE, null, null);
- }
+ /** The underlying output stream. */
+ private MeteredStream outputStream;
+ /** The underlaying buffered writer using the output steram. */
+ private BufferedWriter writer;
/**
* Creates a new instance of MultiFileTextWriter with the supplied policies.
@@ -155,54 +99,264 @@
* @param interval the interval to check whether the logs need to be rotated.
* @param namingPolicy the file naming policy to use to name rotated log.
* files.
+ * @param filePermissions the file permissions to set on the log files.
+ * @param errorHandler the log publisher error handler to notify when
+ * an error occurs.
* @param encoding the encoding to use to write the log files.
* @param autoFlush whether to flush the writer on every println.
* @param append whether to append to an existing log file.
* @param bufferSize the bufferSize to use for the writer.
- * @param rotationPolicies the rotation policy to use for log rotation.
- * @param retentionPolicies the retention policy to use for log rotation.
* @throws IOException if an error occurs while creating the log file.
+ * @throws DirectoryException if an error occurs while preping the new log
+ * file.
*/
- public MultifileTextWriter(String name, int interval,
- FileNamingPolicy namingPolicy, String encoding,
- boolean autoFlush, boolean append, int bufferSize,
- CopyOnWriteArrayList<RotationPolicy> rotationPolicies,
- CopyOnWriteArrayList<RetentionPolicy> retentionPolicies)
- throws IOException
+ public MultifileTextWriter(String name, long interval,
+ FileNamingPolicy namingPolicy,
+ FilePermission filePermissions,
+ LogPublisherErrorHandler errorHandler,
+ String encoding,
+ boolean autoFlush,
+ boolean append,
+ int bufferSize)
+ throws IOException, DirectoryException
{
- super(getInitialWriter(namingPolicy, encoding,
- autoFlush, append, bufferSize), true);
+ File file = namingPolicy.getInitialName();
+ constructWriter(file, filePermissions, encoding, append,
+ bufferSize);
+
this.name = name;
this.interval = interval;
this.namingPolicy = namingPolicy;
- this.rotationPolicies = rotationPolicies;
- this.retentionPolicies = retentionPolicies;
+ this.filePermissions = filePermissions;
+ this.errorHandler = errorHandler;
- this.encoding = encoding;
+ this.encoding = UTF8_ENCODING;
this.autoFlush = autoFlush;
this.append = append;
this.bufferSize = bufferSize;
this.stopRequested = false;
- // We will lazily launch the rotaterThread
- // to ensure initialization safety.
+ rotaterThread = new RotaterThread(this);
+ rotaterThread.start();
DirectoryServer.registerShutdownListener(this);
}
/**
+ * Construct a PrintWriter for a file.
+ * @param file - the file to open for writing
+ * @param filePermissions - the file permissions to set on the file.
+ * @param encoding - the encoding to use when writing log records.
+ * @param append - indicates whether the file should be appended to or
+ * truncated.
+ * @param bufferSize - the buffer size to use for the writer.
+ * @throws IOException if the PrintWriter could not be constructed
+ * or if the file already exists and it was indicated this should be
+ * an error.
+ * @throws DirectoryException if there was a problem setting permissions on
+ * the file.
+ */
+ private void constructWriter(File file, FilePermission filePermissions,
+ String encoding, boolean append,
+ int bufferSize)
+ throws IOException, DirectoryException
+ {
+ // Create new file if it doesn't exist
+ if(!file.exists())
+ {
+ file.createNewFile();
+ }
+
+ FileOutputStream stream = new FileOutputStream(file, append);
+ outputStream = new MeteredStream(stream, 0);
+
+ OutputStreamWriter osw = new OutputStreamWriter(outputStream, encoding);
+ BufferedWriter bw = null;
+ if(bufferSize <= 0)
+ {
+ writer = new BufferedWriter(osw);
+ }
+ else
+ {
+ writer = new BufferedWriter(osw, bufferSize);
+ }
+
+ if(FilePermission.canSetPermissions())
+ {
+ FilePermission.setPermissions(file, filePermissions);
+ }
+ }
+
+
+ /**
+ * Add a rotation policy to enforce on the files written by this writer.
+ *
+ * @param policy The rotation policy to add.
+ */
+ public void addRotationPolicy(RotationPolicy policy)
+ {
+ this.rotationPolicies.add(policy);
+
+ if(policy instanceof SizeBasedRotationPolicy)
+ {
+ SizeBasedRotationPolicy sizePolicy = ((SizeBasedRotationPolicy)policy);
+ if(sizeLimit == 0 ||
+ sizeLimit > sizePolicy.currentConfig.getFileSizeLimit())
+ {
+ sizeLimit = sizePolicy.currentConfig.getFileSizeLimit();
+ }
+ // Add this as a change listener so we can update the size limit.
+ sizePolicy.currentConfig.addSizeLimitChangeListener(this);
+ }
+ }
+
+ /**
+ * Add a retention policy to enforce on the files written by this writer.
+ *
+ * @param policy The retention policy to add.
+ */
+ public void addRetentionPolicy(RetentionPolicy policy)
+ {
+ this.retentionPolicies.add(policy);
+ }
+
+ /**
+ * Removes all the rotation policies currently enforced by this writer.
+ */
+ public void removeAllRotationPolicies()
+ {
+ for(RotationPolicy policy : rotationPolicies)
+ {
+ if(policy instanceof SizeBasedRotationPolicy)
+ {
+ sizeLimit = 0;
+
+ // Remove this as a change listener.
+ SizeBasedRotationPolicy sizePolicy = ((SizeBasedRotationPolicy)policy);
+ sizePolicy.currentConfig.removeSizeLimitChangeListener(this);
+ }
+ }
+ }
+
+ /**
+ * Removes all retention policies being enforced by this writer.
+ */
+ public void removeAllRetentionPolicies()
+ {
+ this.retentionPolicies.clear();
+ }
+
+ /**
+ * Set the auto flush setting for this writer.
+ *
+ * @param autoFlush If the writer should flush the buffer after every line.
+ */
+ public void setAutoFlush(boolean autoFlush)
+ {
+ this.autoFlush = autoFlush;
+ }
+
+ /**
+ * Set the append setting for this writter.
+ *
+ * @param append If the writer should append to an existing file.
+ */
+ public void setAppend(boolean append)
+ {
+ this.append = append;
+ }
+
+ /**
+ * Set the buffer size for this writter.
+ *
+ * @param bufferSize The size of the underlying output stream buffer.
+ */
+ public void setBufferSize(int bufferSize)
+ {
+ this.bufferSize = bufferSize;
+ }
+
+ /**
+ * Set the file permission to set for newly created log files.
+ *
+ * @param filePermissions The file permission to set for new log files.
+ */
+ public void setFilePermissions(FilePermission filePermissions)
+ {
+ this.filePermissions = filePermissions;
+ }
+
+ /**
+ * Retrieves the current naming policy used to generate log file names.
+ *
+ * @return The current naming policy in use.
+ */
+ public FileNamingPolicy getNamingPolicy()
+ {
+ return namingPolicy;
+ }
+
+ /**
+ * Set the naming policy to use when generating new log files.
+ *
+ * @param namingPolicy the naming policy to use to name log files.
+ */
+ public void setNamingPolicy(FileNamingPolicy namingPolicy)
+ {
+ this.namingPolicy = namingPolicy;
+ }
+
+ /**
+ * Set the internval in which the rotator thread checks to see if the log
+ * file should be rotated.
+ *
+ * @param interval The interval to check if the log file needs to be rotated.
+ */
+ public void setInterval(long interval)
+ {
+ this.interval = interval;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ SizeLimitLogRotationPolicyCfg config, List<String> unacceptableReasons)
+ {
+ // This should always be ok
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ SizeLimitLogRotationPolicyCfg config)
+ {
+ if(sizeLimit == 0 || sizeLimit > config.getFileSizeLimit())
+ {
+ sizeLimit = config.getFileSizeLimit();
+ }
+
+ return new ConfigChangeResult(ResultCode.SUCCESS, false,
+ new ArrayList<String>());
+ }
+
+ /**
* A rotater thread is responsible for checking if the log files need to be
* rotated based on the policies. It will do so if necessary.
*/
private class RotaterThread extends DirectoryThread
{
+ MultifileTextWriter writer;
/**
* Create a new rotater thread.
*/
- public RotaterThread()
+ public RotaterThread(MultifileTextWriter writer)
{
super(name);
+ this.writer = writer;
}
/**
@@ -229,37 +383,28 @@
}
}
- if(rotationPolicies != null)
+ for(RotationPolicy rotationPolicy : rotationPolicies)
{
- for(RotationPolicy rotationPolicy : rotationPolicies)
+ if(rotationPolicy.rotateFile(writer))
{
- if(rotationPolicy.rotateFile())
- {
- try
- {
- rotate();
- }
- catch (IOException ioe)
- {
- //TODO: Comment this after AOP logging is complete.
- //int msgID = MSGID_CONFIG_LOGGER_ROTATE_FAILED;
- //Error.logError(ErrorLogCategory.CORE_SERVER,
- // ErrorLogSeverity.SEVERE_ERROR, msgID, ioe);
- }
- }
+ rotate();
}
}
- if(retentionPolicies != null)
+ for(RetentionPolicy retentionPolicy : retentionPolicies)
{
- for(RetentionPolicy retentionPolicy : retentionPolicies)
+ int numFilesDeleted =
+ retentionPolicy.deleteFiles(writer);
+ if(numFilesDeleted > 0)
{
- int numFilesDeleted = retentionPolicy.deleteFiles();
- if (debugEnabled())
- {
- debugVerbose("%d files deleted by rentention policy",
- numFilesDeleted);
- }
+ lastCleanTime = TimeThread.getTime();
+ lastCleanCount = numFilesDeleted;
+ totalFilesCleaned++;
+ }
+ if (debugEnabled())
+ {
+ debugVerbose("%d files deleted by rentention policy",
+ numFilesDeleted);
}
}
}
@@ -285,11 +430,13 @@
*/
public void processServerShutdown(String reason)
{
- startShutDown();
+ stopRequested = true;
// Wait for rotater to terminate
while (rotaterThread != null && rotaterThread.isAlive()) {
try {
+ // Interrupt if its sleeping
+ rotaterThread.interrupt();
rotaterThread.join();
}
catch (InterruptedException ex) {
@@ -297,9 +444,14 @@
}
}
- writer.flush();
- writer.close();
- writer = null;
+ DirectoryServer.deregisterShutdownListener(this);
+
+ removeAllRotationPolicies();
+ removeAllRetentionPolicies();
+
+ // Don't close the writer as there might still be message to be
+ // written. manually shutdown just before the server process
+ // exists.
}
/**
@@ -307,27 +459,27 @@
*
* @return if the publish is in shutdown mode.
*/
- private synchronized boolean isShuttingDown()
+ private boolean isShuttingDown()
{
return stopRequested;
}
/**
- * Tell the writer to start shutting down.
- */
- private synchronized void startShutDown()
- {
- stopRequested = true;
- }
-
- /**
* Shutdown the text writer.
*/
public void shutdown()
{
processServerShutdown(null);
- DirectoryServer.deregisterShutdownListener(this);
+ try
+ {
+ writer.flush();
+ writer.close();
+ }
+ catch(Exception e)
+ {
+ errorHandler.handleCloseError(e);
+ }
}
@@ -336,93 +488,84 @@
*
* @param record the log record to write.
*/
- public synchronized void writeRecord(String record)
+ public void writeRecord(String record)
{
- // Launch writer rotaterThread if not running
- if (rotaterThread == null) {
- rotaterThread = new RotaterThread();
- rotaterThread.start();
+ synchronized(this)
+ {
+ try
+ {
+ writer.write(record);
+ writer.newLine();
+ }
+ catch(Exception e)
+ {
+ errorHandler.handleWriteError(record, e);
+ }
+
+ if(autoFlush)
+ {
+ flush();
+ }
}
- writer.println(record);
+ if(sizeLimit > 0 && outputStream.written >= sizeLimit)
+ {
+ rotate();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void flush()
+ {
+ try
+ {
+ writer.flush();
+ }
+ catch(Exception e)
+ {
+ errorHandler.handleFlushError(e);
+ }
}
/**
* Tries to rotate the log files. If the new log file alreadly exists, it
* tries to rename the file. On failure, all subsequent log write requests
* will throw exceptions.
- *
- * @throws IOException if an error occurs while rotation the log files.
*/
- public void rotate() throws IOException
+ public synchronized void rotate()
{
- writer.flush();
- writer.close();
- writer = null;
+ try
+ {
+ writer.flush();
+ writer.close();
+ }
+ catch(Exception e)
+ {
+ errorHandler.handleCloseError(e);
+ }
File currentFile = namingPolicy.getInitialName();
File newFile = namingPolicy.getNextName();
currentFile.renameTo(newFile);
- writer = constructWriter(currentFile, encoding,
- autoFlush, append, bufferSize);
+ try
+ {
+ constructWriter(currentFile, filePermissions, encoding, append,
+ bufferSize);
+ }
+ catch (Exception e)
+ {
+ errorHandler.handleOpenError(currentFile, e);
+ }
//RotationActionThread rotThread =
// new RotationActionThread(newFile, actions, configEntry);
//rotThread.start();
- }
- /**
- * Invokes the specified method with the provided arguments.
- *
- * @param methodName The name of the method to invoke.
- * @param arguments The set of configuration attributes holding the
- * arguments to use for the method.
- *
- * @return The return value for the method, or <CODE>null</CODE> if it did
- * not return a value.
- *
- * @throws org.opends.server.types.DirectoryException
- * If there was no such method, or if an error occurred while attempting
- * to invoke it.
- */
- public Object invokeMethod(String methodName, ConfigAttribute[] arguments)
- throws DirectoryException
- {
- if(!methodName.equals("rotateNow"))
- {
- int msgID = MSGID_CONFIG_JMX_NO_METHOD;
- throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
- getMessage(msgID), msgID);
- }
-
- try
- {
- rotate();
- }
- catch(Exception e)
- {
- //TODO: Comment when AOP logging framework is complete.
- //int msgID = MSGID_CONFIG_LOGGER_ROTATE_FAILED;
- //throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
- // getMessage(msgID, e), msgID);
- }
-
- return null;
- }
-
- /**
- * Retrieves a list of the methods that may be invoked for this component.
- *
- * @return A list of the methods that may be invoked for this component.
- */
- public InvokableMethod[] getOperationSignatures()
- {
- InvokableMethod[] methods = new InvokableMethod[1];
- methods[0] = new InvokableMethod("rotateNow",
- "Rotate the log file immediately",
- null, "void", true, true);
- return methods;
+ totalFilesRotated++;
+ lastRotationTime = TimeThread.getTime();
}
/**
@@ -434,4 +577,70 @@
{
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.
+ */
+ public long getBytesWritten()
+ {
+ return outputStream.written;
+ }
+
+ /**
+ * Retrieves the last time one or more log files are cleaned in this instance
+ * of the Directory Server. If log files have never been cleaned, this value
+ * will be the time the server started.
+ *
+ * @return The last time log files are cleaned.
+ */
+ public long getLastCleanTime()
+ {
+ return lastCleanTime;
+ }
+
+ /**
+ * Retrieves the number of files cleaned in the last cleanup run.
+ *
+ * @return The number of files cleaned int he last cleanup run.
+ */
+ public long getLastCleanCount()
+ {
+ return lastCleanCount;
+ }
+
+ /**
+ * Retrieves the last time a log file was rotated in this instance of
+ * Directory Server. If a log rotation never
+ * occured, this value will be the time the server started.
+ *
+ * @return The last time log rotation occured.
+ */
+ public long getLastRotationTime()
+ {
+ return lastRotationTime;
+ }
+
+ /**
+ * Retrieves the total number file rotations occured in this instance of the
+ * Directory Server.
+ *
+ * @return The total number of file rotations.
+ */
+ public long getTotalFilesRotated()
+ {
+ return totalFilesRotated;
+ }
+
+ /**
+ * Retrieves teh total number of files cleaned in this instance of the
+ * Directory Server.
+ *
+ * @return The total number of files cleaned.
+ */
+ public long getTotalFilesCleaned()
+ {
+ return totalFilesCleaned;
+ }
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/RetentionPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/RetentionPolicy.java
index 47121d9..c486899 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/RetentionPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/RetentionPolicy.java
@@ -26,21 +26,48 @@
*/
package org.opends.server.loggers;
+import org.opends.server.admin.std.server.LogRetentionPolicyCfg;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
/**
* This interface describes the retention policy that should be used
* for the logger. Supported policies include number of files and
* disk utilization (for Java 6).
+ *
+ * @param <T> The type of retention policy configuration handled by
+ * this retention policy implementation.
*/
-public interface RetentionPolicy
+public interface RetentionPolicy<T extends LogRetentionPolicyCfg>
{
/**
+ * Initializes this log retention policy based on the
+ * information in the provided retention policy configuration.
+ *
+ * @param config
+ * The retention policy configuration that contains the
+ * information to use to initialize this policy.
+ * @throws ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public abstract void initializeLogRetentionPolicy(T config)
+ throws ConfigException, InitializationException;
+
+ /**
* This method checks for whether files should be deleted or not.
*
- * @return number of files deleted.
+ * @param writer The multi file writer writing the files to be
+ * checked.
+ *
+ * @return number of files deleted, if any.
*/
- public int deleteFiles();
+ public int deleteFiles(MultifileTextWriter writer);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationActionThread.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationActionThread.java
index f89b246..45b5430 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationActionThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationActionThread.java
@@ -88,16 +88,16 @@
action = new ZIPAction(filename, zipFile, true);
break;
case SIGN:
- String alias = RotationConfigUtil.getCertificateAlias(configEntry);
- action = new SignatureAction(filename, alias);
+ //String alias = RotationConfigUtil.getCertificateAlias(configEntry);
+ //action = new SignatureAction(filename, alias);
break;
case ENCRYPT:
String encFile = filename + ".enc";
- String certAlias =
- RotationConfigUtil.getCertificateAlias(configEntry);
+ //String certAlias =
+ // RotationConfigUtil.getCertificateAlias(configEntry);
// FIXME - make the encryption algorithm configurable.
- action = new EncryptAction(filename, encFile, false, certAlias,
- "RSA");
+ //action = new EncryptAction(filename, encFile, false, certAlias,
+ // "RSA");
break;
default:
System.err.println("Invalid post rollover action:" + at);
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationConfigUtil.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationConfigUtil.java
deleted file mode 100644
index 356dd89..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationConfigUtil.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.lang.reflect.Method;
-
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.config.ConfigException;
-import org.opends.server.config.IntegerConfigAttribute;
-import org.opends.server.config.MultiChoiceConfigAttribute;
-import org.opends.server.config.StringConfigAttribute;
-import org.opends.server.types.ErrorLogCategory;
-import org.opends.server.types.ErrorLogSeverity;
-import org.opends.server.types.DebugLogLevel;
-
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.messages.ConfigMessages.*;
-import static org.opends.server.messages.LoggerMessages.*;
-import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-
-
-/**
- * This utility class provides methods to retrieve logger
- * rotation policy related configuration information.
- */
-public class RotationConfigUtil
-{
-
-
- /**
- * Create rotation policies based on the logger configuration
- * information.
- *
- * @param configEntry The configuration entry for the logger.
- *
- * @return The set of rotation policies defined in the provided configuration
- * entry.
- *
- * @throws ConfigException If there is an invalid config entry.
- */
-
- public static CopyOnWriteArrayList<RotationPolicy>
- getRotationPolicies(ConfigEntry configEntry)
- throws ConfigException
- {
- HashSet<String> allowedValues = new HashSet<String>();
- allowedValues.add("size");
- allowedValues.add("timeofday");
- allowedValues.add("fixedtime");
-
- MultiChoiceConfigAttribute rotationPolicyStub =
- new MultiChoiceConfigAttribute(ATTR_LOGGER_ROTATION_POLICY,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- false, true, true, allowedValues);
-
- MultiChoiceConfigAttribute rotationPolicyAttr = (MultiChoiceConfigAttribute)
- configEntry.getConfigAttribute(rotationPolicyStub);
-
- if(rotationPolicyAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_ROTATION_POLICY;
- String message = getMessage(msgID, configEntry.getDN().toString());
- logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.SEVERE_WARNING,
- message, msgID);
- return null;
- }
-
- int msgID = 0;
- RotationPolicy rotationPolicy = null;
-
- CopyOnWriteArrayList<RotationPolicy> policies =
- new CopyOnWriteArrayList<RotationPolicy> ();
- List<String> strPolicies = rotationPolicyAttr.activeValues();
-
- for (String policy : strPolicies)
- {
- policy = policy.trim();
- if(policy.equalsIgnoreCase("Size"))
- {
- int sizeLimit = getIntegerAttribute(configEntry,
- ATTR_LOGGER_ROTATION_SIZE_LIMIT,
- MSGID_LOGGER_ROTATION_SIZE_LIMIT);
- if(sizeLimit == -1)
- {
- msgID = MSGID_CONFIG_LOGGER_NO_SIZE_LIMIT;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
- rotationPolicy = new SizeBasedRotationPolicy(sizeLimit);
- } else if(policy.equalsIgnoreCase("FixedTime"))
- {
- int fixedTimeLimit = getIntegerAttribute(configEntry,
- ATTR_LOGGER_ROTATION_FIXED_TIME_LIMIT,
- MSGID_LOGGER_ROTATION_FIXED_TIME_LIMIT);
- if(fixedTimeLimit == -1)
- {
- msgID = MSGID_CONFIG_LOGGER_NO_TIME_LIMIT;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
-
- rotationPolicy = new TimeLimitRotationPolicy(fixedTimeLimit);
-
- } else if(policy.equalsIgnoreCase("TimeOfDay"))
- {
- StringConfigAttribute timeLimitStub =
- new StringConfigAttribute(ATTR_LOGGER_ROTATION_TIME_OF_DAY,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
-
- StringConfigAttribute timeLimitAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(timeLimitStub);
-
- if(timeLimitAttr == null)
- {
- msgID = MSGID_CONFIG_LOGGER_NO_TIME_LIMIT;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
-
- String timeLimitStr = timeLimitAttr.activeValue().trim();
- StringTokenizer tokenizer = new StringTokenizer(timeLimitStr, ",");
- ArrayList<String> tokens = new ArrayList<String> ();
- while(tokenizer.hasMoreTokens())
- {
- String token = tokenizer.nextToken().trim();
- tokens.add(token);
- }
- int[] timeOfDays = new int[tokens.size()];
- for(int i = 0; i < timeOfDays.length; i++)
- {
- String str = tokens.get(i);
- try
- {
- timeOfDays[i] = Integer.parseInt(str);
- } catch(Exception e)
- {
- String msg = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, msg);
- }
- }
-
- rotationPolicy = new FixedTimeRotationPolicy(timeOfDays);
- } else
- {
- // Invalid policy - throw exception
- msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
- String message = getMessage(msgID, policy,
- configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
-
- policies.add(rotationPolicy);
- }
-
- return policies;
- }
-
- /**
- * Create retention policies based on the logger configuration
- * information.
- *
- * @param configEntry The configuration entry for the logger.
- *
- * @return The set of retention policies contained in the provided
- * configuration entry.
- *
- * @throws ConfigException If there is an invalid config entry.
- */
-
- public static CopyOnWriteArrayList<RetentionPolicy>
- getRetentionPolicies(ConfigEntry configEntry)
- throws ConfigException
- {
- StringConfigAttribute logFileStub =
- new StringConfigAttribute(ATTR_LOGGER_FILE,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- StringConfigAttribute logFileNameAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(logFileStub);
-
- if(logFileNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_FILE_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
- File logFile = new File(logFileNameAttr.activeValue().trim());
- if(!logFile.isAbsolute())
- {
- logFile = new File (DirectoryServer.getServerRoot() + File.separator +
- logFileNameAttr.activeValue().trim());
- }
- String prefix = logFile.getName();
- String directory = logFile.getParent();
-
- HashSet<String> allowedValues = new HashSet<String>();
- allowedValues.add("numberoffiles");
- allowedValues.add("diskspaceused");
- allowedValues.add("freediskspace");
-
- MultiChoiceConfigAttribute retentionPolicyStub =
- new MultiChoiceConfigAttribute(ATTR_LOGGER_RETENTION_POLICY,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- false, true, true, allowedValues);
-
- MultiChoiceConfigAttribute retentionPolicyAttr =
- (MultiChoiceConfigAttribute)
- configEntry.getConfigAttribute(retentionPolicyStub);
-
- if(retentionPolicyAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_RETENTION_POLICY;
- String message = getMessage(msgID, configEntry.getDN().toString());
- logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.MILD_WARNING,
- message, msgID);
- return null;
- }
-
- int msgID = 0;
- RetentionPolicy retentionPolicy = null;
-
- CopyOnWriteArrayList<RetentionPolicy> policies =
- new CopyOnWriteArrayList<RetentionPolicy> ();
- List<String> strPolicies = retentionPolicyAttr.activeValues();
-
- for (String policy : strPolicies)
- {
- policy = policy.trim();
- if(policy.equalsIgnoreCase("numberOfFiles"))
- {
- int numFiles = getIntegerAttribute(configEntry,
- ATTR_LOGGER_RETENTION_NUMBER_OF_FILES,
- MSGID_LOGGER_RETENTION_NUMBER_OF_FILES);
- if(numFiles == -1)
- {
- msgID = MSGID_CONFIG_LOGGER_NO_NUMBER_OF_FILES;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
- retentionPolicy = new FileNumberRetentionPolicy(directory, prefix,
- numFiles);
- } else if(policy.equalsIgnoreCase("diskSpaceUsed"))
- {
- int size = getIntegerAttribute(configEntry,
- ATTR_LOGGER_RETENTION_DISK_SPACE_USED,
- MSGID_LOGGER_RETENTION_DISK_SPACE_USED);
- if(size == -1)
- {
- msgID = MSGID_CONFIG_LOGGER_NO_DISK_SPACE_USED;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
- retentionPolicy = new SizeBasedRetentionPolicy(directory, prefix, size);
- } else if(policy.equalsIgnoreCase("freeDiskSpace"))
- {
- int size = getIntegerAttribute(configEntry,
- ATTR_LOGGER_RETENTION_FREE_DISK_SPACE,
- MSGID_LOGGER_RETENTION_FREE_DISK_SPACE);
- if(size == -1)
- {
- msgID = MSGID_CONFIG_LOGGER_NO_FREE_DISK_SPACE;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
- // Check if we are running on Java 6. If not report error.
- try
- {
- Method meth = java.io.File.class.getMethod("getFreeSpace",
- new Class[0]);
- } catch(Exception e)
- {
- msgID = MSGID_CONFIG_LOGGER_INVALID_JAVA5_POLICY;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
- retentionPolicy =
- new FreeDiskSpaceRetentionPolicy(directory, prefix, size);
- } else
- {
- // Invalid policy - throw exception
- msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
- String message = getMessage(msgID, policy,
- configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
-
- policies.add(retentionPolicy);
- }
-
- return policies;
- }
-
- /**
- * Return post rotation actions based on the logger configuration
- * information. The action types are values separated by ",".
- *
- * @param configEntry The configuration entry for the logger.
- *
- * @return The set of rotation actions contained in the provided
- * configuration entry.
- *
- * @exception ConfigException If there is an invalid config entry.
- */
-
- public static ArrayList<ActionType>
- getPostRotationActions(ConfigEntry configEntry)
- throws ConfigException
- {
- ArrayList<ActionType> actions = new ArrayList<ActionType>();
-
- StringConfigAttribute rotationActionStub =
- new StringConfigAttribute(ATTR_LOGGER_ROTATION_ACTION,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
-
- StringConfigAttribute rotationActionAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(rotationActionStub);
-
- if(rotationActionAttr == null)
- {
- return actions;
- }
-
- String actionStr = rotationActionAttr.activeValue().trim();
- StringTokenizer s = new StringTokenizer(actionStr, ",");
- while(s.hasMoreTokens())
- {
- String aToken = s.nextToken().trim();
- if(aToken.equalsIgnoreCase("GZIPCompress"))
- {
- actions.add(ActionType.GZIP_COMPRESS);
- // PostRotationAction action = new GZIPAction();
- } else if(aToken.equals("ZIPCompress"))
- {
- actions.add(ActionType.ZIP_COMPRESS);
- } else if(aToken.equals("Sign"))
- {
- actions.add(ActionType.SIGN);
- } else if(aToken.equals("Encrypt"))
- {
- actions.add(ActionType.ENCRYPT);
- } else
- {
- int msgID = 0;
- throw new ConfigException(msgID, getMessage(msgID));
- }
- }
-
- return actions;
- }
-
- /**
- * Create the SSL certificate alias from the configuration.
- *
- * @param configEntry The configuration entry containing the certificate
- * configuration alias.
- *
- * @return The requested configuration alias, or <CODE>null</CODE> if none is
- * configured.
- */
- public static String getCertificateAlias(ConfigEntry configEntry)
- {
- String sslServerCertNickname = null;
- int msgID = MSGID_LOG_DESCRIPTION_SSL_CERT_NICKNAME;
- StringConfigAttribute certNameStub =
- new StringConfigAttribute(ATTR_SSL_CERT_NICKNAME, getMessage(msgID),
- false, false, true);
- try
- {
- StringConfigAttribute certNameAttr =
- (StringConfigAttribute)
- configEntry.getConfigAttribute(certNameStub);
- if (certNameAttr == null)
- {
- sslServerCertNickname = DEFAULT_SSL_CERT_NICKNAME;
- }
- else
- {
- sslServerCertNickname = certNameAttr.activeValue();
- }
- }
- catch (Exception e)
- {
- if (debugEnabled())
- {
- debugCaught(DebugLogLevel.ERROR, e);
- }
-
- return null;
- }
- return sslServerCertNickname;
-
- }
-
-
- /**
- * Convenience method for returning an attribute value that is an
- * integer from the config entry.
- *
- * @param configEntry The configuration entry for the logger.
- * @param attrName The name of the attribute.
- * @param msgID The message ID for the description of the configuration
- * attribute.
- *
- * @return The integer value of the requested configuration attribute.
- *
- * @throws ConfigException If there is an invalid config entry.
- */
- public static int getIntegerAttribute(ConfigEntry configEntry,
- String attrName, int msgID) throws ConfigException
- {
- int value = -1;
-
- IntegerConfigAttribute attrStub =
- new IntegerConfigAttribute(attrName, getMessage(msgID),
- true, false, false, true, 1, false, 0, 0);
- IntegerConfigAttribute attrVal =
- (IntegerConfigAttribute) configEntry.getConfigAttribute(attrStub);
- if (attrVal != null)
- {
- value = attrVal.activeIntValue();
- }
- return value;
- }
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationPolicy.java
index e374a39..9ed9593 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/RotationPolicy.java
@@ -26,22 +26,49 @@
*/
package org.opends.server.loggers;
+import org.opends.server.admin.std.server.LogRotationPolicyCfg;
+import org.opends.server.types.InitializationException;
+import org.opends.server.config.ConfigException;
/**
* This interface describes the rotation policy that should be used
* for the logger. Supported policies include size based and time
* based.
+ *
+ * @param <T> The type of rotation policy configuration handled by
+ * this retention policy implementation.
*/
-public interface RotationPolicy
+public interface RotationPolicy<T extends LogRotationPolicyCfg>
{
/**
+ * Initializes this log rotation policy based on the
+ * information in the provided rotation policy configuration.
+ *
+ * @param config
+ * The rotation policy configuration that contains the
+ * information to use to initialize this policy.
+ * @throws ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public abstract void initializeLogRotationPolicy(T config)
+ throws ConfigException, InitializationException;
+
+
+ /**
* This method indicates if the log file should be
* rotated or not.
*
+ * @param writer The multi file writer writing the file to be
+ * checked.
* @return true if the log file should be rotated, false otherwise.
*/
- public boolean rotateFile();
+ public boolean rotateFile(MultifileTextWriter writer);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRetentionPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRetentionPolicy.java
index 2b28e4e..a0cfb15 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRetentionPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRetentionPolicy.java
@@ -26,50 +26,86 @@
*/
package org.opends.server.loggers;
+import org.opends.server.admin.std.server.SizeLimitLogRetentionPolicyCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.ResultCode;
+
import java.io.File;
import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
/**
* This class implements a retention policy based on the amount of
* space taken by the log files.
*/
-public class SizeBasedRetentionPolicy implements RetentionPolicy
+public class SizeBasedRetentionPolicy implements
+ RetentionPolicy<SizeLimitLogRetentionPolicyCfg>,
+ ConfigurationChangeListener<SizeLimitLogRetentionPolicyCfg>
{
private long size = 0;
- private File directory = null;
- private String prefix = null;
/**
- * Create the retention policy based on the disk space used by the log files.
- *
- * @param dir The directory in which the log files reside.
- * @param prefix The prefix for the log file names.
- * @param size The total disk space used.
+ * {@inheritDoc}
*/
- public SizeBasedRetentionPolicy(String dir, String prefix, long size)
+ public void initializeLogRetentionPolicy(
+ SizeLimitLogRetentionPolicyCfg config)
{
- this.size = size;
- this.directory = new File(dir);
- this.prefix = prefix;
+ size = config.getDiskSpaceUsed();
+
+ config.addSizeLimitChangeListener(this);
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ SizeLimitLogRetentionPolicyCfg config,
+ List<String> unacceptableReasons)
+ {
+ // Changes should always be OK
+ return true;
+ }
/**
- * This method deletes files based on the policy.
- *
- * @return The number of files deleted.
+ * {@inheritDoc}
*/
- public int deleteFiles()
+ public ConfigChangeResult applyConfigurationChange(
+ SizeLimitLogRetentionPolicyCfg config)
{
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ size = config.getDiskSpaceUsed();
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int deleteFiles(MultifileTextWriter writer)
+ {
+ File[] files = writer.getNamingPolicy().listFiles();
int count = 0;
- File[] selectedFiles = directory.listFiles(new LogFileFilter(prefix));
long totalLength = 0;
- for (int i = 0; i < selectedFiles.length; i++)
+ for (File file : files)
{
- totalLength += selectedFiles[i].length();
+ totalLength += file.length();
}
+
+ if(debugEnabled())
+ {
+ debugInfo("Total size of files: %d, Max: %d", totalLength, size);
+ }
+
if (totalLength <= size)
{
return 0;
@@ -78,14 +114,17 @@
long freeSpaceNeeded = totalLength - size;
// Sort files based on last modified time.
- Arrays.sort(selectedFiles, new FileComparator());
+ Arrays.sort(files, new FileComparator());
long freedSpace = 0;
- for (int j = selectedFiles.length - 1; j < 1; j--)
+ for (int j = files.length - 1; j < 1; j--)
{
- freedSpace += selectedFiles[j].length();
- // System.out.println("Deleting log file:" + selectedFiles[j]);
- selectedFiles[j].delete();
+ freedSpace += files[j].length();
+ if(debugEnabled())
+ {
+ debugInfo("Deleting log file:", files[j]);
+ }
+ files[j].delete();
if (freedSpace >= freeSpaceNeeded)
{
break;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRotationPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRotationPolicy.java
index 3910ebb..ab88405 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRotationPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/SizeBasedRotationPolicy.java
@@ -29,60 +29,83 @@
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
+import org.opends.server.admin.std.server.SizeLimitLogRotationPolicyCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.types.InitializationException;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.ResultCode;
+import org.opends.server.config.ConfigException;
+
+import java.util.List;
+import java.util.ArrayList;
/**
* This class implements a rotation policy based on the size of the
* file.
*/
-public class SizeBasedRotationPolicy implements RotationPolicy
+public class SizeBasedRotationPolicy implements
+ RotationPolicy<SizeLimitLogRotationPolicyCfg>,
+ ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg>
{
private long sizeLimit;
- private DirectoryFileHandler fileHandler;
+
+ SizeLimitLogRotationPolicyCfg currentConfig;
/**
- * Create the size based policy.
- *
- * @param size The size of the file when rotation takes place.
+ * {@inheritDoc}
*/
- public SizeBasedRotationPolicy(long size)
+ public void initializeLogRotationPolicy(SizeLimitLogRotationPolicyCfg config)
+ throws ConfigException, InitializationException
{
- sizeLimit = size;
+ sizeLimit = config.getFileSizeLimit();
+
+ config.addSizeLimitChangeListener(this);
+ currentConfig = config;
}
/**
- * Set the file handler instance.
- *
- * @param handler The file handler which manages the file to be rotated.
+ * {@inheritDoc}
*/
- public void setFileHandler(DirectoryFileHandler handler)
+ public boolean isConfigurationChangeAcceptable(
+ SizeLimitLogRotationPolicyCfg config, List<String> unacceptableReasons)
{
- this.fileHandler = handler;
+ // Changes should always be OK
+ return true;
}
/**
- * Get the maximum allowable file size.
- *
- * @return The maximum allowable file size.
+ * {@inheritDoc}
*/
- public long getMaxFileSize()
+ public ConfigChangeResult applyConfigurationChange(
+ SizeLimitLogRotationPolicyCfg config)
{
- return sizeLimit;
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ sizeLimit = config.getFileSizeLimit();
+
+ currentConfig = config;
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
}
/**
* This method indicates if the log file should be
* rotated or not.
*
+ * @param writer The multi file text writer writing the log file.
* @return true if the file needs to be rotated, false otherwise.
*/
- public boolean rotateFile()
+ public boolean rotateFile(MultifileTextWriter writer)
{
- if (fileHandler.getFileSize() >= sizeLimit)
+ if (writer.getBytesWritten() >= sizeLimit)
{
if (debugEnabled())
{
- debugInfo("File Length: %d", fileHandler.getFileSize());
+ debugInfo("%d bytes written in current file", writer.getBytesWritten());
}
return true;
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/StartupErrorLogger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/StartupErrorLogger.java
deleted file mode 100644
index 1c4b39a..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/StartupErrorLogger.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-
-
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.StringTokenizer;
-
-import org.opends.server.api.ErrorLogger;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.types.ErrorLogCategory;
-import org.opends.server.types.ErrorLogSeverity;
-import org.opends.server.util.TimeThread;
-
-
-
-/**
- * This class defines a Directory Server error logger that will be used only
- * during startup. It makes it possible for informational, warning, and error
- * messages to be generated during startup and made available to the user for
- * things that happen before the configuration can be parsed and all of the
- * actual error loggers instantiated and registered. This error logger will be
- * taken out of service once the startup is complete.
- * <BR><BR>
- * By default, fatal errors, severe errors, severe warnings, and important
- * information will be logged. This can be modified on a per-category basis
- * using a "DS_ERROR_LEVEL" environment variable that should be a
- * semicolon-delimited list in which each element in that list should contain
- * the name of the category, an equal sign, and a comma-delimited list of the
- * severity levels to use for that category.
- */
-public class StartupErrorLogger
- extends ErrorLogger
-{
- /**
- * The name of the environment variable that may be used to alter the kinds of
- * messages that get logged with this startup error logger.
- */
- public static final String ENV_VARIABLE_ERROR_LOG_LEVEL = "DS_ERROR_LEVEL";
-
-
-
- // The hash map that will be used to define specific log severities for the
- // various categories.
- private HashMap<ErrorLogCategory,HashSet<ErrorLogSeverity>> definedSeverities;
-
- // The set of default log severities that will be used if no custom severities
- // have been defined for the associated category.
- private HashSet<ErrorLogSeverity> defaultSeverities;
-
- // The writer that will be used to actually write the messages.
- private PrintWriter writer;
-
-
-
- /**
- * Creates a new instance of this startup error logger. It does not actually
- * do anything, since all initialization is performed in the
- * <CODE>initializeErrorLogger</CODE> method.
- */
- public StartupErrorLogger()
- {
- super();
- }
-
-
-
- /**
- * Initializes this error logger based on the information in the provided
- * configuration entry.
- *
- * @param configEntry The configuration entry that contains the information
- * to use to initialize this error logger.
- */
- public void initializeErrorLogger(ConfigEntry configEntry)
- {
- writer = new PrintWriter(System.err, true);
-
- defaultSeverities = new HashSet<ErrorLogSeverity>();
- defaultSeverities.add(ErrorLogSeverity.FATAL_ERROR);
- defaultSeverities.add(ErrorLogSeverity.SEVERE_ERROR);
- defaultSeverities.add(ErrorLogSeverity.SEVERE_WARNING);
- defaultSeverities.add(ErrorLogSeverity.NOTICE);
-
- definedSeverities =
- new HashMap<ErrorLogCategory,HashSet<ErrorLogSeverity>>();
-
-
- String logLevelInfo = System.getenv(ENV_VARIABLE_ERROR_LOG_LEVEL);
- if (logLevelInfo != null)
- {
- StringTokenizer tokenizer = new StringTokenizer(logLevelInfo, ";");
- while (tokenizer.hasMoreTokens())
- {
- String token = tokenizer.nextToken();
- int equalPos = token.indexOf('=');
- if (equalPos < 0)
- {
- writer.println("StartupErrorLogger: Token \"" + token +
- "\" read from environment variable " +
- ENV_VARIABLE_ERROR_LOG_LEVEL + " does not contain " +
- "an equal sign to separate the category from the " +
- "severity list. It will be ignored");
- continue;
- }
-
- String categoryName = token.substring(0, equalPos);
- ErrorLogCategory category = ErrorLogCategory.getByName(categoryName);
- if (category == null)
- {
- writer.println("StartupErrorLogger: Unknown error log category \"" +
- categoryName + "\" read from environment variable " +
- ENV_VARIABLE_ERROR_LOG_LEVEL + " will be ignored.");
- continue;
- }
-
- HashSet<ErrorLogSeverity> severities = new HashSet<ErrorLogSeverity>();
- StringTokenizer sevTokenizer =
- new StringTokenizer(token.substring(equalPos+1), ",");
- while (sevTokenizer.hasMoreElements())
- {
- String severityName = sevTokenizer.nextToken();
- ErrorLogSeverity severity = ErrorLogSeverity.getByName(severityName);
- if (severity == null)
- {
- writer.println("StartupErrorLogger: Unknown error log severity " +
- "\"" + severityName + "\" read from environment " +
- "variable " + ENV_VARIABLE_ERROR_LOG_LEVEL +
- " will be ignored.");
- continue;
- }
- else
- {
- severities.add(severity);
- }
- }
-
- definedSeverities.put(category, severities);
- }
- }
- }
-
-
-
- /**
- * Closes this error logger and releases any resources it might have held.
- */
- public void closeErrorLogger()
- {
- // No action is required, and this logger will remain usable.
- }
-
-
-
- /**
- * Writes a message to the error log using the provided information.
- *
- * @param category The category that may be used to determine whether to
- * actually log this message.
- * @param severity The severity that may be used to determine whether to
- * actually log this message.
- * @param message The message to be logged.
- * @param errorID The error ID that uniquely identifies the format string
- * used to generate the provided message.
- */
- public void logError(ErrorLogCategory category, ErrorLogSeverity severity,
- String message, int errorID)
- {
- HashSet<ErrorLogSeverity> severities = definedSeverities.get(category);
- if (severities == null)
- {
- severities = defaultSeverities;
- }
-
- if (severities.contains(severity))
- {
- StringBuilder logMsg = new StringBuilder();
-
- logMsg.append('[');
- logMsg.append(TimeThread.getLocalTime());
- logMsg.append("] category=");
- logMsg.append(category.getCategoryName());
- logMsg.append(" severity=");
- logMsg.append(severity.getSeverityName());
- logMsg.append(" id=");
- logMsg.append(errorID);
- logMsg.append(" msg=\"");
- logMsg.append(message);
- logMsg.append("\"");
-
- writer.println(logMsg.toString());
- }
- }
-
-
-
- /**
- * Indicates whether the provided object is equal to this error logger.
- *
- * @param o The object for which to make the determination.
- *
- * @return <CODE>true</CODE> if the provided object is determined to be equal
- * to this error logger, or <CODE>false</CODE> if not.
- */
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
-
- if ((o == null) || (! (o instanceof StartupErrorLogger)))
- {
- return false;
- }
-
- return true;
- }
-
-
-
- /**
- * Retrieves the hash code for this error logger.
- *
- * @return The hash code for this error logger.
- */
- public int hashCode()
- {
- // Just make one up, since there should never be a need to have more than
- // one instance of this error logger.
- return 12345;
- }
-}
-
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryAccessLogger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
similarity index 61%
rename from opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryAccessLogger.java
rename to opendj-sdk/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
index fba3ae5..cc8ac75 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/DirectoryAccessLogger.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
@@ -29,22 +29,10 @@
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.*;
-import org.opends.server.api.AccessLogger;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.api.ConfigurableComponent;
-import org.opends.server.config.BooleanConfigAttribute;
-import org.opends.server.config.ConfigAttribute;
-import org.opends.server.config.ConfigEntry;
+import org.opends.server.api.*;
import org.opends.server.config.ConfigException;
-import org.opends.server.config.StringConfigAttribute;
import org.opends.server.core.AbandonOperation;
import org.opends.server.core.AddOperation;
import org.opends.server.core.BindOperation;
@@ -56,79 +44,348 @@
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.UnbindOperation;
-import org.opends.server.types.ByteString;
-import org.opends.server.types.ConfigChangeResult;
-import org.opends.server.types.DisconnectReason;
-import org.opends.server.types.DN;
-import org.opends.server.types.ResultCode;
-import org.opends.server.types.SearchResultEntry;
-import org.opends.server.types.SearchResultReference;
+import org.opends.server.types.*;
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.messages.LoggerMessages.*;
import static org.opends.server.messages.ConfigMessages.*;
-import static org.opends.server.messages.MessageHandler.*;
-
+import static org.opends.server.messages.MessageHandler.getMessage;
+import org.opends.server.admin.std.server.FileBasedAccessLogPublisherCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import static org.opends.server.util.StaticUtils.getFileForPath;
+import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
+import org.opends.server.util.TimeThread;
/**
* This class provides the implementation of the access logger used by
* the directory server.
*/
-public class DirectoryAccessLogger extends AccessLogger
- implements ConfigurableComponent
+public class TextAccessLogPublisher
+ extends AccessLogPublisher<FileBasedAccessLogPublisherCfg>
+ implements ConfigurationChangeListener<FileBasedAccessLogPublisherCfg>
{
- private static final int DEFAULT_TIME_INTERVAL = 30000;
- private static final int DEFAULT_BUFFER_SIZE = 65536;
- private boolean suppressInternalOps = true;
- private Logger accessLogger = null;
- private String changedLogFileName = null;
- private DirectoryFileHandler fileHandler = null;
+ private TextWriter writer;
- // The DN of the config entry this component is associated with.
- private DN configDN;
-
+ private FileBasedAccessLogPublisherCfg currentConfig;
/**
- * Initializes this access logger based on the information in the provided
- * configuration entry.
+ * Returns an instance of the text access log publisher that will print
+ * all messages to the provided writer. This is used to print the messages
+ * to the console when the server starts up.
*
- * @param configEntry The configuration entry that contains the information
- * to use to initialize this access logger.
- *
- * @throws ConfigException If an unrecoverable problem arises in the
- * process of performing the initialization.
- */
- public void initializeAccessLogger(ConfigEntry configEntry)
- throws ConfigException
+ * @param writer The text writer where the message will be written to.
+ * @return The instance of the text error log publisher that will print
+ * all messages to standard out.
+ */
+ public static TextAccessLogPublisher
+ getStartupTextAccessPublisher(TextWriter writer)
{
- configDN = configEntry.getDN();
+ TextAccessLogPublisher startupPublisher = new TextAccessLogPublisher();
+ startupPublisher.writer = writer;
- // FIXME - read the logger name from the config
- StringConfigAttribute logFileStub =
- new StringConfigAttribute(ATTR_LOGGER_FILE,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- StringConfigAttribute logFileNameAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(logFileStub);
-
- if(logFileNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_FILE_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- throw new ConfigException(msgID, message);
- }
- initializeAccessLogger(logFileNameAttr.activeValue(), configEntry);
-
+ return startupPublisher;
}
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeAccessLogPublisher(
+ FileBasedAccessLogPublisherCfg config)
+ throws ConfigException, InitializationException
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ FileNamingPolicy fnPolicy = new TimeStampNaming(logFile);
+
+ try
+ {
+ FilePermission perm =
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+
+ LogPublisherErrorHandler errorHandler =
+ new LogPublisherErrorHandler(config.dn());
+
+ boolean writerAutoFlush =
+ config.isAutoFlush() && !config.isAsynchronous();
+
+ MultifileTextWriter writer =
+ new MultifileTextWriter("Multifile Text Writer for " +
+ config.dn().toNormalizedString(),
+ config.getTimeInterval(),
+ fnPolicy,
+ perm,
+ errorHandler,
+ "UTF-8",
+ writerAutoFlush,
+ config.isAppend(),
+ (int)config.getBufferSize());
+
+ // Validate retention and rotation policies.
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy != null)
+ {
+ writer.addRotationPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ throw new ConfigException(msgID, message);
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ writer.addRetentionPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ throw new ConfigException(msgID, message);
+ }
+ }
+
+ if(config.isAsynchronous())
+ {
+ this.writer = new AsyncronousTextWriter("Asyncronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ writer);
+ }
+ else
+ {
+ this.writer = writer;
+ }
+ }
+ catch(DirectoryException e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ String.valueOf(e));
+ throw new InitializationException(msgID, message, e);
+
+ }
+ catch(IOException e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ String.valueOf(e));
+ throw new InitializationException(msgID, message, e);
+
+ }
+
+ suppressInternalOperations = config.isSuppressInternalOperations();
+
+ currentConfig = config;
+
+ config.addFileBasedAccessChangeListener(this);
+ }
/**
- * Closes this access logger and releases any resources it might have held.
+ * {@inheritDoc}
*/
- public void closeAccessLogger()
+ public boolean isConfigurationChangeAcceptable(
+ FileBasedAccessLogPublisherCfg config, List<String> unacceptableReasons)
+ {
+ // Make sure the permission is valid.
+ try
+ {
+ if(!currentConfig.getLogFileMode().equalsIgnoreCase(
+ config.getLogFileMode()))
+ {
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+ }
+ if(!currentConfig.getLogFile().equalsIgnoreCase(config.getLogFile()))
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ if(logFile.createNewFile())
+ {
+ logFile.delete();
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+
+ // Validate retention and rotation policies.
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy == null)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ unacceptableReasons.add(message);
+ return false;
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy == null)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ unacceptableReasons.add(message);
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ FileBasedAccessLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ suppressInternalOperations = config.isSuppressInternalOperations();
+
+ File logFile = getFileForPath(config.getLogFile());
+ FileNamingPolicy fnPolicy = new TimeStampNaming(logFile);
+
+ try
+ {
+ FilePermission perm =
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+
+ boolean writerAutoFlush =
+ config.isAutoFlush() && !config.isAsynchronous();
+
+ TextWriter currentWriter;
+ // Determine the writer we are using. If we were writing asyncronously,
+ // we need to modify the underlaying writer.
+ if(writer instanceof AsyncronousTextWriter)
+ {
+ currentWriter = ((AsyncronousTextWriter)writer).getWrappedWriter();
+ }
+ else
+ {
+ currentWriter = writer;
+ }
+
+ if(currentWriter instanceof MultifileTextWriter)
+ {
+ MultifileTextWriter mfWriter = (MultifileTextWriter)currentWriter;
+
+ mfWriter.setNamingPolicy(fnPolicy);
+ mfWriter.setFilePermissions(perm);
+ mfWriter.setAppend(config.isAppend());
+ mfWriter.setAutoFlush(writerAutoFlush);
+ mfWriter.setBufferSize((int)config.getBufferSize());
+ mfWriter.setInterval(config.getTimeInterval());
+
+ mfWriter.removeAllRetentionPolicies();
+ mfWriter.removeAllRotationPolicies();
+
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy != null)
+ {
+ mfWriter.addRotationPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ mfWriter.addRetentionPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+ }
+ }
+
+
+ if(writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ {
+ // The asynronous setting is being turned off.
+ AsyncronousTextWriter asyncWriter = ((AsyncronousTextWriter)writer);
+ writer = mfWriter;
+ asyncWriter.shutdown(false);
+ }
+
+ if(!(writer instanceof AsyncronousTextWriter) &&
+ config.isAsynchronous())
+ {
+ // The asynronous setting is being turned on.
+ AsyncronousTextWriter asyncWriter =
+ new AsyncronousTextWriter("Asyncronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ mfWriter);
+ writer = asyncWriter;
+ }
+
+ if((currentConfig.isAsynchronous() && config.isAsynchronous()) &&
+ (currentConfig.getQueueSize() != config.getQueueSize()))
+ {
+ adminActionRequired = true;
+ }
+
+ currentConfig = config;
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void close()
{
- fileHandler.close();
+ writer.shutdown();
+
+ if(currentConfig != null)
+ {
+ currentConfig.removeFileBasedAccessChangeListener(this);
+ }
}
@@ -143,12 +400,15 @@
public void logConnect(ClientConnection clientConnection)
{
long connectionID = clientConnection.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
- buffer.append("CONNECT conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" CONNECT conn=");
buffer.append(connectionID);
buffer.append(" from=");
buffer.append(clientConnection.getClientAddress());
@@ -157,7 +417,7 @@
buffer.append(" protocol=");
buffer.append(clientConnection.getProtocol());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -177,13 +437,15 @@
String message)
{
long connectionID = clientConnection.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("DISCONNECT conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" DISCONNECT conn=");
buffer.append(connectionID);
buffer.append(" reason=\"");
buffer.append(disconnectReason);
@@ -196,7 +458,7 @@
buffer.append("\"");
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -211,14 +473,16 @@
public void logAbandonRequest(AbandonOperation abandonOperation)
{
long connectionID = abandonOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("ABANDON conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" ABANDON conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(abandonOperation.getOperationID());
@@ -227,7 +491,7 @@
buffer.append(" idToAbandon=");
buffer.append(abandonOperation.getIDToAbandon());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
/**
@@ -240,13 +504,15 @@
public void logAbandonResult(AbandonOperation abandonOperation)
{
long connectionID = abandonOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("ABANDON conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" ABANDON conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(abandonOperation.getOperationID());
@@ -266,7 +532,7 @@
buffer.append(" etime=");
buffer.append(abandonOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -280,13 +546,15 @@
public void logAddRequest(AddOperation addOperation)
{
long connectionID = addOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("ADD conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" ADD conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(addOperation.getOperationID());
@@ -296,7 +564,7 @@
addOperation.getRawEntryDN().toString(buffer);
buffer.append("\"");
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -310,13 +578,15 @@
public void logAddResponse(AddOperation addOperation)
{
long connectionID = addOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("ADD conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" ADD conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(addOperation.getOperationID());
@@ -335,7 +605,7 @@
buffer.append("\" etime=");
buffer.append(addOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -350,13 +620,15 @@
public void logBindRequest(BindOperation bindOperation)
{
long connectionID = bindOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("BIND conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" BIND conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(bindOperation.getOperationID());
@@ -382,7 +654,7 @@
bindOperation.getRawBindDN().toString(buffer);
buffer.append("\"");
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -396,13 +668,15 @@
public void logBindResponse(BindOperation bindOperation)
{
long connectionID = bindOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("BIND conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" BIND conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(bindOperation.getOperationID());
@@ -435,7 +709,7 @@
buffer.append("\" etime=");
buffer.append(bindOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -449,13 +723,15 @@
public void logCompareRequest(CompareOperation compareOperation)
{
long connectionID = compareOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("COMPARE conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" COMPARE conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(compareOperation.getOperationID());
@@ -466,7 +742,7 @@
buffer.append("\" attr=");
buffer.append(compareOperation.getAttributeType());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -480,13 +756,15 @@
public void logCompareResponse(CompareOperation compareOperation)
{
long connectionID = compareOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("COMPARE conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" COMPARE conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(compareOperation.getOperationID());
@@ -505,7 +783,7 @@
buffer.append("\" etime=");
buffer.append(compareOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -519,13 +797,15 @@
public void logDeleteRequest(DeleteOperation deleteOperation)
{
long connectionID = deleteOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("DELETE conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" DELETE conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(deleteOperation.getOperationID());
@@ -536,7 +816,7 @@
buffer.append("\"");
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -550,13 +830,15 @@
public void logDeleteResponse(DeleteOperation deleteOperation)
{
long connectionID = deleteOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("DELETE conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" DELETE conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(deleteOperation.getOperationID());
@@ -575,7 +857,7 @@
buffer.append("\" etime=");
buffer.append(deleteOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -590,13 +872,15 @@
public void logExtendedRequest(ExtendedOperation extendedOperation)
{
long connectionID = extendedOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("EXTENDED conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" EXTENDED conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(extendedOperation.getOperationID());
@@ -606,7 +890,7 @@
buffer.append(extendedOperation.getRequestOID());
buffer.append("\"");
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -621,13 +905,15 @@
public void logExtendedResponse(ExtendedOperation extendedOperation)
{
long connectionID = extendedOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("EXTENDED conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" EXTENDED conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(extendedOperation.getOperationID());
@@ -655,7 +941,7 @@
buffer.append("\" etime=");
buffer.append(extendedOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -670,13 +956,15 @@
public void logModifyRequest(ModifyOperation modifyOperation)
{
long connectionID = modifyOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("MODIFY conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" MODIFY conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(modifyOperation.getOperationID());
@@ -686,7 +974,7 @@
modifyOperation.getRawEntryDN().toString(buffer);
buffer.append("\"");
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -701,13 +989,15 @@
public void logModifyResponse(ModifyOperation modifyOperation)
{
long connectionID = modifyOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("MODIFY conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" MODIFY conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(modifyOperation.getOperationID());
@@ -726,7 +1016,7 @@
buffer.append("\" etime=");
buffer.append(modifyOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -741,13 +1031,15 @@
public void logModifyDNRequest(ModifyDNOperation modifyDNOperation)
{
long connectionID = modifyDNOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("MODIFYDN conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" MODIFYDN conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(modifyDNOperation.getOperationID());
@@ -767,7 +1059,7 @@
newSuperior.toString(buffer);
}
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -783,13 +1075,15 @@
public void logModifyDNResponse(ModifyDNOperation modifyDNOperation)
{
long connectionID = modifyDNOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("MODIFYDN conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" MODIFYDN conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(modifyDNOperation.getOperationID());
@@ -808,7 +1102,7 @@
buffer.append("\" etime=");
buffer.append(modifyDNOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -822,13 +1116,15 @@
public void logSearchRequest(SearchOperation searchOperation)
{
long connectionID = searchOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("SEARCH conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" SEARCH conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(searchOperation.getOperationID());
@@ -861,7 +1157,7 @@
buffer.append("\"");
}
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -908,13 +1204,15 @@
public void logSearchResultDone(SearchOperation searchOperation)
{
long connectionID = searchOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("SEARCH conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" SEARCH conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(searchOperation.getOperationID());
@@ -935,7 +1233,7 @@
buffer.append(" etime=");
buffer.append(searchOperation.getProcessingTime());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
+ writer.writeRecord(buffer.toString());
}
@@ -950,270 +1248,22 @@
public void logUnbind(UnbindOperation unbindOperation)
{
long connectionID = unbindOperation.getConnectionID();
- if(connectionID < 0 && suppressInternalOps)
+ if (connectionID < 0 && suppressInternalOperations)
{
return;
}
StringBuilder buffer = new StringBuilder(50);
-
- buffer.append("UNBIND conn=");
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append(" UNBIND conn=");
buffer.append(connectionID);
buffer.append(" op=");
buffer.append(unbindOperation.getOperationID());
buffer.append(" msgID=");
buffer.append(unbindOperation.getMessageID());
- accessLogger.log(DirectoryLogLevel.INFORMATIONAL, buffer.toString());
- }
-
-
-
- /**
- * Indicates whether the provided object is equal to this access logger.
- *
- * @param obj The object for which to make the determination.
- *
- * @return <CODE>true</CODE> if the provided object is equal
- * to this access logger, or <CODE>false</CODE> if not.
- */
- public boolean equals(Object obj)
- {
- if(this == obj) {
- return true;
- }
-
- if((obj == null) || (obj.getClass() != this.getClass()))
- {
- return false;
- }
-
- return accessLogger.equals(obj);
- }
-
-
-
- /**
- * Retrieves the hash code for this access logger.
- *
- * @return The hash code for this access logger.
- */
- public int hashCode()
- {
- return accessLogger.hashCode();
- }
-
-
-
- /**
- * Retrieves the DN of the configuration entry with which this component is
- * associated.
- *
- * @return The DN of the configuration entry with which this component is
- * associated.
- */
- public DN getConfigurableComponentEntryDN()
- {
- return configDN;
- }
-
-
-
- /**
- * Retrieves the set of configuration attributes that are associated with this
- * configurable component.
- *
- * @return The set of configuration attributes that are associated with this
- * configurable component.
- */
- public List<ConfigAttribute> getConfigurationAttributes()
- {
- // NYI
- return null;
- }
-
-
- /**
- * Indicates whether the configuration entry that will result from a proposed
- * modification is acceptable to this change listener.
- *
- * @param configEntry The configuration entry that will result from
- * the requested update.
- * @param unacceptableReasons A buffer to which this method can append a
- * human-readable message explaining why the
- * proposed change is not acceptable.
- *
- * @return <CODE>true</CODE> if the proposed entry contains an acceptable
- * configuration, or <CODE>false</CODE> if it does not.
- */
- public boolean hasAcceptableConfiguration(ConfigEntry configEntry,
- List<String> unacceptableReasons)
- {
- try
- {
- StringConfigAttribute logFileStub =
- new StringConfigAttribute(ATTR_LOGGER_FILE,
- getMessage(MSGID_CONFIG_LOGGER_DESCRIPTION_CLASS_NAME),
- true, false, true);
- StringConfigAttribute logFileNameAttr = (StringConfigAttribute)
- configEntry.getConfigAttribute(logFileStub);
-
- if(logFileNameAttr == null)
- {
- int msgID = MSGID_CONFIG_LOGGER_NO_FILE_NAME;
- String message = getMessage(msgID, configEntry.getDN().toString());
- unacceptableReasons.add(message);
- return false;
- }
- changedLogFileName = logFileNameAttr.pendingValue();
- } catch (ConfigException ce)
- {
- int msgID = MSGID_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS;
- String message = getMessage(msgID, this.getClass().getName(),
- configEntry.getDN().toString(),
- String.valueOf(ce));
- unacceptableReasons.add(message);
- return false;
- }
-
- return true;
- }
-
-
-
- /**
- * Attempts to apply a new configuration to this Directory Server component
- * based on the provided changed entry.
- *
- * @param configEntry The configuration entry that containing the
- * updated configuration for this component.
- * @param detailedResults Indicates whether to provide detailed information
- * about any actions performed.
- *
- * @return Information about the result of processing the configuration
- * change.
- */
- public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry,
- boolean detailedResults)
- {
- fileHandler.close();
- // reinitialize the logger.
- try
- {
- initializeAccessLogger(changedLogFileName, configEntry);
- } catch(ConfigException ce)
- {
- // TODO - log the change failure.
- return new ConfigChangeResult(DirectoryServer.getServerErrorResultCode(),
- false);
- }
-
- return new ConfigChangeResult(ResultCode.SUCCESS, false);
- }
-
-
- /**
- * Initialize the JDK logger an associate a file handler with the
- * specified file name with it.
- *
- * @param logFileName The name of the log file to write to.
- * @param configEntry The configuration entry with the information to use to
- * initialize this logger.
- *
- * @throws ConfigException If an unrecoverable problem arises in the
- * process of performing the initialization.
- */
- private void initializeAccessLogger(String logFileName,
- ConfigEntry configEntry) throws ConfigException
- {
- accessLogger =
- Logger.getLogger("org.opends.server.loggers.DirectoryAccessLogger");
- accessLogger.setLevel(Level.ALL);
-
- File logFile = new File(logFileName);
- if(!logFile.isAbsolute())
- {
- logFile = new File (DirectoryServer.getServerRoot() + File.separator +
- logFileName);
- }
-
- BooleanConfigAttribute enabledAttr;
- try
- {
- BooleanConfigAttribute enabledStub =
- new BooleanConfigAttribute(ATTR_LOGGER_SUPPRESS_INTERNAL_OPERATIONS,
- getMessage(MSGID_CONFIG_LOGGER_SUPPRESS_INTERNAL_OPERATIONS),
- false);
- enabledAttr = (BooleanConfigAttribute)
- configEntry.getConfigAttribute(enabledStub);
-
- if (enabledAttr != null)
- {
- suppressInternalOps = enabledAttr.pendingValue();
- }
- }
- catch (Exception e)
- {
- int msgID = MSGID_CONFIG_LOGGER_INVALID_SUPPRESS_INT_OPERATION_VALUE;
- String message = getMessage(msgID, configEntry.getDN().toString(),
- String.valueOf(e));
- throw new ConfigException(msgID, message);
- }
-
-
- try
- {
- int bufferSize = RotationConfigUtil.getIntegerAttribute(configEntry,
- ATTR_LOGGER_BUFFER_SIZE, MSGID_LOGGER_BUFFER_SIZE);
- if(bufferSize == -1)
- {
- bufferSize = DEFAULT_BUFFER_SIZE;
- }
- CopyOnWriteArrayList<RotationPolicy> rp =
- RotationConfigUtil.getRotationPolicies(configEntry);
- fileHandler = new DirectoryFileHandler(configEntry,
- logFile.getAbsolutePath(),
- bufferSize);
- fileHandler.setFormatter(new DirectoryFileFormatter(false));
- accessLogger.addHandler(fileHandler);
-
- if(rp != null)
- {
- ArrayList<ActionType> actions =
- RotationConfigUtil.getPostRotationActions(configEntry);
- fileHandler.setPostRotationActions(actions);
- for(RotationPolicy rotationPolicy : rp)
- {
- if(rotationPolicy instanceof SizeBasedRotationPolicy)
- {
- long fileSize =
- ((SizeBasedRotationPolicy) rotationPolicy).getMaxFileSize();
- fileHandler.setFileSize(fileSize);
- rp.remove(rotationPolicy);
- }
- }
- }
-
- CopyOnWriteArrayList<RetentionPolicy> retentionPolicies =
- RotationConfigUtil.getRetentionPolicies(configEntry);
-
- int threadTimeInterval = RotationConfigUtil.getIntegerAttribute(
- configEntry, ATTR_LOGGER_THREAD_INTERVAL,
- MSGID_LOGGER_THREAD_INTERVAL);
- if(threadTimeInterval == -1)
- {
- threadTimeInterval = DEFAULT_TIME_INTERVAL;
- }
-
- LoggerThread lt = new LoggerThread("AccessLogger Thread",
- threadTimeInterval, fileHandler, rp,
- retentionPolicies);
- lt.start();
-
- } catch(IOException ioe) {
- int msgID = MSGID_LOG_ACCESS_CANNOT_ADD_FILE_HANDLER;
- String message = getMessage(msgID, String.valueOf(ioe));
- throw new ConfigException(msgID, message, ioe);
- }
+ writer.writeRecord(buffer.toString());
}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java
new file mode 100644
index 0000000..3c3e882
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java
@@ -0,0 +1,870 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+import org.opends.server.api.*;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.AbandonOperation;
+import org.opends.server.core.AddOperation;
+import org.opends.server.core.BindOperation;
+import org.opends.server.core.CompareOperation;
+import org.opends.server.core.DeleteOperation;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.ExtendedOperation;
+import org.opends.server.core.ModifyOperation;
+import org.opends.server.core.ModifyDNOperation;
+import org.opends.server.core.SearchOperation;
+import org.opends.server.core.UnbindOperation;
+import org.opends.server.protocols.asn1.ASN1OctetString;
+import org.opends.server.types.*;
+import org.opends.server.util.Base64;
+import org.opends.server.util.StaticUtils;
+import org.opends.server.util.TimeThread;
+import static org.opends.server.util.StaticUtils.getFileForPath;
+import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
+
+import static org.opends.server.messages.ConfigMessages.*;
+import static org.opends.server.messages.MessageHandler.getMessage;
+import static org.opends.server.types.ResultCode.*;
+import static org.opends.server.util.ServerConstants.*;
+import org.opends.server.admin.std.server.FileBasedAccessLogPublisherCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+
+
+/**
+ * This class provides the implementation of the audit logger used by
+ * the directory server.
+ */
+public class TextAuditLogPublisher
+ extends AccessLogPublisher<FileBasedAccessLogPublisherCfg>
+ implements ConfigurationChangeListener<FileBasedAccessLogPublisherCfg>
+{
+ private TextWriter writer;
+
+ private FileBasedAccessLogPublisherCfg currentConfig;
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeAccessLogPublisher(
+ FileBasedAccessLogPublisherCfg config)
+ throws ConfigException, InitializationException
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ FileNamingPolicy fnPolicy = new TimeStampNaming(logFile);
+
+ try
+ {
+ FilePermission perm =
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+
+ LogPublisherErrorHandler errorHandler =
+ new LogPublisherErrorHandler(config.dn());
+
+ boolean writerAutoFlush =
+ config.isAutoFlush() && !config.isAsynchronous();
+
+ MultifileTextWriter writer =
+ new MultifileTextWriter("Multifile Text Writer for " +
+ config.dn().toNormalizedString(),
+ config.getTimeInterval(),
+ fnPolicy,
+ perm,
+ errorHandler,
+ "UTF-8",
+ writerAutoFlush,
+ config.isAppend(),
+ (int)config.getBufferSize());
+
+ // Validate retention and rotation policies.
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy != null)
+ {
+ writer.addRotationPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ throw new ConfigException(msgID, message);
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ writer.addRetentionPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ throw new ConfigException(msgID, message);
+ }
+ }
+
+ if(config.isAsynchronous())
+ {
+ this.writer = new AsyncronousTextWriter("Asyncronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ writer);
+ }
+ else
+ {
+ this.writer = writer;
+ }
+ }
+ catch(DirectoryException e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ String.valueOf(e));
+ throw new InitializationException(msgID, message, e);
+
+ }
+ catch(IOException e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ String.valueOf(e));
+ throw new InitializationException(msgID, message, e);
+
+ }
+
+ suppressInternalOperations = config.isSuppressInternalOperations();
+
+ currentConfig = config;
+
+ config.addFileBasedAccessChangeListener(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ FileBasedAccessLogPublisherCfg config, List<String> unacceptableReasons)
+ {
+ // Make sure the permission is valid.
+ try
+ {
+ if(!currentConfig.getLogFileMode().equalsIgnoreCase(
+ config.getLogFileMode()))
+ {
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+ }
+ if(!currentConfig.getLogFile().equalsIgnoreCase(config.getLogFile()))
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ if(logFile.createNewFile())
+ {
+ logFile.delete();
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+
+ // Validate retention and rotation policies.
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy == null)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ unacceptableReasons.add(message);
+ return false;
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy == null)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ unacceptableReasons.add(message);
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ FileBasedAccessLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ suppressInternalOperations = config.isSuppressInternalOperations();
+
+ File logFile = getFileForPath(config.getLogFile());
+ FileNamingPolicy fnPolicy = new TimeStampNaming(logFile);
+
+ try
+ {
+ FilePermission perm =
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+
+ boolean writerAutoFlush =
+ config.isAutoFlush() && !config.isAsynchronous();
+
+ TextWriter currentWriter;
+ // Determine the writer we are using. If we were writing asyncronously,
+ // we need to modify the underlaying writer.
+ if(writer instanceof AsyncronousTextWriter)
+ {
+ currentWriter = ((AsyncronousTextWriter)writer).getWrappedWriter();
+ }
+ else
+ {
+ currentWriter = writer;
+ }
+
+ if(currentWriter instanceof MultifileTextWriter)
+ {
+ MultifileTextWriter mfWriter = (MultifileTextWriter)writer;
+
+ mfWriter.setNamingPolicy(fnPolicy);
+ mfWriter.setFilePermissions(perm);
+ mfWriter.setAppend(config.isAppend());
+ mfWriter.setAutoFlush(writerAutoFlush);
+ mfWriter.setBufferSize((int)config.getBufferSize());
+ mfWriter.setInterval(config.getTimeInterval());
+
+ mfWriter.removeAllRetentionPolicies();
+ mfWriter.removeAllRotationPolicies();
+
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy != null)
+ {
+ mfWriter.addRotationPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ mfWriter.addRetentionPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+ }
+ }
+
+
+ if(writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ {
+ // The asynronous setting is being turned off.
+ AsyncronousTextWriter asyncWriter = ((AsyncronousTextWriter)writer);
+ writer = mfWriter;
+ asyncWriter.shutdown(false);
+ }
+
+ if(!(writer instanceof AsyncronousTextWriter) &&
+ config.isAsynchronous())
+ {
+ // The asynronous setting is being turned on.
+ AsyncronousTextWriter asyncWriter =
+ new AsyncronousTextWriter("Asyncronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ mfWriter);
+ writer = asyncWriter;
+ }
+
+ if((currentConfig.isAsynchronous() && config.isAsynchronous()) &&
+ (currentConfig.getQueueSize() != config.getQueueSize()))
+ {
+ adminActionRequired = true;
+ }
+
+ currentConfig = config;
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void close()
+ {
+ writer.shutdown();
+ currentConfig.removeFileBasedAccessChangeListener(this);
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about a new client
+ * connection that has been established, regardless of whether it will be
+ * immediately terminated.
+ *
+ * @param clientConnection The client connection that has been established.
+ */
+ public void logConnect(ClientConnection clientConnection)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the
+ * termination of an existing client connection.
+ *
+ * @param clientConnection The client connection that has been terminated.
+ * @param disconnectReason A generic disconnect reason for the connection
+ * termination.
+ * @param message A human-readable message that can provide
+ * additional information about the disconnect.
+ */
+ public void logDisconnect(ClientConnection clientConnection,
+ DisconnectReason disconnectReason,
+ String message)
+ {
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the abandon
+ * request associated with the provided abandon operation.
+ *
+ * @param abandonOperation The abandon operation containing the information
+ * to use to log the abandon request.
+ */
+ public void logAbandonRequest(AbandonOperation abandonOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the result
+ * of the provided abandon operation.
+ *
+ * @param abandonOperation The abandon operation containing the information
+ * to use to log the abandon request.
+ */
+ public void logAbandonResult(AbandonOperation abandonOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the add
+ * request associated with the provided add operation.
+ *
+ * @param addOperation The add operation containing the information to use
+ * to log the add request.
+ */
+ public void logAddRequest(AddOperation addOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the add
+ * response associated with the provided add operation.
+ *
+ * @param addOperation The add operation containing the information to use
+ * to log the add response.
+ */
+ public void logAddResponse(AddOperation addOperation)
+ {
+ long connectionID = addOperation.getConnectionID();
+ if(connectionID < 0 && suppressInternalOperations)
+ {
+ return;
+ }
+ ResultCode code = addOperation.getResultCode();
+
+ if(code == SUCCESS)
+ {
+ StringBuilder buffer = new StringBuilder(50);
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append("dn:");
+ ByteString dnString = addOperation.getRawEntryDN();
+ encodeValue(dnString, buffer);
+
+ buffer.append(EOL);
+ buffer.append("changetype: add");
+ buffer.append(EOL);
+ List<RawAttribute> rawAttributes = addOperation.getRawAttributes();
+ for (RawAttribute attr : rawAttributes)
+ {
+ buffer.append(attr.getAttributeType());
+ buffer.append(":");
+ List<ASN1OctetString> values = attr.getValues();
+ if (!values.isEmpty())
+ {
+ Iterator<ASN1OctetString> iterator = values.iterator();
+ ASN1OctetString nextString = iterator.next();
+ encodeValue(nextString, buffer);
+ while (iterator.hasNext())
+ {
+ buffer.append(EOL);
+ buffer.append(attr.getAttributeType());
+ buffer.append(":");
+ nextString = iterator.next();
+ encodeValue(nextString, buffer);
+ }
+ }
+ buffer.append(EOL);
+ }
+
+ writer.writeRecord(buffer.toString());
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the bind
+ * request associated with the provided bind operation.
+ *
+ * @param bindOperation The bind operation with the information to use
+ * to log the bind request.
+ */
+ public void logBindRequest(BindOperation bindOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the bind
+ * response associated with the provided bind operation.
+ *
+ * @param bindOperation The bind operation containing the information to use
+ * to log the bind response.
+ */
+ public void logBindResponse(BindOperation bindOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the compare
+ * request associated with the provided compare operation.
+ *
+ * @param compareOperation The compare operation containing the information
+ * to use to log the compare request.
+ */
+ public void logCompareRequest(CompareOperation compareOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the compare
+ * response associated with the provided compare operation.
+ *
+ * @param compareOperation The compare operation containing the information
+ * to use to log the compare response.
+ */
+ public void logCompareResponse(CompareOperation compareOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the delete
+ * request associated with the provided delete operation.
+ *
+ * @param deleteOperation The delete operation with the information to
+ * use to log the delete request.
+ */
+ public void logDeleteRequest(DeleteOperation deleteOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the delete
+ * response associated with the provided delete operation.
+ *
+ * @param deleteOperation The delete operation containing the information to
+ * use to log the delete response.
+ */
+ public void logDeleteResponse(DeleteOperation deleteOperation)
+ {
+ long connectionID = deleteOperation.getConnectionID();
+ if(connectionID < 0 && suppressInternalOperations)
+ {
+ return;
+ }
+ ResultCode code = deleteOperation.getResultCode();
+
+ if(code == SUCCESS)
+ {
+ StringBuilder buffer = new StringBuilder(50);
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append("dn:");
+ ByteString dnString = deleteOperation.getRawEntryDN();
+ encodeValue(dnString, buffer);
+ buffer.append(EOL);
+ buffer.append("changetype: delete");
+ buffer.append(EOL);
+ buffer.append(EOL);
+
+ writer.writeRecord(buffer.toString());
+ }
+
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the extended
+ * request associated with the provided extended operation.
+ *
+ * @param extendedOperation The extended operation containing the
+ * information to use to log the extended request.
+ */
+ public void logExtendedRequest(ExtendedOperation extendedOperation)
+ {
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the extended
+ * response associated with the provided extended operation.
+ *
+ * @param extendedOperation The extended operation containing the
+ * info to use to log the extended response.
+ */
+ public void logExtendedResponse(ExtendedOperation extendedOperation)
+ {
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the modify
+ * request associated with the provided modify operation.
+ *
+ * @param modifyOperation The modify operation containing the information to
+ * use to log the modify request.
+ */
+ public void logModifyRequest(ModifyOperation modifyOperation)
+ {
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the modify
+ * response associated with the provided modify operation.
+ *
+ * @param modifyOperation The modify operation containing the information to
+ * use to log the modify response.
+ */
+ public void logModifyResponse(ModifyOperation modifyOperation)
+ {
+ long connectionID = modifyOperation.getConnectionID();
+ if(connectionID < 0 && suppressInternalOperations)
+ {
+ return;
+ }
+ ResultCode code = modifyOperation.getResultCode();
+
+ if(code == SUCCESS)
+ {
+ StringBuilder buffer = new StringBuilder(50);
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append("dn:");
+ ByteString dnString = modifyOperation.getRawEntryDN();
+ encodeValue(dnString, buffer);
+ buffer.append(EOL);
+ buffer.append("changetype: modify");
+ buffer.append(EOL);
+ List<RawModification> modifications =
+ modifyOperation.getRawModifications();
+ for (RawModification modification : modifications)
+ {
+ ModificationType modType = modification.getModificationType();
+ RawAttribute attr = modification.getAttribute();
+ switch (modType)
+ {
+ case ADD:
+ buffer.append("add: ");
+ break;
+ case DELETE:
+ buffer.append("delete: ");
+ break;
+ case REPLACE:
+ buffer.append("replace: ");
+ break;
+ default:
+ break;
+ }
+ buffer.append(attr.getAttributeType());
+ List<ASN1OctetString> values = attr.getValues();
+ if (!values.isEmpty())
+ {
+ Iterator<ASN1OctetString> iterator = values.iterator();
+ ASN1OctetString nextString = iterator.next();
+ encodeValue(nextString, buffer);
+ while (iterator.hasNext())
+ {
+ buffer.append(EOL);
+ buffer.append(attr.getAttributeType());
+ buffer.append(":");
+ nextString = iterator.next();
+ encodeValue(nextString, buffer);
+ }
+ }
+ buffer.append(EOL);
+ }
+
+ buffer.append(EOL);
+
+ writer.writeRecord(buffer.toString());
+ }
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the modify DN
+ * request associated with the provided modify DN operation.
+ *
+ * @param modifyDNOperation The modify DN operation containing the
+ * info to use to log the modify DN request.
+ */
+ public void logModifyDNRequest(ModifyDNOperation modifyDNOperation)
+ {
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the modify DN
+ * response associated with the provided modify DN operation.
+ *
+ * @param modifyDNOperation The modify DN operation containing the
+ * information to use to log the modify DN
+ * response.
+ */
+ public void logModifyDNResponse(ModifyDNOperation modifyDNOperation)
+ {
+ long connectionID = modifyDNOperation.getConnectionID();
+ if(connectionID < 0 && suppressInternalOperations)
+ {
+ return;
+ }
+ ResultCode code = modifyDNOperation.getResultCode();
+
+ if(code == SUCCESS)
+ {
+ StringBuilder buffer = new StringBuilder(50);
+ buffer.append("[");
+ buffer.append(TimeThread.getLocalTime());
+ buffer.append("]");
+ buffer.append("dn:");
+ ByteString dnString = modifyDNOperation.getRawEntryDN();
+ encodeValue(dnString, buffer);
+ buffer.append(EOL);
+ buffer.append("changetype: moddn");
+ buffer.append(EOL);
+ buffer.append("newrdn: ");
+ ByteString newrdnString = modifyDNOperation.getRawNewRDN();
+ encodeValue(newrdnString, buffer);
+ buffer.append(EOL);
+ buffer.append("deleteoldrdn: ");
+ if (modifyDNOperation.deleteOldRDN())
+ {
+ buffer.append("1");
+ }
+ else
+ {
+ buffer.append("0");
+ }
+ buffer.append(EOL);
+ if (modifyDNOperation.getRawNewSuperior() != null)
+ {
+ buffer.append("newsuperior: ");
+ ByteString newSuperior = modifyDNOperation.getRawNewSuperior();
+ encodeValue(newSuperior, buffer);
+ buffer.append(EOL);
+ }
+
+ buffer.append(EOL);
+
+ writer.writeRecord(buffer.toString());
+ }
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the search
+ * request associated with the provided search operation.
+ *
+ * @param searchOperation The search operation containing the info to
+ * use to log the search request.
+ */
+ public void logSearchRequest(SearchOperation searchOperation)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the search
+ * result entry that matches the criteria associated with the provided search
+ * operation.
+ *
+ * @param searchOperation The search operation with which the search result
+ * entry is associated.
+ * @param searchEntry The search result entry to be logged.
+ */
+ public void logSearchResultEntry(SearchOperation searchOperation,
+ SearchResultEntry searchEntry)
+ {
+ }
+
+
+ /**
+ * Writes a message to the audit logger with information about the search
+ * result reference returned while processing the associated search
+ * operation.
+ *
+ * @param searchOperation The search operation with which the search result
+ * reference is associated.
+ * @param searchReference The search result reference to be logged.
+ */
+ public void logSearchResultReference(SearchOperation searchOperation,
+ SearchResultReference searchReference)
+ {
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the
+ * completion of the provided search operation.
+ *
+ * @param searchOperation The search operation containing the information
+ * to use to log the search result done message.
+ */
+ public void logSearchResultDone(SearchOperation searchOperation)
+ {
+ }
+
+
+
+ /**
+ * Writes a message to the audit logger with information about the unbind
+ * request associated with the provided unbind operation.
+ *
+ * @param unbindOperation The unbind operation containing the info to
+ * use to log the unbind request.
+ */
+ public void logUnbind(UnbindOperation unbindOperation)
+ {
+ }
+
+
+ /**
+ * Appends the appropriately-encoded attribute value to the provided buffer.
+ *
+ * @param str The ASN.1 octet string containing the value to append.
+ * @param buffer The buffer to which to append the value.
+ */
+ private void encodeValue(ByteString str, StringBuilder buffer)
+ {
+ byte[] byteVal = str.value();
+ if(StaticUtils.needsBase64Encoding(byteVal))
+ {
+ buffer.append(": ");
+ buffer.append(Base64.encode(byteVal));
+ } else
+ {
+ buffer.append(" ");
+ str.toString(buffer);
+ }
+ }
+}
+
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
new file mode 100644
index 0000000..61f412d
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
@@ -0,0 +1,592 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+import org.opends.server.api.*;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.*;
+
+import static org.opends.server.messages.ConfigMessages.*;
+import static org.opends.server.messages.LoggerMessages.*;
+import static org.opends.server.messages.MessageHandler.getMessage;
+import org.opends.server.admin.std.server.FileBasedErrorLogPublisherCfg;
+import org.opends.server.admin.std.meta.ErrorLogPublisherCfgDefn;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import static org.opends.server.util.StaticUtils.getFileForPath;
+import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
+import org.opends.server.util.TimeThread;
+
+
+/**
+ * This class provides an implementation of an error log publisher.
+ */
+public class TextErrorLogPublisher
+ extends ErrorLogPublisher<FileBasedErrorLogPublisherCfg>
+ implements ConfigurationChangeListener<FileBasedErrorLogPublisherCfg>
+{
+ private TextWriter writer;
+
+ private FileBasedErrorLogPublisherCfg currentConfig;
+
+ /**
+ * Returns an instance of the text error log publisher that will print
+ * all messages to the provided writer. This is used to print the messages
+ * to the console when the server starts up.
+ *
+ * @param writer The text writer where the message will be written to.
+ * @return The instance of the text error log publisher that will print
+ * all messages to standard out.
+ */
+ public static TextErrorLogPublisher
+ getStartupTextErrorPublisher(TextWriter writer)
+ {
+ TextErrorLogPublisher startupPublisher = new TextErrorLogPublisher();
+ startupPublisher.writer = writer;
+
+ startupPublisher.defaultSeverities.add(ErrorLogSeverity.FATAL_ERROR);
+ startupPublisher.defaultSeverities.add(ErrorLogSeverity.SEVERE_ERROR);
+ startupPublisher.defaultSeverities.add(ErrorLogSeverity.SEVERE_WARNING);
+ startupPublisher.defaultSeverities.add(ErrorLogSeverity.NOTICE);
+
+ return startupPublisher;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeErrorLogPublisher(FileBasedErrorLogPublisherCfg config)
+ throws ConfigException, InitializationException
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ FileNamingPolicy fnPolicy = new TimeStampNaming(logFile);
+
+ try
+ {
+ FilePermission perm =
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+
+ LogPublisherErrorHandler errorHandler =
+ new LogPublisherErrorHandler(config.dn());
+
+ boolean writerAutoFlush =
+ config.isAutoFlush() && !config.isAsynchronous();
+
+ MultifileTextWriter writer =
+ new MultifileTextWriter("Multifile Text Writer for " +
+ config.dn().toNormalizedString(),
+ config.getTimeInterval(),
+ fnPolicy,
+ perm,
+ errorHandler,
+ "UTF-8",
+ writerAutoFlush,
+ config.isAppend(),
+ (int)config.getBufferSize());
+
+ // Validate retention and rotation policies.
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy != null)
+ {
+ writer.addRotationPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ throw new ConfigException(msgID, message);
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ writer.addRetentionPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ throw new ConfigException(msgID, message);
+ }
+ }
+
+ if(config.isAsynchronous())
+ {
+ this.writer = new AsyncronousTextWriter("Asyncronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ writer);
+ }
+ else
+ {
+ this.writer = writer;
+ }
+ }
+ catch(DirectoryException e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ String.valueOf(e));
+ throw new InitializationException(msgID, message, e);
+
+ }
+ catch(IOException e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ String.valueOf(e));
+ throw new InitializationException(msgID, message, e);
+
+ }
+
+ Set<ErrorLogPublisherCfgDefn.DefaultSeverity> defSevs =
+ config.getDefaultSeverity();
+ if(defSevs.isEmpty())
+ {
+ defaultSeverities.add(ErrorLogSeverity.FATAL_ERROR);
+ defaultSeverities.add(ErrorLogSeverity.SEVERE_ERROR);
+ defaultSeverities.add(ErrorLogSeverity.SEVERE_WARNING);
+ } else
+ {
+ for(ErrorLogPublisherCfgDefn.DefaultSeverity defSev : defSevs)
+ {
+ ErrorLogSeverity errorSeverity =
+ ErrorLogSeverity.getByName(defSev.name());
+ if(errorSeverity != null)
+ {
+ defaultSeverities.add(errorSeverity);
+ }
+ }
+ }
+
+ for(String overrideSeverity : config.getOverrideSeverity())
+ {
+ if(overrideSeverity != null)
+ {
+ int equalPos = overrideSeverity.indexOf('=');
+ if (equalPos < 0)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_OVERRIDE_SEVERITY;
+ String msg = getMessage(msgID, overrideSeverity);
+ throw new ConfigException(msgID, msg);
+
+ } else
+ {
+ String categoryName = overrideSeverity.substring(0, equalPos);
+ ErrorLogCategory category = ErrorLogCategory.getByName(categoryName);
+ if (category == null)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_CATEGORY;
+ String msg = getMessage(msgID, categoryName);
+ throw new ConfigException(msgID, msg);
+ } else
+ {
+ HashSet<ErrorLogSeverity> severities =
+ new HashSet<ErrorLogSeverity>();
+ StringTokenizer sevTokenizer =
+ new StringTokenizer(overrideSeverity.substring(equalPos+1), ",");
+ while (sevTokenizer.hasMoreElements())
+ {
+ String severityName = sevTokenizer.nextToken();
+ ErrorLogSeverity severity =
+ ErrorLogSeverity.getByName(severityName);
+ if (severity == null)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_SEVERITY;
+ String msg = getMessage(msgID, categoryName);
+ throw new ConfigException(msgID, msg);
+ } else
+ {
+ severities.add(severity);
+ }
+ }
+ definedSeverities.put(category, severities);
+ }
+ }
+ }
+ }
+
+ currentConfig = config;
+
+ config.addFileBasedErrorChangeListener(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ FileBasedErrorLogPublisherCfg config, List<String> unacceptableReasons)
+ {
+ // Make sure the permission is valid.
+ try
+ {
+ if(!currentConfig.getLogFileMode().equalsIgnoreCase(
+ config.getLogFileMode()))
+ {
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+ }
+ if(!currentConfig.getLogFile().equalsIgnoreCase(config.getLogFile()))
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ if(logFile.createNewFile())
+ {
+ logFile.delete();
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+
+ // Validate retention and rotation policies.
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy == null)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ unacceptableReasons.add(message);
+ return false;
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy == null)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ unacceptableReasons.add(message);
+ return false;
+ }
+ }
+
+ for(String overrideSeverity : config.getOverrideSeverity())
+ {
+ if(overrideSeverity != null)
+ {
+ int equalPos = overrideSeverity.indexOf('=');
+ if (equalPos < 0)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_OVERRIDE_SEVERITY;
+ String msg = getMessage(msgID, overrideSeverity);
+ unacceptableReasons.add(msg);
+ return false;
+
+ } else
+ {
+ String categoryName = overrideSeverity.substring(0, equalPos);
+ ErrorLogCategory category = ErrorLogCategory.getByName(categoryName);
+ if (category == null)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_CATEGORY;
+ String msg = getMessage(msgID, categoryName);
+ unacceptableReasons.add(msg);
+ return false;
+ } else
+ {
+ StringTokenizer sevTokenizer =
+ new StringTokenizer(overrideSeverity.substring(equalPos+1), ",");
+ while (sevTokenizer.hasMoreElements())
+ {
+ String severityName = sevTokenizer.nextToken();
+ ErrorLogSeverity severity =
+ ErrorLogSeverity.getByName(severityName);
+ if (severity == null)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_SEVERITY;
+ String msg = getMessage(msgID, categoryName);
+ unacceptableReasons.add(msg);
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ FileBasedErrorLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ Set<ErrorLogPublisherCfgDefn.DefaultSeverity> defSev =
+ config.getDefaultSeverity();
+ defaultSeverities.clear();
+ if(defSev.isEmpty())
+ {
+ defaultSeverities.add(ErrorLogSeverity.FATAL_ERROR);
+ defaultSeverities.add(ErrorLogSeverity.SEVERE_ERROR);
+ defaultSeverities.add(ErrorLogSeverity.SEVERE_WARNING);
+ } else
+ {
+ for(ErrorLogPublisherCfgDefn.DefaultSeverity defStr : defSev)
+ {
+ ErrorLogSeverity errorSeverity =
+ ErrorLogSeverity.getByName(defStr.toString());
+ if(errorSeverity != null)
+ {
+ defaultSeverities.add(errorSeverity);
+ }
+ }
+ }
+
+ definedSeverities.clear();
+ for(String overrideSeverity : config.getOverrideSeverity())
+ {
+ if(overrideSeverity != null)
+ {
+ int equalPos = overrideSeverity.indexOf('=');
+ if (equalPos < 0)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_OVERRIDE_SEVERITY;
+ String msg = getMessage(msgID, overrideSeverity);
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(msg);
+ } else
+ {
+ String categoryName = overrideSeverity.substring(0, equalPos);
+ ErrorLogCategory category = ErrorLogCategory.getByName(categoryName);
+ if (category == null)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_CATEGORY;
+ String msg = getMessage(msgID, categoryName);
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(msg);
+ } else
+ {
+ HashSet<ErrorLogSeverity> severities =
+ new HashSet<ErrorLogSeverity>();
+ StringTokenizer sevTokenizer =
+ new StringTokenizer(overrideSeverity.substring(equalPos+1), ",");
+ while (sevTokenizer.hasMoreElements())
+ {
+ String severityName = sevTokenizer.nextToken();
+ ErrorLogSeverity severity =
+ ErrorLogSeverity.getByName(severityName);
+ if (severity == null)
+ {
+ int msgID = MSGID_ERROR_LOGGER_INVALID_SEVERITY;
+ String msg = getMessage(msgID, categoryName);
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(msg);
+ } else
+ {
+ severities.add(severity);
+ }
+ }
+ definedSeverities.put(category, severities);
+ }
+ }
+ }
+ }
+
+ File logFile = getFileForPath(config.getLogFile());
+ FileNamingPolicy fnPolicy = new TimeStampNaming(logFile);
+
+ try
+ {
+ FilePermission perm =
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+
+ boolean writerAutoFlush =
+ config.isAutoFlush() && !config.isAsynchronous();
+
+ TextWriter currentWriter;
+ // Determine the writer we are using. If we were writing asyncronously,
+ // we need to modify the underlaying writer.
+ if(writer instanceof AsyncronousTextWriter)
+ {
+ currentWriter = ((AsyncronousTextWriter)writer).getWrappedWriter();
+ }
+ else
+ {
+ currentWriter = writer;
+ }
+
+ if(currentWriter instanceof MultifileTextWriter)
+ {
+ MultifileTextWriter mfWriter = (MultifileTextWriter)writer;
+
+ mfWriter.setNamingPolicy(fnPolicy);
+ mfWriter.setFilePermissions(perm);
+ mfWriter.setAppend(config.isAppend());
+ mfWriter.setAutoFlush(writerAutoFlush);
+ mfWriter.setBufferSize((int)config.getBufferSize());
+ mfWriter.setInterval(config.getTimeInterval());
+
+ mfWriter.removeAllRetentionPolicies();
+ mfWriter.removeAllRotationPolicies();
+
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy != null)
+ {
+ mfWriter.addRotationPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ mfWriter.addRetentionPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+ }
+ }
+
+
+ if(writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ {
+ // The asynronous setting is being turned off.
+ AsyncronousTextWriter asyncWriter = ((AsyncronousTextWriter)writer);
+ writer = mfWriter;
+ asyncWriter.shutdown(false);
+ }
+
+ if(!(writer instanceof AsyncronousTextWriter) &&
+ config.isAsynchronous())
+ {
+ // The asynronous setting is being turned on.
+ AsyncronousTextWriter asyncWriter =
+ new AsyncronousTextWriter("Asyncronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ mfWriter);
+ writer = asyncWriter;
+ }
+
+ if((currentConfig.isAsynchronous() && config.isAsynchronous()) &&
+ (currentConfig.getQueueSize() != config.getQueueSize()))
+ {
+ adminActionRequired = true;
+ }
+
+ currentConfig = config;
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void close()
+ {
+ writer.shutdown();
+
+ if(currentConfig != null)
+ {
+ currentConfig.removeFileBasedErrorChangeListener(this);
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void logError(ErrorLogCategory category,
+ ErrorLogSeverity severity, String message,
+ int errorID)
+ {
+ HashSet<ErrorLogSeverity> severities = definedSeverities.get(category);
+ if(severities == null)
+ {
+ severities = defaultSeverities;
+ }
+
+ if(severities.contains(severity))
+ {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("[");
+ sb.append(TimeThread.getLocalTime());
+ sb.append("] category=").append(category.getCategoryName()).
+ append(" severity=").append(severity.getSeverityName()).
+ append(" msgID=").append(String.valueOf(errorID)).
+ append(" msg=").append(message);
+
+ // FIXME - lookup the level based on the severity
+ writer.writeRecord(sb.toString());
+ }
+ }
+}
+
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextLogFormatter.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextLogFormatter.java
deleted file mode 100644
index 7f67b84..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextLogFormatter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-/**
- * A TextFormatter is used by a TextLogPublisher to convert log records into
- * text for publishing.
- */
-public interface TextLogFormatter
-{
- /**
- * Convert a log record to text.
- * @param record - the record to convert
- * @return a String containing the text representation of the
- * record.
- */
- public String format(LogRecord record);
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextLogPublisher.java
deleted file mode 100644
index e27012e..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextLogPublisher.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers;
-
-import org.opends.server.api.LogPublisher;
-
-/**
- * A TextLogPublisher publishes log records to a character-based output device,
- * such as the console or a file.
- */
-public class TextLogPublisher implements LogPublisher
-{
- private TextWriter writer;
- private TextLogFormatter formatter;
-
- /**
- * Create a new TextLogPublisher using the specified destination
- * and format.
- *
- * @param writer - the destination for text output
- * @param formatter - the formatting to use to convert records to text
- */
- public TextLogPublisher(TextWriter writer, TextLogFormatter formatter)
- {
- this.writer= writer;
- this.formatter= formatter;
- }
-
- /**
- * Publish the log record.
- *
- * @param record the log record to publish.
- * @param handler the error handler to use if an error occurs.
- */
- public synchronized void publish(LogRecord record,
- LoggerErrorHandler handler)
- {
- try
- {
- writer.writeRecord(formatter.format(record));
- }
- catch(Throwable t)
- {
- if(handler != null)
- {
- handler.handleError(record, t);
- }
- }
- }
-
- /**
- * Shutdown the publisher.
- */
- public void shutdown()
- {
- writer.shutdown();
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextWriter.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextWriter.java
index 73717e1..3f8396f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/TextWriter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/TextWriter.java
@@ -30,84 +30,113 @@
/**
* A TextWriter provides a character-based stream used by a
- * TextLogPublisher as a target for outputting log records.
- * Separating this from a LogPublisher implementation allows
- * better sharing of targets such as the console, since a
- * TextWriter imposes no format.
+ * Text Publishers as a target for outputting log records.
*/
-public class TextWriter
+public interface TextWriter
{
/**
- * A TextWriter which writes to standard out.
- */
- public static TextWriter STDOUT=
- new TextWriter(new PrintWriter(System.out, true), false);
- /**
- * A TextWriter which writes to standard error.
- */
- public static TextWriter STDERR=
- new TextWriter(new PrintWriter(System.err, true), false);
-
- /** The underlying output stream. */
- protected PrintWriter writer;
-
- /** Indicates whether we should close the stream on shutdown. */
- private boolean closable;
-
- /**
- * Create a new TextWriter for a specified writer.
- * On shutdown, the writer will be closed.
- *
- * @param writer - a character stream used for output.
- */
- public TextWriter(PrintWriter writer)
- {
- this(writer, true);
- }
-
- /**
- * Create a new TextWriter for a specified writer.
- * On shutdown, the writer will be closed if requested.
- *
- * @param writer - a character stream used for output.
- * @param closeOnShutdown - indicates whether the provided.
- * stream should be closed when shutdown is invoked.
- */
- public TextWriter(PrintWriter writer, boolean closeOnShutdown)
- {
- this.writer = writer;
- closable = closeOnShutdown;
- }
-
- /**
* Writes a text record to the output stream.
*
* @param record - the record to write.
*/
- public void writeRecord(String record)
- {
- writer.println(record);
- }
+ public void writeRecord(String record);
/**
* Flushes any buffered contents of the output stream.
*/
- public void flush()
- {
- writer.flush();
- }
+ public void flush();
/**
* Releases any resources held by the writer.
- * Unless <b>closeOnShutdown</b> was <b>false</b> when the writer
- * was constructed, the wrapped output stream will also be
- * closed.
*/
- public void shutdown()
+ public void shutdown();
+
+ /**
+ * Retrieves the number of bytes written by this writer.
+ *
+ * @return the number of bytes written by this writer.
+ */
+ public long getBytesWritten();
+
+ /**
+ * A TextWriter implementationwhich writes to standard out.
+ */
+ public static class STDOUT implements TextWriter
{
- // Close only if we were told to
- if (closable) {
+ private MeteredStream stream = new MeteredStream(System.out, 0);
+ private PrintWriter writer = new PrintWriter(stream, true);
+
+ /**
+ * {@inheritDoc}
+ */
+ public void writeRecord(String record)
+ {
+ writer.println(record);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void flush()
+ {
+ writer.flush();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void shutdown()
+ {
writer.close();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public long getBytesWritten()
+ {
+ return stream.written;
+ }
+ }
+
+ /**
+ * A TextWriter implementation which writes to standard error.
+ */
+ public static class STDERR implements TextWriter
+ {
+ private MeteredStream stream = new MeteredStream(System.err, 0);
+ private PrintWriter writer = new PrintWriter(stream, true);
+
+ /**
+ * {@inheritDoc}
+ */
+ public void writeRecord(String record)
+ {
+ writer.println(record);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void flush()
+ {
+ writer.flush();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void shutdown()
+ {
+ writer.close();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public long getBytesWritten()
+ {
+ return stream.written;
+ }
}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/ThreadFilterTextErrorLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/ThreadFilterTextErrorLogPublisher.java
new file mode 100644
index 0000000..9b3ee28
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/ThreadFilterTextErrorLogPublisher.java
@@ -0,0 +1,101 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers;
+
+import org.opends.server.types.ErrorLogCategory;
+import org.opends.server.types.ErrorLogSeverity;
+import org.opends.server.types.InitializationException;
+import org.opends.server.admin.std.server.ErrorLogPublisherCfg;
+import org.opends.server.config.ConfigException;
+import org.opends.server.api.ErrorLogPublisher;
+import org.opends.server.util.TimeThread;
+
+/**
+ * This class provides an implementation of an error logger where only messages
+ * generated by a specified thread is actually logged.
+ */
+public class ThreadFilterTextErrorLogPublisher
+ extends ErrorLogPublisher<ErrorLogPublisherCfg>
+{
+ private Thread thread;
+
+ private TextWriter writer;
+
+ /**
+ * Construct a new instance with the provided settings.
+ *
+ * @param thread The thread to log from.
+ * @param writer The writer used to write the messages.
+ */
+ public ThreadFilterTextErrorLogPublisher(Thread thread,
+ TextWriter writer)
+ {
+ this.thread = thread;
+ this.writer = writer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeErrorLogPublisher(ErrorLogPublisherCfg config)
+ throws ConfigException, InitializationException
+ {
+ // This class should only be used internally in the server and not be
+ // configurable via the admin framework.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void close()
+ {
+ writer.shutdown();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void logError(ErrorLogCategory category,
+ ErrorLogSeverity severity, String message,
+ int errorID)
+ {
+ Thread currentThread = Thread.currentThread();
+ if(this.thread.equals(currentThread) ||
+ this.thread.getThreadGroup().equals(currentThread.getThreadGroup()))
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[");
+ sb.append(TimeThread.getLocalTime());
+ sb.append("] category=").append(category.getCategoryName()).
+ append(" severity=").append(severity.getSeverityName()).
+ append(" msgID=").append(String.valueOf(errorID)).
+ append(" msg=").append(message);
+
+ this.writer.writeRecord(sb.toString());
+ }
+ }
+}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/TimeLimitRotationPolicy.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TimeLimitRotationPolicy.java
index 4b78509..7501deb 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/TimeLimitRotationPolicy.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/TimeLimitRotationPolicy.java
@@ -27,26 +27,58 @@
package org.opends.server.loggers;
import org.opends.server.util.TimeThread;
+import org.opends.server.admin.std.server.TimeLimitLogRotationPolicyCfg;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.ResultCode;
+
+import java.util.List;
+import java.util.ArrayList;
/**
* This class implements a fixed time based rotation policy.
* Rotation will happen N seconds since the last rotation.
*/
-public class TimeLimitRotationPolicy implements RotationPolicy
+public class TimeLimitRotationPolicy implements
+ RotationPolicy<TimeLimitLogRotationPolicyCfg>,
+ ConfigurationChangeListener<TimeLimitLogRotationPolicyCfg>
{
-
private long timeInterval = 0;
- private long lastModifiedTime = 0;
/**
- * Create the time based rotation policy.
- *
- * @param time The time interval between rotations.
+ * {@inheritDoc}
*/
- public TimeLimitRotationPolicy(long time)
+ public void initializeLogRotationPolicy(TimeLimitLogRotationPolicyCfg config)
{
- timeInterval = time;
- lastModifiedTime = TimeThread.getTime();
+ timeInterval = config.getRotationInterval();
+
+ config.addTimeLimitChangeListener(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ TimeLimitLogRotationPolicyCfg config, List<String> unacceptableReasons)
+ {
+ // Changes should always be OK
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ TimeLimitLogRotationPolicyCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ timeInterval = config.getRotationInterval();
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
}
@@ -54,24 +86,13 @@
* This method indicates if the log file should be
* rotated or not.
*
+ * @param writer The mutli file text writer written the log file.
* @return true if the file should be rotated, false otherwise.
*/
- public boolean rotateFile()
+ public boolean rotateFile(MultifileTextWriter writer)
{
long currTime = TimeThread.getTime();
- if (currTime - lastModifiedTime > timeInterval)
- {
- do
- {
- lastModifiedTime += timeInterval;
- }
- while (lastModifiedTime < currTime);
-
- // lastModifiedTime = currTime;
- return true;
- }
-
- return false;
+ return currTime - writer.getLastRotationTime() > timeInterval;
}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/TimeStampNaming.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/TimeStampNaming.java
index 43a8535..49f14f3 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/TimeStampNaming.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/TimeStampNaming.java
@@ -29,6 +29,7 @@
import org.opends.server.util.TimeThread;
import java.io.File;
+import java.io.FilenameFilter;
/**
* A file name policy that names files suffixed by the time it was created.
@@ -38,6 +39,32 @@
File file;
/**
+ * The FilenameFilter implementation for this naming policy to filter
+ * for all the files named by this policy.
+ */
+ private class TimeStampNamingFilter implements FilenameFilter
+ {
+ /**
+ * Select only files that are named by this policy.
+ *
+ * @param dir The directory to search.
+ * @param name The filename to which to apply the filter.
+ *
+ * @return <CODE>true</CODE> if the given filename matches the filter, or
+ * <CODE>false</CODE> if it does not.
+ */
+ public boolean accept(File dir, String name)
+ {
+ if(new File(dir, name).isDirectory())
+ {
+ return false;
+ }
+ name = name.toLowerCase();
+ return name.startsWith(file.getName().toLowerCase());
+ }
+ }
+
+ /**
* Create a new instance of the TimeStampNaming policy. Files will be created
* with the names in the prefix.utctime format.
*
@@ -47,10 +74,9 @@
{
this.file = file;
}
+
/**
- * Initializes the policy and returns the current name to use.
- *
- * @return the initial file.
+ * {@inheritDoc}
*/
public File getInitialName()
{
@@ -58,12 +84,28 @@
}
/**
- * Gets the next name to use.
- *
- * @return the next file.
+ * {@inheritDoc}
*/
public File getNextName()
{
return new File(file + "." + TimeThread.getGMTTime());
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public FilenameFilter getFilenameFilter()
+ {
+ return new TimeStampNamingFilter();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public File[] listFiles()
+ {
+ File directory = file.getParentFile();
+ return directory.listFiles(getFilenameFilter());
+ }
+
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugConfiguration.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugConfiguration.java
deleted file mode 100644
index cc51bc1..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugConfiguration.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers.debug;
-
-import org.opends.server.loggers.*;
-import org.opends.server.util.DynamicConstants;
-import org.opends.server.types.DebugLogLevel;
-
-import static org.opends.server.util.ServerConstants.PROPERTY_DEBUG_ENABLED;
-import static org.opends.server.util.ServerConstants.PROPERTY_DEBUG_TARGET;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-/**
- * A LoggingConfiguration for the debug logging system.
- */
-public class DebugConfiguration extends LoggerConfiguration
-{
- private static final String GLOBAL= "_global";
-
- private Map<String, TraceSettings> classTraceSettings;
- private Map<String, Map<String, TraceSettings>> methodTraceSettings;
-
- /**
- * Error handler for tracing. Tracing will be disabled
- * if too many errors occur.
- */
- private class DebugErrorHandler implements LoggerErrorHandler
- {
- private static final int ERROR_THRESHOLD= 10;
-
- private int _loggingErrors= 0;
-
- /**
- * Error handler for tracing. Tracing will be disabled
- * if too many errors occur.
- *
- * @param record the log record that caused the error to occur.
- * @param ex the exception thrown.
- */
- public synchronized void handleError(LogRecord record, Throwable ex)
- {
- _loggingErrors++;
-
- DebugLogFormatter formatter = new DebugLogFormatter();
- System.err.println("Error publishing record: " +
- formatter.format(record) + ex);
-
- // If we've had too many write errors, just turn off
- // tracing to prevent an overflow of messages.
- if (_loggingErrors >= ERROR_THRESHOLD) {
- System.err.println("TOO MANY ERRORS FROM DEBUG LOGGER. SHUTTING DOWN");
-
- enabled = false;
- }
- }
- }
-
- /**
- * Construct a default configuration where the logger is disabled and the
- * global scope will only log at the ERROR level.
- */
- public DebugConfiguration()
- {
- super(null);
- this.setErrorHandler(new DebugErrorHandler());
- classTraceSettings = null;
- methodTraceSettings = null;
-
- //Set the global settings so that only errors are logged.
- addTraceSettings(null, new TraceSettings(DebugLogLevel.ERROR));
- }
-
- /**
- * Gets the method trace levels for a specified class.
- * @param className - a fully qualified class name to get method trace
- * levels for
- * @return an unmodifiable map of trace levels keyed by method name. If
- * no method level tracing is configured for the scope, <b>null</b> is
- * returned.
- */
- public Map<String, TraceSettings> getMethodSettings(String className)
- {
- Map<String, TraceSettings> levels = null;
-
- if (enabled && methodTraceSettings != null) {
- // Method levels are always at leaves in the
- // hierarchy, so don't bother searching up.
- Map<String, TraceSettings> value= methodTraceSettings.get(className);
- if (value != null ) {
- levels= value;
- }
- }
- return levels != null ? Collections.unmodifiableMap(levels) : null;
- }
-
- /**
- * Get the trace settings for a specified class.
- * @param className - a fully qualified class name to get the
- * trace level for
- * @return the current trace settings for the class.
- */
- public TraceSettings getTraceSettings(String className)
- {
- TraceSettings settings = TraceSettings.DISABLED;
-
- // If we're not enabled, trace level is DISABLED.
- if (enabled && classTraceSettings != null) {
- // Find most specific trace setting which covers this
- // fully qualified class name
- // Search up the hierarchy for a match.
- String searchName= className;
- Object value= null;
- value= classTraceSettings.get(searchName);
- while (value == null && searchName != null) {
- int clipPoint= searchName.lastIndexOf('$');
- if (clipPoint == -1) clipPoint= searchName.lastIndexOf('.');
- if (clipPoint != -1) {
- searchName= searchName.substring(0, clipPoint);
- value= classTraceSettings.get(searchName);
- }
- else {
- searchName= null;
- }
- }
-
- // Use global settings, if nothing more specific was found.
- if (value == null) value= classTraceSettings.get(GLOBAL);
-
- if (value != null) {
- settings= (TraceSettings)value;
- }
- }
- return settings;
- }
-
- /**
- * Adds a trace settings to the current set for a specified scope. If a
- * scope is not specified, the settings will be set for the global scope.
- * The global scope settings are used when no other scope matches.
- *
- * @param scope - the scope to set trace settings for; this is a fully
- * qualified class name or null to set the trace settings for the global
- * scope.
- * @param settings - the trace settings for the scope
- */
- public void addTraceSettings(String scope, TraceSettings settings)
- {
- if (scope == null) {
- setClassSettings(GLOBAL, settings);
- }
- else {
- int methodPt= scope.lastIndexOf('#');
- if (methodPt != -1) {
- String methodName= scope.substring(methodPt+1);
- scope= scope.substring(0, methodPt);
- setMethodSettings(scope, methodName, settings);
- }
- else {
- setClassSettings(scope, settings);
- }
- }
- }
-
- private synchronized void setClassSettings(String className,
- TraceSettings settings)
- {
- if(classTraceSettings == null) classTraceSettings =
- new HashMap<String, TraceSettings>();
-
- classTraceSettings.put(className, settings);
- }
-
- private synchronized void setMethodSettings(String className,
- String methodName,
- TraceSettings settings)
- {
- if (methodTraceSettings == null) methodTraceSettings =
- new HashMap<String, Map<String, TraceSettings>>();
- Map<String, TraceSettings> methodLevels=
- methodTraceSettings.get(className);
- if (methodLevels == null) {
- methodLevels= new TreeMap<String, TraceSettings>();
- methodTraceSettings.put(className, methodLevels);
- }
-
- methodLevels.put(methodName, settings);
- }
-
- /**
- * Retrieve the initial configuration to use on debug logger startup. Settings
- * are read from system properties.
- * If this is not a debug build of OpenDS, the resulting configuration is
- * always disabled.
- *
- * @return the initial configuration to use for the debug logger.
- */
- public static DebugConfiguration getStartupConfiguration()
- {
-
- String enabledProp = System.getProperty(PROPERTY_DEBUG_ENABLED);
- if(DynamicConstants.WEAVE_ENABLED && (enabledProp != null &&
- (enabledProp.startsWith("T") || enabledProp.startsWith("t") ||
- enabledProp.startsWith("Y") || enabledProp.startsWith("y"))))
- {
- DebugConfiguration config = new DebugConfiguration();
- config.setEnabled(true);
-
- TextLogPublisher consolePublisher =
- new TextLogPublisher(TextWriter.STDOUT, new DebugLogFormatter());
- config.addPublisher(consolePublisher);
-
- Set<Map.Entry<Object, Object>> propertyEntries =
- System.getProperties().entrySet();
- for(Map.Entry<Object, Object> entry : propertyEntries)
- {
- if(((String)entry.getKey()).startsWith(PROPERTY_DEBUG_TARGET))
- {
- String value = (String)entry.getValue();
- int settingsStart= value.indexOf(":");
-
- //See if the scope and settings exists
- if(settingsStart > 0)
- {
- String scope = value.substring(0, settingsStart);
- TraceSettings settings =
- TraceSettings.parseTraceSettings(
- value.substring(settingsStart+1));
- if(settings != null)
- {
- config.addTraceSettings(scope, settings);
- }
- }
- }
- }
-
- return config;
- }
- else
- {
- //If it is not enabled or not a debug build, just return the default
- //off config.
- return new DebugConfiguration();
- }
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogFormatter.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogFormatter.java
deleted file mode 100644
index 13530dd..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogFormatter.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers.debug;
-
-import org.opends.server.loggers.TextLogFormatter;
-import org.opends.server.loggers.LogRecord;
-
-import java.util.Locale;
-import java.util.Map;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-/**
- * TraceFormatter defines the output format of trace messages.
- */
-public class DebugLogFormatter implements TextLogFormatter
-{
-
- private DateFormat _timestamper;
-
- /**
- * Construct a new DebugLogFormatter.
- */
- public DebugLogFormatter()
- {
- _timestamper= new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSS", Locale.US);
- }
-
- /**
- * Format the log record. Only DebugLogRecords will be formated correctly.
- *
- * @param record the record to format.
- * @return the recrod formated to a string.
- */
- public String format(LogRecord record)
- {
- StringBuffer buf = new StringBuffer();
- if(record != null && record instanceof DebugLogRecord)
- {
- DebugLogRecord dlr = (DebugLogRecord)record;
-
- // Emit the timestamp.
- buf.append(_timestamper.format(dlr.getTimestamp()));
- buf.append(" ");
-
- // Emit the seq num
- buf.append(dlr.getSequenceNumber());
- buf.append(" ");
-
- // Emit debug category.
- buf.append(dlr.getCategory());
- buf.append(" ");
-
- // Emit the debug level.
- buf.append(dlr.getLevel());
- buf.append(" ");
-
- // Emit thread info.
- buf.append("thread={");
- buf.append(dlr.getThreadName());
- buf.append("(");
- buf.append(dlr.getThreadID());
- buf.append(")} ");
-
- if(dlr.getThreadProperties() != null)
- {
- buf.append("threadDetail={");
- for(Map.Entry entry : dlr.getThreadProperties().entrySet())
- {
- buf.append(entry.getKey());
- buf.append("=");
- buf.append(entry.getValue());
- buf.append(" ");
- }
- buf.append("} ");
- }
-
- // Emit method info.
- buf.append("signature={");
- buf.append(dlr.getSignature());
- buf.append(" @ ");
- buf.append(dlr.getSourceLocation());
- buf.append("} ");
-
- // Emit message.
- buf.append(dlr.getMessage());
-
- // Emit Stack Trace.
- if(dlr.getStackTrace() != null)
- {
- buf.append("\nStack Trace:\n");
- buf.append(dlr.getStackTrace());
- }
-
- }
-
- return buf.toString();
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogRecord.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogRecord.java
deleted file mode 100644
index 69ce418..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogRecord.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-package org.opends.server.loggers.debug;
-
-import org.opends.server.loggers.LogRecord;
-import org.opends.server.loggers.LogCategory;
-import org.opends.server.loggers.LogLevel;
-import org.opends.server.loggers.Logger;
-import org.opends.server.types.DebugLogLevel;
-import org.opends.server.types.DebugLogCategory;
-
-import java.util.Date;
-import java.util.Map;
-
-/**
- * A DebugLogRecord is reponsible for passing tracing log messages from the
- * individual Loggers to the LogPublishers.
- */
-public class DebugLogRecord extends LogRecord
-{
- private static long globalSequenceNumber;
-
- /**
- * The category of this record.
- */
- private LogCategory category;
-
- /**
- * The level of this record.
- */
- private LogLevel level;
-
- /**
- * Sequence number.
- */
- private long sequenceNumber;
-
- /**
- * Thread name for thread that issued logging call.
- */
- private String threadName;
-
- /**
- * Thread ID for thread that issued logging call.
- */
- private long threadID;
-
- /**
- * Detailed debug properties for thread that issued logging call.
- */
- private Map<String, String> threadProperties;
-
- /**
- * Event time in milliseconds since 1970.
- */
- private Date timestamp;
-
- /**
- * The signature signature.
- */
- private String signature;
-
- /**
- * The arguments objects.
- */
- private Object[] arguments;
-
- /**
- * The source location.
- */
- private String sourceLocation;
-
- /**
- * The stack trace.
- */
- private String stackTrace;
-
- /**
- * Construct a DebugLogRecord with the given values(s).
- * <p>
- * The sequence property will be initialized with a new unique value.
- * These sequence values are allocated in increasing order within a VM.
- * <p>
- * The timestamp property will be initialized to the current time.
- * <p>
- * The thread ID property will be initialized with a unique ID for
- * the current thread.
- * <p>
- * All other properties will be initialized to "null".
- *
- * @param category the category of this logging message.
- * @param level the level of this logging message.
- * @param msg the raw non-localized logging message (may be null).
- */
- public DebugLogRecord(DebugLogCategory category,
- DebugLogLevel level,
- String msg)
- {
- super(msg);
- this.category = category;
- this.level = level;
- }
-
- /**
- * Construct a DebugLogRecord with the given values(s).
- * <p>
- * The sequence property will be initialized with a new unique value.
- * These sequence values are allocated in increasing order within a VM.
- * <p>
- * The timestamp property will be initialized to the current time.
- * <p>
- * The thread ID property will be initialized with a unique ID for
- * the current thread.
- * <p>
- * All other properties will be initialized to "null".
- *
- * @param category the category of this logging message.
- * @param level the level of this logging message.
- * @param logger the source logger (may be null).
- * @param msg the raw non-localized logging message (may be null).
- */
- public DebugLogRecord(DebugLogCategory category,
- DebugLogLevel level,
- Logger logger,
- String msg)
- {
- super(logger, msg);
- this.category = category;
- this.level = level;
- }
-
- /**
- * Construct a DebugLogRecord with the given values(s).
- * <p>
- * The sequence property will be initialized with a new unique value.
- * These sequence values are allocated in increasing order within a VM.
- * <p>
- * The timestamp property will be initialized to the current time.
- * <p>
- * The thread ID property will be initialized with a unique ID for
- * the current thread.
- * <p>
- * All other properties will be initialized to "null".
- *
- * @param category the category of this logging message.
- * @param level the level of this logging message.
- * @param caller the source object (may be null).
- * @param logger the source logger (may be null).
- * @param msg the raw non-localized logging message (may be null).
- */
- public DebugLogRecord(LogCategory category,
- LogLevel level,
- Object caller,
- Logger logger,
- String msg)
- {
- super(caller, logger, msg);
- this.category = category;
- this.level = level;
-
- // Assign a thread ID, name, and a unique sequence number.
- Thread thread= Thread.currentThread();
- threadID = thread.getId();
- threadName = thread.getName();
- sequenceNumber = globalSequenceNumber++;
- timestamp = new Date();
- }
-
- /**
- * Get an identifier for the thread where the message originated.
- * <p>
- * This is a thread identifier within the Java VM and may or
- * may not map to any operating system ID.
- *
- * @return thread ID
- */
- public long getThreadID() {
- return threadID;
- }
-
- /**
- * Set an identifier for the thread where the message originated.
- * @param threadID the thread ID
- */
- public void setThreadID(long threadID) {
- this.threadID = threadID;
- }
-
- /**
- * Get event time in milliseconds since 1970.
- *
- * @return event time in timestamp since 1970
- */
- public Date getTimestamp() {
- return timestamp;
- }
-
- /**
- * Set event time.
- *
- * @param timestamp event time in timestamp since 1970
- */
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- /**
- * Get the category of this message.
- *
- * @return the log category.
- */
- public LogCategory getCategory()
- {
- return category;
- }
-
- /**
- * Set the category of this message.
- *
- * @param category the log category to set.
- */
- public void setCategory(LogCategory category)
- {
- this.category = category;
- }
-
- /**
- * Get the level of this message.
- *
- * @return the log level.
- */
- public LogLevel getLevel()
- {
- return level;
- }
-
- /**
- * Set the level of this message.
- *
- * @param level the log level to set.
- */
- public void setLevel(LogLevel level)
- {
- this.level = level;
- }
-
- /**
- * Get the thread name that generated this message.
- *
- * @return the thread name.
- */
- public String getThreadName()
- {
- return threadName;
- }
-
- /**
- * Set the thread name that genreated this message.
- *
- * @param threadName the thread name to set.
- */
- public void setThreadName(String threadName)
- {
- this.threadName = threadName;
- }
-
- /**
- * Get the method signature of this message.
- *
- * @return the method signature.
- */
- public String getSignature()
- {
- return signature;
- }
-
- /**
- * Set the method signature of this message.
- *
- * @param signature the method signature to set.
- */
- public void setSignature(String signature)
- {
- this.signature = signature;
- }
-
- /**
- * Get the arguments of this message. Usually the paramter values of a method.
- *
- * @return the arguments.
- */
- public Object[] getArguments()
- {
- return arguments;
- }
-
- /**
- * Set the arguments of this message.
- *
- * @param arguments the arguments to set.
- */
- public void setArguments(Object[] arguments)
- {
- this.arguments = arguments;
- }
-
- /**
- * Get the source location where this message is generated in the format
- * filename:linenumber.
- *
- * @return the source location.
- */
- public String getSourceLocation()
- {
- return sourceLocation;
- }
-
- /**
- * Set the source location where this message is generated.
- *
- * @param sourceLocation the source location string to set.
- */
- public void setSourceLocation(String sourceLocation)
- {
- this.sourceLocation = sourceLocation;
- }
-
- /**
- * Get the strack trace at the point this message is generated.
- *
- * @return the stack trace string.
- */
- public String getStackTrace()
- {
- return stackTrace;
- }
-
- /**
- * Set the stack trace at the point this message is generated.
- *
- * @param stackTrace the stack trace string to set.
- */
- public void setStackTrace(String stackTrace)
- {
- this.stackTrace = stackTrace;
- }
-
- /**
- * Get the sequence number.
- * <p>
- * Sequence numbers are normally assigned in the LogRecord
- * constructor, which assigns unique sequence numbers to
- * each new LogRecord in increasing order.
- *
- * @return the sequence number
- */
- public long getSequenceNumber() {
- return sequenceNumber;
- }
-
- /**
- * Set the sequence number.
- * <p>
- * Sequence numbers are normally assigned in the LogRecord constructor,
- * so it should not normally be necessary to use this signature.
- *
- * @param seq sequence number
- */
- public void setSequenceNumber(long seq) {
- sequenceNumber = seq;
- }
-
- /**
- * Set the thread properties.
- *
- * @param threadProperties the thread properties map to set.
- */
- public void setThreadProperties(Map<String, String> threadProperties)
- {
- this.threadProperties = threadProperties;
- }
-
- /**
- * Retrives the thread properties.
- *
- * @return the thread properties.
- */
- public Map<String, String> getThreadProperties()
- {
- return threadProperties;
- }
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java
index f00b353..2c203a9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java
@@ -22,22 +22,38 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ * Portions Copyright 2007 Sun Microsystems, Inc.
*/
+
package org.opends.server.loggers.debug;
-import org.opends.server.api.ProtocolElement;
-import org.opends.server.loggers.Logger;
-import org.opends.server.loggers.LogLevel;
-
-import java.util.Map;
-import java.util.HashMap;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
import java.nio.ByteBuffer;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
-import com.sleepycat.je.OperationStatus;
-import com.sleepycat.je.Database;
-import com.sleepycat.je.Transaction;
-import com.sleepycat.je.DatabaseEntry;
+import org.opends.server.api.ProtocolElement;
+import org.opends.server.api.DebugLogPublisher;
+import org.opends.server.loggers.*;
+import org.opends.server.types.*;
+import org.opends.server.util.DynamicConstants;
+import org.opends.server.util.StaticUtils;
+import org.opends.server.admin.std.server.DebugLogPublisherCfg;
+import org.opends.server.admin.std.meta.DebugLogPublisherCfgDefn;
+import org.opends.server.admin.server.ConfigurationAddListener;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.server.ConfigurationDeleteListener;
+import org.opends.server.admin.ClassPropertyDefinition;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.DirectoryServer;
+
+import static org.opends.server.messages.MessageHandler.getMessage;
+import static org.opends.server.messages.ConfigMessages.*;
+import static org.opends.server.util.StaticUtils.*;
+
+import com.sleepycat.je.*;
/**
* A logger for debug and trace logging. DebugLogger provides a debugging
@@ -51,85 +67,446 @@
*
* DebugLogger is self-initializing.
*/
-public class DebugLogger extends Logger
+public class DebugLogger implements
+ ConfigurationAddListener<DebugLogPublisherCfg>,
+ ConfigurationDeleteListener<DebugLogPublisherCfg>,
+ ConfigurationChangeListener<DebugLogPublisherCfg>
{
- private static DebugLogger logger = null;
- static boolean staticEnabled = false;
+ //The default level to log constructor exectuions.
+ static final LogLevel DEFAULT_CONSTRUCTOR_LEVEL =
+ DebugLogLevel.VERBOSE;
+ //The default level to log method entry and exit pointcuts.
+ static final LogLevel DEFAULT_ENTRY_EXIT_LEVEL =
+ DebugLogLevel.VERBOSE;
+ //The default level to log method entry and exit pointcuts.
+ static final LogLevel DEFAULT_THROWN_LEVEL =
+ DebugLogLevel.ERROR;
- private Map<String, Tracer> classTracers;
+ // The set of all DebugTracer aspect instances.
+ static CopyOnWriteArraySet<DebugTracer> classTracers =
+ new CopyOnWriteArraySet<DebugTracer>();
- private DebugConfiguration configuration;
+ // The set of debug loggers that have been registered with the server. It
+ // will initially be empty.
+ static ConcurrentHashMap<DN,
+ DebugLogPublisher> debugPublishers =
+ new ConcurrentHashMap<DN,
+ DebugLogPublisher>();
- private DebugLogger(DebugConfiguration config)
+ // Trace methods will use this static boolean to determine if debug is
+ // enabled so to not incur the cost of calling debugPublishers.isEmtpty().
+ static boolean enabled = false;
+
+ // The singleton instance of this class for configuration purposes.
+ static final DebugLogger instance = new DebugLogger();
+
+ static
{
- super(config);
- configuration = config;
- classTracers = new HashMap<String, Tracer>();
- staticEnabled = enabled;
+ // Install the startup publishers if necessary until the config kicks in and
+ // adds the real publishers.
+
+ if(DynamicConstants.WEAVE_ENABLED)
+ {
+ try
+ {
+ TextDebugLogPublisher startupDebugPublisher =
+ TextDebugLogPublisher.getStartupTextDebugPublisher(
+ new TextWriter.STDOUT());
+
+ debugPublishers.put(DN.NULL_DN,
+ startupDebugPublisher);
+ enabled = true;
+
+ // Update all existing aspect instances
+ addTracerSettings(startupDebugPublisher);
+ }
+ catch(Exception e)
+ {
+ System.err.println("Error installing the startup debug logger: " +
+ StaticUtils.stackTraceToSingleLineString(e));
+ }
+ }
}
+ /**
+ * Add an debug log publisher to the debug logger.
+ *
+ * @param dn The DN of the configuration entry for the publisher.
+ * @param publisher The error log publisher to add.
+ */
+ public synchronized static void addDebugLogPublisher(DN dn,
+ DebugLogPublisher publisher)
+ {
+ debugPublishers.put(dn, publisher);
+ enabled = DynamicConstants.WEAVE_ENABLED;
+ }
/**
- * Obtain the trace logger singleton.
- * @return the trace logger singleton.
+ * Remove an debug log publisher from the debug logger.
+ *
+ * @param dn The DN of the publisher to remove.
+ * @return The publisher that was removed or null if it was not found.
*/
- public static synchronized DebugLogger getLogger()
+ public synchronized static DebugLogPublisher removeDebugLogPublisher(DN dn)
{
- if (logger == null) {
- /**
- * The debug logger is being intialized for the first time.
- * Bootstrap the debug logger when the server first starts up so
- * all debug messages are log from the first initialization of a
- * server class.
- */
- logger= new DebugLogger(DebugConfiguration.getStartupConfiguration());
+ DebugLogPublisher removed = debugPublishers.remove(dn);
+
+ if(removed != null)
+ {
+ removed.close();
}
- return logger;
+ if(debugPublishers.isEmpty())
+ {
+ enabled = false;
+ }
+
+ return removed;
}
/**
- * Obtain the status of this logger singleton.
+ * Removes all existing debug log publishers from the logger.
+ */
+ public synchronized static void removeAllDebugLogPublishers()
+ {
+ for(DebugLogPublisher publisher : debugPublishers.values())
+ {
+ publisher.close();
+ }
+
+ debugPublishers.clear();
+
+ enabled = false;
+ }
+
+ /**
+ * Initializes all the debug log publishers.
*
- * @return the status of this logger.
+ * @param configs The debug log publisher configurations.
+ * @throws ConfigException
+ * If an unrecoverable problem arises in the process of
+ * performing the initialization as a result of the server
+ * configuration.
+ * @throws InitializationException
+ * If a problem occurs during initialization that is not
+ * related to the server configuration.
+ */
+ public void initializeDebugLogger(List<DebugLogPublisherCfg> configs)
+ throws ConfigException, InitializationException
+ {
+ for(DebugLogPublisherCfg config : configs)
+ {
+ config.addDebugChangeListener(this);
+
+ if(config.isEnabled())
+ {
+ DebugLogPublisher debugLogPublisher = getDebugPublisher(config);
+
+ addDebugLogPublisher(config.dn(), debugLogPublisher);
+
+ // Update all existing aspect instances
+ addTracerSettings(debugLogPublisher);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationAddAcceptable(DebugLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ return !config.isEnabled() ||
+ isJavaClassAcceptable(config, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(DebugLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ return !config.isEnabled() ||
+ isJavaClassAcceptable(config, unacceptableReasons);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationAdd(DebugLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ config.addDebugChangeListener(this);
+
+ if(config.isEnabled())
+ {
+ try
+ {
+ DebugLogPublisher debugLogPublisher =
+ getDebugPublisher(config);
+
+ addDebugLogPublisher(config.dn(), debugLogPublisher);
+
+ addTracerSettings(debugLogPublisher);
+ }
+ catch(ConfigException e)
+ {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ messages.add(e.getMessage());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+ catch (Exception e)
+ {
+ if (debugEnabled())
+ {
+ debugCaught(DebugLogLevel.ERROR, e);
+ }
+ int msgID = MSGID_CONFIG_LOGGER_CANNOT_CREATE_LOGGER;
+ messages.add(getMessage(msgID, String.valueOf(config.dn().toString()),
+ stackTraceToSingleLineString(e)));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ }
+ }
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ DebugLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ DN dn = config.dn();
+ DebugLogPublisher debugLogPublisher = debugPublishers.get(dn);
+
+ if(debugLogPublisher == null)
+ {
+ if(config.isEnabled())
+ {
+ // Needs to be added and enabled.
+ return applyConfigurationAdd(config);
+ }
+ }
+ else
+ {
+ if(config.isEnabled())
+ {
+ // The publisher is currently active, so we don't need to do anything.
+ // Changes to the class name cannot be
+ // applied dynamically, so if the class name did change then
+ // indicate that administrative action is required for that
+ // change to take effect.
+ String className = config.getJavaImplementationClass();
+ if(!className.equals(debugLogPublisher.getClass().getName()))
+ {
+ adminActionRequired = true;
+ }
+ }
+ else
+ {
+ // The publisher is being disabled so shut down and remove.
+ removeTracerSettings(debugLogPublisher);
+ removeDebugLogPublisher(config.dn());
+ }
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationDeleteAcceptable(DebugLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ DN dn = config.dn();
+ DebugLogPublisher debugLogPublisher = debugPublishers.get(dn);
+ return debugLogPublisher != null;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult
+ applyConfigurationDelete(DebugLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+
+ DebugLogPublisher publisher = removeDebugLogPublisher(config.dn());
+ if(publisher != null)
+ {
+ removeTracerSettings(publisher);
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired);
+ }
+
+ private boolean isJavaClassAcceptable(DebugLogPublisherCfg config,
+ List<String> unacceptableReasons)
+ {
+ String className = config.getJavaImplementationClass();
+ DebugLogPublisherCfgDefn d = DebugLogPublisherCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a DebugLogPublisher.
+ Class<? extends DebugLogPublisher> theClass;
+ try {
+ theClass = pd.loadClass(className, DebugLogPublisher.class);
+ theClass.newInstance();
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_DEBUG_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // Check that the implementation class implements the correct interface.
+ try {
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ theClass.getMethod("initializeDebugLogPublisher", config.definition()
+ .getServerConfigurationClass());
+ } catch (Exception e) {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_DEBUG_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+ // The class is valid as far as we can tell.
+ return true;
+ }
+
+ private DebugLogPublisher getDebugPublisher(DebugLogPublisherCfg config)
+ throws ConfigException {
+ String className = config.getJavaImplementationClass();
+ DebugLogPublisherCfgDefn d = DebugLogPublisherCfgDefn.getInstance();
+ ClassPropertyDefinition pd =
+ d.getJavaImplementationClassPropertyDefinition();
+ // Load the class and cast it to a DebugLogPublisher.
+ Class<? extends DebugLogPublisher> theClass;
+ DebugLogPublisher debugLogPublisher;
+ try {
+ theClass = pd.loadClass(className, DebugLogPublisher.class);
+ debugLogPublisher = theClass.newInstance();
+
+ // Determine the initialization method to use: it must take a
+ // single parameter which is the exact type of the configuration
+ // object.
+ Method method = theClass.getMethod("initializeDebugLogPublisher",
+ config.definition().getServerConfigurationClass());
+ method.invoke(debugLogPublisher, config);
+ }
+ catch (InvocationTargetException ite)
+ {
+ // Rethrow the exceptions thrown be the invoked method.
+ Throwable e = ite.getTargetException();
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_DEBUG_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ throw new ConfigException(msgID, message, e);
+ }
+ catch (Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_DEBUG_LOGGER_CLASS;
+ String message = getMessage(msgID, className,
+ config.dn().toString(),
+ String.valueOf(e));
+ throw new ConfigException(msgID, message, e);
+ }
+
+ // The debug publisher has been successfully initialized.
+ return debugLogPublisher;
+ }
+
+ /**
+ * Adds the settings for the provided publisher in all existing tracers.
+ * If existing settings exist for the given publisher, it will be updated
+ * with the new settings.
+ *
+ * @param publisher The debug log publisher with the new settings.
+ */
+ @SuppressWarnings("unchecked")
+ public static void addTracerSettings(DebugLogPublisher publisher)
+ {
+ // Make sure this publisher is still registered with us. If not, don't
+ // use its settings.
+ if(debugPublishers.contains(publisher))
+ {
+ for(DebugTracer tracer : classTracers)
+ {
+ tracer.classSettings.put(publisher,
+ publisher.getClassSettings(tracer.className));
+
+ // For some reason, the compiler doesn't see that
+ // debugLogPublihser.getMethodSettings returns a parameterized Map.
+ // This problem goes away if a parameterized verson of
+ // DebugLogPublisher is used. However, we can't not use reflection to
+ // instantiate a generic
+ // DebugLogPublisher<? extends DebugLogPublisherCfg> type. The only
+ // thing we can do is to just suppress the compiler warnings.
+ Map<String, TraceSettings> methodSettings =
+ publisher.getMethodSettings(tracer.className);
+ if(methodSettings != null)
+ {
+ tracer.methodSettings.put(publisher, methodSettings);
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes the settings for the provided publisher in all existing tracers.
+ *
+ * @param publisher The debug log publisher to remove.
+ */
+ public static void removeTracerSettings(DebugLogPublisher publisher)
+ {
+ for(DebugTracer tracer : classTracers)
+ {
+ tracer.classSettings.remove(publisher);
+ tracer.methodSettings.remove(publisher);
+ }
+ }
+
+
+ /**
+ * Indicates if debug logging is enabled.
+ *
+ * @return True if debug logging is enabled. False otherwise.
*/
public static boolean debugEnabled()
{
- return staticEnabled;
+ return enabled;
}
/**
- * Register a trace logger for the specified class.
- * @param className - the class for which to register the tracer under.
- * @param tracer - the tracer object to register.
- */
- public synchronized void registerTracer(String className,
- Tracer tracer)
- {
- Tracer traceLogger = classTracers.get(className);
- if (traceLogger == null) {
- classTracers.put(className, tracer);
- tracer.updateSettings(this.configuration);
- }
- }
-
- /**
- * Update the tracing configuration of the debug logger with the specified
- * trace configuration.
+ * Retrieve the singleton instance of this class.
*
- * @param config the new configuration to apply.
+ * @return The singleton instance of this logger.
*/
- public synchronized void updateConfiguration(DebugConfiguration config)
+ public static DebugLogger getInstance()
{
- super.updateConfiguration(config);
- staticEnabled = enabled;
-
- for(Tracer tracer : classTracers.values())
- {
- tracer.updateSettings(config);
- }
-
- this.configuration = config;
+ return instance;
}
/**
@@ -305,5 +682,28 @@
ProtocolElement element) {}
+ /**
+ * Classes and methods annotated with @NoDebugTracing will not be weaved with
+ * debug logging statements by AspectJ.
+ */
+ public @interface NoDebugTracing {}
+
+ /**
+ * Methods annotated with @NoEntryDebugTracing will not be weaved with
+ * entry debug logging statements by AspectJ.
+ */
+ public @interface NoEntryDebugTracing {}
+
+ /**
+ * Methods annotated with @NoExitDebugTracing will not be weaved with
+ * exit debug logging statements by AspectJ.
+ */
+ public @interface NoExitDebugTracing {}
+
+ /**
+ * Methods annotated with @TraceThrown will be weaved by AspectJ with
+ * debug logging statements when an exception is thrown from the method.
+ */
+ public @interface TraceThrown {}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugMessageFormatter.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugMessageFormatter.java
index 41ff2f6..e85a3f1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugMessageFormatter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugMessageFormatter.java
@@ -36,20 +36,13 @@
public class DebugMessageFormatter
{
/**
- * Construct a new debug message formatter.
- */
- public DebugMessageFormatter() {
- //no implementation needed.
- }
-
- /**
* Format the message format string with the provided arguments.
*
* @param msg the message format string to be formatted.
* @param msgArgs the arguments to use when replacing tokens in the message.
* @return the formatted message string.
*/
- public String format(String msg, Object[] msgArgs)
+ public static String format(String msg, Object[] msgArgs)
{
StringBuilder buffer= new StringBuilder();
Object[] decoratedArgs = decorateMessageArgs(msgArgs);
@@ -74,14 +67,14 @@
}
}
- private void concatenateArgs(Object[] args, StringBuilder buffer)
+ private static void concatenateArgs(Object[] args, StringBuilder buffer)
{
for (int i = 0; (args != null) && (i < args.length); i++) {
buffer.append(" ").append(args[i]);
}
}
- private Object[] decorateMessageArgs(Object[] undecoratedArgs)
+ private static Object[] decorateMessageArgs(Object[] undecoratedArgs)
{
Object[] args= null;
if (undecoratedArgs != null) {
@@ -94,7 +87,7 @@
return args;
}
- private Object decorateArg(Object arg)
+ private static Object decorateArg(Object arg)
{
Object decoratedArg= arg;
@@ -132,12 +125,12 @@
return decoratedArg;
}
- private String decorateArrayArg(Object[] array)
+ private static String decorateArrayArg(Object[] array)
{
return decorateListArg(Arrays.asList(array));
}
- private String decorateArrayArg(boolean[] array)
+ private static String decorateArrayArg(boolean[] array)
{
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
@@ -151,7 +144,7 @@
return buffer.toString();
}
- private String decorateArrayArg(byte[] array)
+ private static String decorateArrayArg(byte[] array)
{
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
@@ -165,7 +158,7 @@
return buffer.toString();
}
- private String decorateArrayArg(char[] array)
+ private static String decorateArrayArg(char[] array)
{
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
@@ -179,7 +172,7 @@
return buffer.toString();
}
- private String decorateArrayArg(double[] array)
+ private static String decorateArrayArg(double[] array)
{
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
@@ -193,7 +186,7 @@
return buffer.toString();
}
- private String decorateArrayArg(float[] array)
+ private static String decorateArrayArg(float[] array)
{
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
@@ -207,7 +200,7 @@
return buffer.toString();
}
- private String decorateArrayArg(int[] array)
+ private static String decorateArrayArg(int[] array)
{
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
@@ -221,7 +214,7 @@
return buffer.toString();
}
- private String decorateArrayArg(long[] array)
+ private static String decorateArrayArg(long[] array)
{
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
@@ -235,7 +228,7 @@
return buffer.toString();
}
- private String decorateListArg(List list)
+ private static String decorateListArg(List list)
{
StringBuilder buffer= new StringBuilder();
Iterator iter= list.iterator();
@@ -252,7 +245,7 @@
return buffer.toString();
}
- private String decorateMapArg(Map map)
+ private static String decorateMapArg(Map map)
{
StringBuilder buffer= new StringBuilder();
Iterator iter= map.entrySet().iterator();
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
index 8204e19..f8b85b4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
@@ -26,6 +26,8 @@
*/
package org.opends.server.loggers.debug;
+import static org.opends.server.util.ServerConstants.EOL;
+
/**
* A DebugStackTraceFormatter converts an exception's stack trace into
* a String appropriate for tracing, optionally performing filtering
@@ -50,10 +52,11 @@
/**
* Filters out all undesired stack frames from the given Throwable's
* stack trace.
- * @param t - the Throwable for which a stack trace is being generated.
+ * @param frames the frames to filter
* @return an array of StackTraceElements to be used in formatting.
*/
- public StackTraceElement[] getFilteredStackTrace(Throwable t);
+ public StackTraceElement[] getFilteredStackTrace(
+ StackTraceElement[] frames);
}
/**
@@ -78,12 +81,12 @@
* Return the stack trace of an exception with debug and trailing non
* OpenDS frames filtered out.
*
- * @param t the throwable to filter.
+ * @param frames the frames to filter
* @return the filtered stack trace.
*/
- public StackTraceElement[] getFilteredStackTrace(Throwable t)
+ public StackTraceElement[] getFilteredStackTrace(
+ StackTraceElement[] frames)
{
- StackTraceElement[] frames= t.getStackTrace();
StackTraceElement[] trimmedStack= null;
if (frames != null && frames.length > 0) {
int firstFrame= 0;
@@ -141,23 +144,29 @@
while(t != null)
{
- StackTraceElement[] frames= filter != null ?
- filter.getFilteredStackTrace(t) : t.getStackTrace();
+ StackTraceElement[] frames = t.getStackTrace();
+ if(filter != null)
+ {
+ frames = filter.getFilteredStackTrace(frames);
+ }
+
if (frames != null) {
int frameLimit= Math.min(maxDepth, frames.length);
if (frameLimit > 0) {
for (int i= 0; i < frameLimit; i++) {
+ buffer.append(" ");
buffer.append(frames[i]);
- buffer.append(" / ");
+ buffer.append(EOL);
}
if(frameLimit < frames.length)
{
- buffer.append("...(");
+ buffer.append(" ...(");
buffer.append(frames.length - frameLimit);
buffer.append(" more)");
+ buffer.append(EOL);
}
}
}
@@ -165,7 +174,7 @@
if(includeCause && t.getCause() != null)
{
t = t.getCause();
- buffer.append("; caused by ");
+ buffer.append(" caused by ");
}
else
{
@@ -175,4 +184,47 @@
return buffer.toString();
}
+
+ /**
+ * Generate a String representation of the possibly filtered stack trace
+ * from the current position in executation.
+ * @param filter - a FrameFilter to use to exclude some stack frames from
+ * the trace. If null, no filtering is performed.
+ * @param maxDepth - the maximum number of stack frames to include in the
+ * trace.
+ * @return the stack trace.
+ */
+ public static String formatStackTrace(FrameFilter filter, int maxDepth)
+ {
+ StringBuffer buffer= new StringBuffer();
+
+ StackTraceElement[] frames = Thread.currentThread().getStackTrace();
+ if(filter != null)
+ {
+ frames = filter.getFilteredStackTrace(frames);
+ }
+
+ if (frames != null) {
+ int frameLimit= Math.min(maxDepth, frames.length);
+ if (frameLimit > 0) {
+
+
+ for (int i= 0; i < frameLimit; i++) {
+ buffer.append(" ");
+ buffer.append(frames[i]);
+ buffer.append(EOL);
+ }
+
+ if(frameLimit < frames.length)
+ {
+ buffer.append(" ...(");
+ buffer.append(frames.length - frameLimit);
+ buffer.append(" more)");
+ buffer.append(EOL);
+ }
+ }
+ }
+
+ return buffer.toString();
+ }
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugTracer.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugTracer.java
new file mode 100644
index 0000000..6d6339d
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugTracer.java
@@ -0,0 +1,1049 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers.debug;
+
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.JoinPoint;
+import org.opends.server.api.DebugLogPublisher;
+import org.opends.server.api.ProtocolElement;
+import org.opends.server.types.DebugLogCategory;
+import org.opends.server.types.DebugLogLevel;
+import org.opends.server.loggers.LogLevel;
+import org.opends.server.loggers.LogCategory;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.nio.ByteBuffer;
+
+import com.sleepycat.je.OperationStatus;
+import com.sleepycat.je.Database;
+import com.sleepycat.je.Transaction;
+import com.sleepycat.je.DatabaseEntry;
+
+import static
+ org.opends.server.loggers.debug.DebugLogger.DEFAULT_CONSTRUCTOR_LEVEL;
+import static
+ org.opends.server.loggers.debug.DebugLogger.DEFAULT_ENTRY_EXIT_LEVEL;
+import static
+ org.opends.server.loggers.debug.DebugLogger.DEFAULT_THROWN_LEVEL;
+import static
+ org.opends.server.loggers.debug.DebugLogger.debugPublishers;
+import static
+ org.opends.server.loggers.debug.DebugLogger.classTracers;
+
+/**
+ * An aspect for source-code tracing at the method level.
+ *
+ * One DebugLogger aspect instance exists for each Java class using tracing.
+ * Tracer must be registered with the DebugLogger.
+ *
+ * Logging is always done at a level basis, with debug log messages
+ * exceeding the trace threshold being traced, others being discarded.
+ */
+@Aspect("pertypewithin(!@DebugLogger.NoDebugTracing org.opends.server..*+ && " +
+ "!org.opends.server.loggers.*+ && " +
+ "!org.opends.server.loggers.debug..*+ &&" +
+ "!org.opends.server.types.DebugLogLevel+ && " +
+ "!org.opends.server.types.DebugLogCategory+ && " +
+ "!org.opends.server.api.DebugLogPublisher+ &&" +
+ "!org.opends.server.util.TimeThread+)")
+public class DebugTracer
+{
+ /**
+ * Pointcut for matching static context events.
+ */
+ @Pointcut("!this(Object)")
+ private void staticContext()
+ {
+ }
+
+ /**
+ * Pointcut for matching non static context events.
+ * @param obj The object being operated on.
+ */
+ @Pointcut("this(obj)")
+ private void nonStaticContext(Object obj)
+ {
+ }
+
+ /**
+ * Pointcut for matching all toString() methods.
+ */
+ @Pointcut("execution(* *..toString(..))")
+ private void toStringMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching all getMessage() methods.
+ */
+ @Pointcut("execution(String org.opends.server." +
+ "messages.MessageHandler.getMessage(..))")
+ private void getMessageMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching all getDebugProperties() methods.
+ * TODO: Make this less general. Find out if pointcut matches
+ * subclass methods.
+ */
+ @Pointcut("execution(* *..getDebugProperties(..))")
+ private void getDebugPropertiesMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugMessage() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugMessage(..))")
+ private void logMessageMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugVerbose() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugVerbose(..))")
+ private void logVerboseMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugInfo() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugInfo(..))")
+ private void logInfoMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugWarning() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugWarning(..))")
+ private void logWarningMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugError() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugError(..))")
+ private void logErrorMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugThrown() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugThrown(..))")
+ private void logThrownMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugCaught() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugCaught(..))")
+ private void logCaughtMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugJEAccess() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugJEAccess(..))")
+ private void logJEAccessMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugData() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugData(..))")
+ private void logDataMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching debugProtocolElement() methods.
+ */
+ @Pointcut("call(public static void org.opends.server." +
+ "loggers.debug.DebugLogger.debugProtocolElement(..))")
+ private void logProtocolElementMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching all debug logging methods.
+ */
+ @Pointcut("logMessageMethod() || logVerboseMethod() || logInfoMethod() || " +
+ "logWarningMethod() || logErrorMethod() || logCaughtMethod() || " +
+ "logJEAccessMethod() || logDataMethod() || logProtocolElementMethod()")
+ private void logMethods()
+ {
+ }
+
+ /**
+ * Pointcut to exclude all pointcuts which should not be adviced by the
+ * debug logger.
+ */
+ @Pointcut("toStringMethod() || getMessageMethod() || " +
+ "getDebugPropertiesMethod() || logMethods()")
+ private void excluded()
+ {
+ }
+
+ /**
+ * Pointcut for matching the execution of all public methods.
+ */
+ @Pointcut("execution(!@(DebugLogger.NoDebugTracing || " +
+ "DebugLogger.NoEntryDebugTracing) public * *(..)) && " +
+ "!excluded()")
+ void tracedEntryMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching the execution of all public methods.
+ */
+ @Pointcut("execution(!@(DebugLogger.NoDebugTracing || " +
+ "DebugLogger.NoExitDebugTracing) public * *(..)) && " +
+ "!excluded()")
+ void tracedExitMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching the execution of all public methods.
+ */
+ @Pointcut("execution(@DebugLogger.TraceThrown public * *(..)) && " +
+ "!excluded()")
+ void tracedThrownMethod()
+ {
+ }
+
+ /**
+ * Pointcut for matching the execution of all constructors.
+ */
+ @Pointcut("execution(!@(DebugLogger.NoDebugTracing || " +
+ "DebugLogger.NoEntryDebugTracing) public new(..)) && !excluded()")
+ void tracedEntryConstructor()
+ {
+ }
+
+ /**
+ * Pointcut for matching the execution of all constructors.
+ */
+ @Pointcut("execution(!@(DebugLogger.NoDebugTracing || " +
+ "DebugLogger.NoExitDebugTracing) public new(..)) && !excluded()")
+ void tracedExitConstructor()
+ {
+ }
+
+ /**
+ * Pointcut for matching only if there are publishers.
+ *
+ * @return if debug logging is enabled.
+ */
+ @Pointcut("if()")
+ public static boolean shouldTrace()
+ {
+ return DebugLogger.enabled;
+ }
+
+ // The class this aspect traces.
+ String className;
+
+ //The current class level trace settings.
+ ConcurrentHashMap<DebugLogPublisher, TraceSettings> classSettings =
+ new ConcurrentHashMap<DebugLogPublisher, TraceSettings>();
+
+ //The current method level trace settings.
+ ConcurrentHashMap<DebugLogPublisher, Map<String, TraceSettings>>
+ methodSettings = new ConcurrentHashMap<DebugLogPublisher,
+ Map<String, TraceSettings>>();
+
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ */
+ @SuppressWarnings("unchecked")
+ @Before("staticinitialization(*)")
+ public void initializeTracer(JoinPoint.StaticPart thisJoinPointStaticPart)
+ {
+ classTracers.add(this);
+ className = thisJoinPointStaticPart.getSignature().getDeclaringTypeName();
+
+ // Get the settings from all publishers.
+ for(DebugLogPublisher logPublisher :
+ debugPublishers.values())
+ {
+ TraceSettings cSettings = logPublisher.getClassSettings(className);
+ classSettings.put(logPublisher, cSettings);
+
+ // For some reason, the compiler doesn't see that
+ // debugLogPublihser.getMethodSettings returns a parameterized Map.
+ // This problem goes away if a parameterized verson of DebugLogPublisher
+ // is used. However, we can't not use reflection to instantiate a generic
+ // DebugLogPublisher<? extends DebugLogPublisherCfg> type. The only thing
+ // we can do is to just supress the compiler warnings.
+ Map<String, TraceSettings> mSettings =
+ logPublisher.getMethodSettings(className);
+ if(mSettings != null)
+ {
+ methodSettings.put(logPublisher, mSettings);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisJoinPoint the JoinPoint reflection object.
+ */
+ @Before("shouldTrace() && tracedEntryConstructor()")
+ public void traceConstructor(JoinPoint thisJoinPoint)
+ {
+ String signature = thisJoinPoint.getSignature().getName();
+ String sl = thisJoinPoint.getSourceLocation().toString();
+ Object[] args = thisJoinPoint.getArgs();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DEFAULT_CONSTRUCTOR_LEVEL.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.CONSTRUCTOR).intValue())
+ {
+ logPublisher.traceConstructor(DebugLogger.DEFAULT_CONSTRUCTOR_LEVEL,
+ settings, signature, sl, args);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisJoinPoint the JoinPoint reflection object.
+ * @param obj the object this method operations on.
+ */
+ @Before("shouldTrace() && tracedEntryMethod() && nonStaticContext(obj)")
+ public void traceNonStaticMethodEntry(JoinPoint thisJoinPoint, Object obj)
+ {
+ String signature = thisJoinPoint.getSignature().getName();
+ String sl = thisJoinPoint.getSourceLocation().toString();
+ Object[] args = thisJoinPoint.getArgs();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DEFAULT_ENTRY_EXIT_LEVEL.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.ENTER).intValue())
+ {
+ logPublisher.traceNonStaticMethodEntry(DEFAULT_ENTRY_EXIT_LEVEL,
+ settings, signature, sl, obj,
+ args);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisJoinPoint the JoinPoint reflection object.
+ */
+ @Before("shouldTrace() && tracedEntryMethod() && staticContext()")
+ public void traceStaticMethodEntry(JoinPoint thisJoinPoint)
+ {
+ String signature = thisJoinPoint.getSignature().getName();
+ String sl = thisJoinPoint.getSourceLocation().toString();
+ Object[] args = thisJoinPoint.getArgs();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DEFAULT_ENTRY_EXIT_LEVEL.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.ENTER).intValue())
+ {
+ logPublisher.traceStaticMethodEntry(DEFAULT_ENTRY_EXIT_LEVEL, settings,
+ signature, sl, args);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param ret the return value of the method.
+ */
+ @AfterReturning(pointcut = "shouldTrace() && " +
+ "(tracedExitMethod() || tracedExitConstructor())",
+ returning = "ret")
+ public void traceReturn(JoinPoint.StaticPart thisJoinPointStaticPart,
+ Object ret)
+ {
+ String signature = thisJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DEFAULT_ENTRY_EXIT_LEVEL.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.EXIT).intValue())
+ {
+ logPublisher.traceReturn(DEFAULT_ENTRY_EXIT_LEVEL, settings, signature,
+ sl, ret);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param ex the exception thrown.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @AfterThrowing(pointcut = "shouldTrace() && tracedThrownMethod()",
+ throwing = "ex")
+ public void traceThrown(JoinPoint.StaticPart thisJoinPointStaticPart,
+ Throwable ex)
+ {
+ String signature = thisJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DEFAULT_THROWN_LEVEL.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.THROWN).intValue())
+ {
+ logPublisher.traceThrown(DEFAULT_THROWN_LEVEL, settings, signature, sl,
+ ex);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param level the level of the log message.
+ * @param ex the exception thrown.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logThrownMethod() && args(level, ex)")
+ public void traceThrown(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ LogLevel level, Throwable ex)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (level.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.THROWN).intValue())
+ {
+ logPublisher.traceThrown(level, settings, signature, sl, ex);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param msg message to format and log.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logVerboseMethod() && args(msg)")
+ public void traceVerbose(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ String msg)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DebugLogLevel.VERBOSE.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(DebugLogLevel.VERBOSE, settings, signature,
+ sl, msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param msg message to format and log.
+ * @param msgArgs arguments to place into the format string.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logVerboseMethod() && args(msg, msgArgs)")
+ public void traceVerbose(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ String msg, Object[] msgArgs)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ msg = DebugMessageFormatter.format(msg, msgArgs);
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DebugLogLevel.VERBOSE.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(DebugLogLevel.VERBOSE, settings, signature,
+ sl, msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param msg message to format and log.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logInfoMethod() && args(msg)")
+ public void traceInfo(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ String msg)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DebugLogLevel.INFO.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(DebugLogLevel.INFO, settings, signature, sl,
+ msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param msg message to format and log.
+ * @param msgArgs arguments to place into the format string.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logInfoMethod() && args(msg, msgArgs)")
+ public void traceInfo(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ String msg, Object[] msgArgs)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ msg = DebugMessageFormatter.format(msg, msgArgs);
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DebugLogLevel.INFO.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(DebugLogLevel.INFO, settings, signature, sl,
+ msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param msg message to format and log.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logWarningMethod() && args(msg)")
+ public void traceWarning(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ String msg)
+
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DebugLogLevel.WARNING.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(DebugLogLevel.WARNING, settings, signature,
+ sl, msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param msg message to format and log.
+ * @param msgArgs arguments to place into the format string.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logWarningMethod() && args(msg, msgArgs)")
+ public void traceWarning(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ String msg, Object[] msgArgs)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ msg = DebugMessageFormatter.format(msg, msgArgs);
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DebugLogLevel.WARNING.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(DebugLogLevel.WARNING, settings, signature,
+ sl, msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param msg message to format and log.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logErrorMethod() && args(msg)")
+ public void traceError(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ String msg)
+
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DebugLogLevel.ERROR.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(DebugLogLevel.ERROR, settings, signature, sl,
+ msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param msg message to format and log.
+ * @param msgArgs arguments to place into the format string.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logErrorMethod() && args(msg, msgArgs)")
+ public void traceError(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ String msg, Object[] msgArgs)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ msg = DebugMessageFormatter.format(msg, msgArgs);
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (DebugLogLevel.ERROR.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(DebugLogLevel.ERROR, settings, signature, sl,
+ msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param level the level of the log message.
+ * @param msg message to format and log.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logMessageMethod() && args(level, msg)")
+ public void traceMessage(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ LogLevel level, String msg)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (level.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(level, settings, signature, sl, msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param level the level of the log message.
+ * @param msg message to format and log.
+ * @param msgArgs arguments to place into the format string.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logMessageMethod() && args(level, msg, msgArgs)")
+ public void traceMessage(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ LogLevel level, String msg, Object... msgArgs)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ msg = DebugMessageFormatter.format(msg, msgArgs);
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (level.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.MESSAGE).intValue())
+ {
+ logPublisher.traceMessage(level, settings, signature, sl, msg);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param level the level of the log message.
+ * @param ex the exception caught.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logCaughtMethod() && args(level, ex)")
+ public void traceCaught(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ LogLevel level, Throwable ex)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (level.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.CAUGHT).intValue())
+ {
+ logPublisher.traceCaught(level, settings, signature, sl, ex);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param level the level of the log message.
+ * @param status status of the JE operation.
+ * @param database the database handle.
+ * @param txn transaction handle (may be null).
+ * @param key the key to dump.
+ * @param data the data to dump.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logJEAccessMethod() && args(level, status, " +
+ "database, txn, key, data)")
+ public void traceJEAccess(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ LogLevel level, OperationStatus status,
+ Database database, Transaction txn,
+ DatabaseEntry key, DatabaseEntry data)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (level.intValue() >=
+ getEffectiveLevel(settings,
+ DebugLogCategory.DATABASE_ACCESS).intValue())
+ {
+ logPublisher.traceJEAccess(level, settings, signature, sl, status,
+ database, txn, key, data);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param level the level of the log message.
+ * @param data the data to dump.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logDataMethod() && args(level, data)")
+ public void traceData(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ LogLevel level, byte[] data)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (level.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.DATA).intValue())
+ {
+ logPublisher.traceData(level, settings, signature, sl, data);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param level the level of the log message.
+ * @param element the protocol element to dump.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logProtocolElementMethod() && args(level, element)")
+ public void traceProtocolElement(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ LogLevel level, ProtocolElement element)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (level.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.PROTOCOL).intValue())
+ {
+ logPublisher.traceProtocolElement(level, settings, signature, sl,
+ element);
+ }
+ }
+ }
+
+ /**
+ * AspectJ Implementation.
+ *
+ * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
+ * of the code that contains the
+ * debug call.
+ * @param thisJoinPointStaticPart the JoinPoint reflection object.
+ * @param level the level of the log message.
+ * @param buffer the data to dump.
+ */
+ @SuppressAjWarnings({"adviceDidNotMatch"})
+ @Around("shouldTrace() && logDataMethod() && args(level, buffer)")
+ public void traceData(JoinPoint.EnclosingStaticPart
+ thisEnclosingJoinPointStaticPart,
+ JoinPoint.StaticPart
+ thisJoinPointStaticPart,
+ LogLevel level, ByteBuffer buffer)
+ {
+ String signature =
+ thisEnclosingJoinPointStaticPart.getSignature().getName();
+ String sl = thisJoinPointStaticPart.getSourceLocation().toString();
+ for(DebugLogPublisher logPublisher : debugPublishers.values())
+ {
+ TraceSettings settings = getSettings(logPublisher, signature);
+ if (level.intValue() >=
+ getEffectiveLevel(settings, DebugLogCategory.DATA).intValue())
+ {
+ logPublisher.traceData(level, settings, signature, sl, buffer.array());
+ }
+ }
+ }
+
+ /**
+ * Get the current trace settings in effect for the specified method.
+ *
+ * @param debugLogPublisher - the debug publisher to get the trace settings
+ * from.
+ * @param method - the method to get trace settings for
+ * @return the current trace settings in effect
+ */
+ protected final TraceSettings getSettings(DebugLogPublisher debugLogPublisher,
+ String method)
+ {
+ TraceSettings settings = this.classSettings.get(debugLogPublisher);
+
+ Map<String, TraceSettings> methodSettings =
+ this.methodSettings.get(debugLogPublisher);
+ if (methodSettings != null)
+ {
+ TraceSettings mSettings = methodSettings.get(method);
+
+ if (mSettings == null)
+ {
+ // Try looking for an undecorated method name
+ int idx = method.indexOf('(');
+ if (idx != -1)
+ {
+ mSettings =
+ methodSettings.get(method.substring(0, idx));
+ }
+ }
+
+ if (mSettings != null) settings = mSettings;
+ }
+
+ return settings;
+ }
+
+ /**
+ * Retrieve the current log level given the trace settings and log category.
+ *
+ * @param settings the trace settings to test from.
+ * @param category the log category to test.
+ * @return the effective log level.
+ */
+ protected final LogLevel getEffectiveLevel(TraceSettings settings,
+ LogCategory category)
+ {
+ LogLevel level = settings.level;
+ Set<LogCategory> includedCategories = settings.includeCategories;
+
+ if(includedCategories != null &&
+ !includedCategories.contains(category))
+ {
+ level = DebugLogLevel.DISABLED;
+ }
+
+ return level;
+ }
+}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
new file mode 100644
index 0000000..83140e9
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
@@ -0,0 +1,875 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ */
+package org.opends.server.loggers.debug;
+
+import org.opends.server.api.*;
+import org.opends.server.loggers.*;
+import org.opends.server.types.*;
+import org.opends.server.util.ServerConstants;
+import org.opends.server.util.StaticUtils;
+import org.opends.server.util.TimeThread;
+import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
+import static org.opends.server.util.StaticUtils.getFileForPath;
+import static org.opends.server.util.ServerConstants.PROPERTY_DEBUG_TARGET;
+import org.opends.server.admin.std.server.DebugTargetCfg;
+import org.opends.server.admin.std.server.FileBasedDebugLogPublisherCfg;
+import org.opends.server.admin.std.meta.DebugLogPublisherCfgDefn;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.server.ConfigurationDeleteListener;
+import org.opends.server.admin.server.ConfigurationAddListener;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.DirectoryServer;
+import static org.opends.server.messages.ConfigMessages.
+ MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+import static org.opends.server.messages.ConfigMessages.
+ MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+import static org.opends.server.messages.ConfigMessages.
+ MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+import static org.opends.server.messages.MessageHandler.getMessage;
+
+import java.util.*;
+import java.io.File;
+import java.io.IOException;
+
+import com.sleepycat.je.*;
+
+/**
+ * The debug log publisher implementation that writes debug messages to files
+ * on disk. It also maintains the rotation and retention polices of the log
+ * files.
+ */
+public class TextDebugLogPublisher
+ extends DebugLogPublisher<FileBasedDebugLogPublisherCfg>
+ implements ConfigurationChangeListener<FileBasedDebugLogPublisherCfg>,
+ ConfigurationAddListener<DebugTargetCfg>,
+ ConfigurationDeleteListener<DebugTargetCfg>
+{
+ private static long globalSequenceNumber;
+
+ private TextWriter writer;
+
+ private FileBasedDebugLogPublisherCfg currentConfig;
+
+ /**
+ * Returns an instance of the text debug log publisher that will print
+ * all messages to the provided writer. This is used to print the messages
+ * to the console when the server starts up. By default, only error level
+ * messages are printed. Special debug targets are also parsed from
+ * system properties if any are specified.
+ *
+ * @param writer The text writer where the message will be written to.
+ * @return The instance of the text error log publisher that will print
+ * all messages to standard out.
+ */
+ public static TextDebugLogPublisher
+ getStartupTextDebugPublisher(TextWriter writer)
+ {
+ TextDebugLogPublisher startupPublisher = new TextDebugLogPublisher();
+ startupPublisher.writer = writer;
+
+ startupPublisher.addTraceSettings(null,
+ new TraceSettings(DebugLogLevel.ERROR));
+
+ Set<Map.Entry<Object, Object>> propertyEntries =
+ System.getProperties().entrySet();
+ for(Map.Entry<Object, Object> entry : propertyEntries)
+ {
+ if(((String)entry.getKey()).startsWith(PROPERTY_DEBUG_TARGET))
+ {
+ String value = (String)entry.getValue();
+ int settingsStart= value.indexOf(":");
+
+ //See if the scope and settings exists
+ if(settingsStart > 0)
+ {
+ String scope = value.substring(0, settingsStart);
+ TraceSettings settings =
+ TraceSettings.parseTraceSettings(
+ value.substring(settingsStart+1));
+ if(settings != null)
+ {
+ startupPublisher.addTraceSettings(scope, settings);
+ }
+ }
+ }
+ }
+
+ return startupPublisher;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeDebugLogPublisher(FileBasedDebugLogPublisherCfg config)
+ throws ConfigException, InitializationException
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ FileNamingPolicy fnPolicy = new TimeStampNaming(logFile);
+
+ try
+ {
+ FilePermission perm =
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+
+ LogPublisherErrorHandler errorHandler =
+ new LogPublisherErrorHandler(config.dn());
+
+ boolean writerAutoFlush =
+ config.isAutoFlush() && !config.isAsynchronous();
+
+ MultifileTextWriter writer =
+ new MultifileTextWriter("Multifile Text Writer for " +
+ config.dn().toNormalizedString(),
+ config.getTimeInterval(),
+ fnPolicy,
+ perm,
+ errorHandler,
+ "UTF-8",
+ writerAutoFlush,
+ config.isAppend(),
+ (int)config.getBufferSize());
+
+ // Validate retention and rotation policies.
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy != null)
+ {
+ writer.addRotationPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ throw new ConfigException(msgID, message);
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ writer.addRetentionPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ throw new ConfigException(msgID, message);
+ }
+ }
+
+ if(config.isAsynchronous())
+ {
+ this.writer = new AsyncronousTextWriter("Asyncronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(), writer);
+ }
+ else
+ {
+ this.writer = writer;
+ }
+ }
+ catch(DirectoryException e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ String.valueOf(e));
+ throw new InitializationException(msgID, message, e);
+
+ }
+ catch(IOException e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ String.valueOf(e));
+ throw new InitializationException(msgID, message, e);
+
+ }
+
+
+ config.addDebugTargetAddListener(this);
+ config.addDebugTargetDeleteListener(this);
+
+ //Get the default/global settings
+ LogLevel logLevel =
+ DebugLogLevel.parse(config.getDefaultDebugLevel().name());
+ Set<LogCategory> logCategories = null;
+ if(!config.getDefaultDebugCategory().isEmpty())
+ {
+ logCategories =
+ new HashSet<LogCategory>(config.getDefaultDebugCategory().size());
+ for(DebugLogPublisherCfgDefn.DefaultDebugCategory category :
+ config.getDefaultDebugCategory())
+ {
+ logCategories.add(DebugLogCategory.parse(category.name()));
+ }
+ }
+
+ TraceSettings defaultSettings =
+ new TraceSettings(logLevel, logCategories,
+ config.isDefaultOmitMethodEntryArguments(),
+ config.isDefaultOmitMethodReturnValue(),
+ config.getDefaultThrowableStackFrames(),
+ config.isDefaultIncludeThrowableCause());
+
+ addTraceSettings(null, defaultSettings);
+
+ for(String name : config.listDebugTargets())
+ {
+ DebugTargetCfg targetCfg = config.getDebugTarget(name);
+
+ addTraceSettings(targetCfg.getDebugScope(), new TraceSettings(targetCfg));
+ }
+
+ currentConfig = config;
+
+ config.addFileBasedDebugChangeListener(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(
+ FileBasedDebugLogPublisherCfg config, List<String> unacceptableReasons)
+ {
+ // Make sure the permission is valid.
+ try
+ {
+ if(!currentConfig.getLogFileMode().equalsIgnoreCase(
+ config.getLogFileMode()))
+ {
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+ }
+ if(!currentConfig.getLogFile().equalsIgnoreCase(config.getLogFile()))
+ {
+ File logFile = getFileForPath(config.getLogFile());
+ if(logFile.createNewFile())
+ {
+ logFile.delete();
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ unacceptableReasons.add(message);
+ return false;
+ }
+
+ // Validate retention and rotation policies.
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy == null)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ unacceptableReasons.add(message);
+ return false;
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ unacceptableReasons.add(message);
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(
+ FileBasedDebugLogPublisherCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ //Get the default/global settings
+ LogLevel logLevel =
+ DebugLogLevel.parse(config.getDefaultDebugLevel().name());
+ Set<LogCategory> logCategories = null;
+ if(!config.getDefaultDebugCategory().isEmpty())
+ {
+ logCategories =
+ new HashSet<LogCategory>(config.getDefaultDebugCategory().size());
+ for(DebugLogPublisherCfgDefn.DefaultDebugCategory category :
+ config.getDefaultDebugCategory())
+ {
+ logCategories.add(DebugLogCategory.parse(category.name()));
+ }
+ }
+
+ TraceSettings defaultSettings =
+ new TraceSettings(logLevel, logCategories,
+ config.isDefaultOmitMethodEntryArguments(),
+ config.isDefaultOmitMethodReturnValue(),
+ config.getDefaultThrowableStackFrames(),
+ config.isDefaultIncludeThrowableCause());
+
+ addTraceSettings(null, defaultSettings);
+
+ DebugLogger.addTracerSettings(this);
+
+ File logFile = getFileForPath(config.getLogFile());
+ FileNamingPolicy fnPolicy = new TimeStampNaming(logFile);
+
+ try
+ {
+ FilePermission perm =
+ FilePermission.decodeUNIXMode(config.getLogFileMode());
+
+ boolean writerAutoFlush =
+ config.isAutoFlush() && !config.isAsynchronous();
+
+ TextWriter currentWriter;
+ // Determine the writer we are using. If we were writing asyncronously,
+ // we need to modify the underlaying writer.
+ if(writer instanceof AsyncronousTextWriter)
+ {
+ currentWriter = ((AsyncronousTextWriter)writer).getWrappedWriter();
+ }
+ else
+ {
+ currentWriter = writer;
+ }
+
+ if(currentWriter instanceof MultifileTextWriter)
+ {
+ MultifileTextWriter mfWriter = (MultifileTextWriter)writer;
+
+ mfWriter.setNamingPolicy(fnPolicy);
+ mfWriter.setFilePermissions(perm);
+ mfWriter.setAppend(config.isAppend());
+ mfWriter.setAutoFlush(writerAutoFlush);
+ mfWriter.setBufferSize((int)config.getBufferSize());
+ mfWriter.setInterval(config.getTimeInterval());
+
+ mfWriter.removeAllRetentionPolicies();
+ mfWriter.removeAllRotationPolicies();
+
+ for(DN dn : config.getRotationPolicyDN())
+ {
+ RotationPolicy policy = DirectoryServer.getRotationPolicy(dn);
+ if(policy != null)
+ {
+ mfWriter.addRotationPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_ROTATION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+ }
+ }
+ for(DN dn: config.getRetentionPolicyDN())
+ {
+ RetentionPolicy policy = DirectoryServer.getRetentionPolicy(dn);
+ if(policy != null)
+ {
+ mfWriter.addRetentionPolicy(policy);
+ }
+ else
+ {
+ int msgID = MSGID_CONFIG_LOGGER_INVALID_RETENTION_POLICY;
+ String message = getMessage(msgID, dn.toString(),
+ config.dn().toString());
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+ }
+ }
+
+
+ if(writer instanceof AsyncronousTextWriter && !config.isAsynchronous())
+ {
+ // The asynronous setting is being turned off.
+ AsyncronousTextWriter asyncWriter = ((AsyncronousTextWriter)writer);
+ writer = mfWriter;
+ asyncWriter.shutdown(false);
+ }
+
+ if(!(writer instanceof AsyncronousTextWriter) &&
+ config.isAsynchronous())
+ {
+ // The asynronous setting is being turned on.
+ AsyncronousTextWriter asyncWriter =
+ new AsyncronousTextWriter("Asyncronous Text Writer for " +
+ config.dn().toNormalizedString(), config.getQueueSize(),
+ config.isAutoFlush(),
+ mfWriter);
+ writer = asyncWriter;
+ }
+
+ if((currentConfig.isAsynchronous() && config.isAsynchronous()) &&
+ (currentConfig.getQueueSize() != config.getQueueSize()))
+ {
+ adminActionRequired = true;
+ }
+
+ currentConfig = config;
+ }
+ }
+ catch(Exception e)
+ {
+ int msgID = MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER;
+ String message = getMessage(msgID, config.dn().toString(),
+ stackTraceToSingleLineString(e));
+ resultCode = DirectoryServer.getServerErrorResultCode();
+ messages.add(message);
+
+ }
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationAddAcceptable(DebugTargetCfg config,
+ List<String> unacceptableReasons)
+ {
+ return getTraceSettings(config.getDebugScope()) == null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationDeleteAcceptable(DebugTargetCfg config,
+ List<String> unacceptableReasons)
+ {
+ // A delete should always be acceptable.
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationAdd(DebugTargetCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ addTraceSettings(config.getDebugScope(), new TraceSettings(config));
+
+ DebugLogger.addTracerSettings(this);
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationDelete(DebugTargetCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ removeTraceSettings(config.getDebugScope());
+
+ DebugLogger.addTracerSettings(this);
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceConstructor(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Object[] args)
+ {
+ LogCategory category = DebugLogCategory.CONSTRUCTOR;
+ String msg = "";
+ if(!settings.noArgs)
+ {
+ msg = buildDefaultEntryMessage(args);
+ }
+ publish(category, level, signature, sourceLocation, msg, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceNonStaticMethodEntry(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Object obj,
+ Object[] args)
+ {
+ LogCategory category = DebugLogCategory.ENTER;
+ String msg = "";
+ if(!settings.noArgs)
+ {
+ msg = buildDefaultEntryMessage(args);
+ }
+ String stack = null;
+ int stackDepth = settings.stackDepth;
+
+ // Inject a stack trace if requested
+ if (stackDepth > 0) {
+ stack = DebugStackTraceFormatter.formatStackTrace(
+ DebugStackTraceFormatter.SMART_FRAME_FILTER,
+ stackDepth);
+ }
+ publish(category, level, signature, sourceLocation, msg, stack);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceStaticMethodEntry(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Object[] args)
+ {
+ LogCategory category = DebugLogCategory.ENTER;
+ String msg = "";
+ if(!settings.noArgs)
+ {
+ msg = buildDefaultEntryMessage(args);
+ }
+ String stack = null;
+ int stackDepth = settings.stackDepth;
+
+ // Inject a stack trace if requested
+ if (stackDepth > 0) {
+ stack=
+ DebugStackTraceFormatter.formatStackTrace(
+ DebugStackTraceFormatter.SMART_FRAME_FILTER,
+ stackDepth);
+ }
+ publish(category, level, signature, sourceLocation, msg, stack);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceReturn(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Object ret)
+ {
+ LogCategory category = DebugLogCategory.EXIT;
+ String msg = "";
+ if(!settings.noRetVal)
+ {
+ msg = DebugMessageFormatter.format("returned={%s}",
+ new Object[] {ret});
+ }
+ publish(category, level, signature, sourceLocation, msg, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceThrown(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ Throwable ex)
+ {
+ LogCategory category = DebugLogCategory.THROWN;
+ String stack = null;
+ int stackDepth = settings.stackDepth;
+
+ String msg = DebugMessageFormatter.format("thrown={%s}",
+ new Object[] {ex});
+
+ // Inject a stack trace if requested
+ if (stackDepth > 0) {
+ stack=
+ DebugStackTraceFormatter.formatStackTrace(ex,
+ DebugStackTraceFormatter.SMART_FRAME_FILTER,
+ stackDepth, settings.includeCause);
+ }
+ publish(category, level, signature, sourceLocation, msg, stack);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceMessage(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ String msg)
+ {
+ LogCategory category = DebugLogCategory.MESSAGE;
+ publish(category, level, signature, sourceLocation, msg, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceCaught(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation, Throwable ex)
+ {
+ LogCategory category = DebugLogCategory.CAUGHT;
+ String msg = DebugMessageFormatter.format("caught={%s}",
+ new Object[] {ex});
+
+ publish(category, level, signature, sourceLocation, msg, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceJEAccess(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ OperationStatus status,
+ Database database, Transaction txn,
+ DatabaseEntry key, DatabaseEntry data)
+ {
+ LogCategory category = DebugLogCategory.DATABASE_ACCESS;
+
+ // Build the string that is common to category DATABASE_ACCESS.
+ StringBuilder builder = new StringBuilder();
+ builder.append(" (");
+ builder.append(status.toString());
+ builder.append(")");
+ builder.append(" db=");
+ try
+ {
+ builder.append(database.getDatabaseName());
+ }
+ catch(DatabaseException de)
+ {
+ builder.append(de.toString());
+ }
+ if (txn != null)
+ {
+ builder.append(" txnid=");
+ try
+ {
+ builder.append(txn.getId());
+ }
+ catch(DatabaseException de)
+ {
+ builder.append(de.toString());
+ }
+ }
+ else
+ {
+ builder.append(" txnid=none");
+ }
+
+ builder.append(ServerConstants.EOL);
+ if(key != null)
+ {
+ builder.append("key:");
+ builder.append(ServerConstants.EOL);
+ StaticUtils.byteArrayToHexPlusAscii(builder, key.getData(), 4);
+ }
+
+ // If the operation was successful we log the same common information
+ // plus the data
+ if (status == OperationStatus.SUCCESS && data != null)
+ {
+
+ builder.append("data(len=");
+ builder.append(data.getSize());
+ builder.append("):");
+ builder.append(ServerConstants.EOL);
+ StaticUtils.byteArrayToHexPlusAscii(builder, data.getData(), 4);
+
+ }
+
+ publish(category, level, signature, sourceLocation, builder.toString(),
+ null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceData(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ byte[] data)
+ {
+ LogCategory category = DebugLogCategory.DATA;
+ if(data != null)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(ServerConstants.EOL);
+ builder.append("data(len=");
+ builder.append(data.length);
+ builder.append("):");
+ builder.append(ServerConstants.EOL);
+ StaticUtils.byteArrayToHexPlusAscii(builder, data, 4);
+
+ publish(category, level, signature, sourceLocation, builder.toString(),
+ null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void traceProtocolElement(LogLevel level,
+ TraceSettings settings,
+ String signature,
+ String sourceLocation,
+ ProtocolElement element)
+ {
+ LogCategory category = DebugLogCategory.PROTOCOL;
+ if(element != null)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(ServerConstants.EOL);
+ element.toString(builder, 4);
+ publish(category, level, signature, sourceLocation, builder.toString(),
+ null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void close()
+ {
+ writer.shutdown();
+
+ if(currentConfig != null)
+ {
+ currentConfig.removeFileBasedDebugChangeListener(this);
+ }
+ }
+
+
+ // Publishes a record, optionally performing some "special" work:
+ // - injecting a stack trace into the message
+ // - format the message with argument values
+ private void publish(LogCategory category, LogLevel level, String signature,
+ String sourceLocation, String msg, String stack)
+ {
+ Thread thread = Thread.currentThread();
+
+ StringBuilder buf = new StringBuilder();
+ // Emit the timestamp.
+ buf.append("[");
+ buf.append(TimeThread.getLocalTime());
+ buf.append("] ");
+
+ // Emit the seq num
+ buf.append(globalSequenceNumber++);
+ buf.append(" ");
+
+ // Emit debug category.
+ buf.append(category);
+ buf.append(" ");
+
+ // Emit the debug level.
+ buf.append(level);
+ buf.append(" ");
+
+ // Emit thread info.
+ buf.append("thread={");
+ buf.append(thread.getName());
+ buf.append("(");
+ buf.append(thread.getId());
+ buf.append(")} ");
+
+ if(thread instanceof DirectoryThread)
+ {
+ buf.append("threadDetail={");
+ for(Map.Entry entry :
+ ((DirectoryThread)thread).getDebugProperties().entrySet())
+ {
+ buf.append(entry.getKey());
+ buf.append("=");
+ buf.append(entry.getValue());
+ buf.append(" ");
+ }
+ buf.append("} ");
+ }
+
+ // Emit method info.
+ buf.append("method={");
+ buf.append(signature);
+ buf.append(" @ ");
+ buf.append(sourceLocation);
+ buf.append("} ");
+
+ // Emit message.
+ buf.append(msg);
+
+ // Emit Stack Trace.
+ if(stack != null)
+ {
+ buf.append("\nStack Trace:\n");
+ buf.append(stack);
+ }
+
+ writer.writeRecord(buf.toString());
+ }
+
+ private String buildDefaultEntryMessage(Object[] args)
+ {
+ StringBuffer format = new StringBuffer();
+ for (int i = 0; i < args.length; i++)
+ {
+ if (i != 0) format.append(", ");
+ format.append("arg");
+ format.append(i + 1);
+ format.append("={%s}");
+ }
+
+ return DebugMessageFormatter.format(format.toString(), args);
+ }
+}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TraceSettings.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TraceSettings.java
index 4cb7f86..dad93de 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TraceSettings.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/TraceSettings.java
@@ -29,36 +29,68 @@
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DebugLogCategory;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.ResultCode;
import org.opends.server.loggers.LogLevel;
import org.opends.server.loggers.LogCategory;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.std.meta.DebugTargetCfgDefn;
+import org.opends.server.admin.std.server.DebugTargetCfg;
import java.util.Set;
import java.util.HashSet;
+import java.util.ArrayList;
+import java.util.List;
/**
* This class encapsulates the trace settings in effect at a given traceing
* scope.
*/
public class TraceSettings
+ implements ConfigurationChangeListener<DebugTargetCfg>
{
/** A TraceSettings object representing a fully disabled trace state. */
- static final TraceSettings DISABLED =
+ public static final TraceSettings DISABLED =
new TraceSettings(DebugLogLevel.DISABLED);
- static final String STACK_DUMP_KEYWORD = "stack";
- static final String INCLUDE_CAUSE_KEYWORD = "cause";
- static final String SUPPRESS_ARG_KEYWORD = "noargs";
- static final String SUPPRESS_RETVAL_KEYWORD = "noretval";
- static final String INCLUDE_CATEGORY_KEYWORD = "category";
- static final String LEVEL_KEYWORD = "level";
+ private static final String STACK_DUMP_KEYWORD = "stack";
+ private static final String INCLUDE_CAUSE_KEYWORD = "cause";
+ private static final String SUPPRESS_ARG_KEYWORD = "noargs";
+ private static final String SUPPRESS_RETVAL_KEYWORD = "noretval";
+ private static final String INCLUDE_CATEGORY_KEYWORD = "category";
+ private static final String LEVEL_KEYWORD = "level";
- final LogLevel level;
- final Set<LogCategory> includeCategories;
+ /**
+ * The log level of this setting.
+ */
+ LogLevel level;
- final boolean noArgs;
- final boolean noRetVal;
- final int stackDepth;
- final boolean includeCause;
+ /**
+ * The log categories for this setting.
+ */
+ Set<LogCategory> includeCategories;
+
+ /**
+ * Indicates if method arguments should be logged.
+ */
+ boolean noArgs;
+
+ /**
+ * Indicates if method return values should be logged.
+ */
+ boolean noRetVal;
+
+ /**
+ * The level of stack frames to include.
+ */
+ int stackDepth;
+
+ /**
+ * Indicates if the cause exception is included in exception messages.
+ */
+ boolean includeCause;
+
+ private DebugTargetCfg currentConfig;
/**
* Construct new trace settings at the specified log level.
@@ -126,6 +158,89 @@
}
/**
+ * Construct a new trace settings from the provided configuration.
+ *
+ * @param config The debug target configuration that contains the information
+ * to use to initialize this trace setting.
+ */
+ public TraceSettings(DebugTargetCfg config)
+ {
+ this.level =
+ DebugLogLevel.parse(config.getDebugLevel().name());
+
+ Set<LogCategory> logCategories = null;
+ if(!config.getDebugCategory().isEmpty())
+ {
+ logCategories =
+ new HashSet<LogCategory>(config.getDebugCategory().size());
+ for(DebugTargetCfgDefn.DebugCategory category :
+ config.getDebugCategory())
+ {
+ logCategories.add(DebugLogCategory.parse(category.name()));
+ }
+ }
+
+ this.includeCategories = logCategories;
+ this.noArgs = config.isOmitMethodEntryArguments();
+ this.noRetVal = config.isOmitMethodReturnValue();
+ this.stackDepth = config.getThrowableStackFrames();
+ this.includeCause = config.isIncludeThrowableCause();
+
+ currentConfig = config;
+ config.addChangeListener(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isConfigurationChangeAcceptable(DebugTargetCfg config,
+ List<String> unacceptableReasons)
+ {
+ // This should alwas be acceptable. We are assuing that the scope for this
+ // trace setting is the same sine its part of the DN.
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ConfigChangeResult applyConfigurationChange(DebugTargetCfg config)
+ {
+ // Default result code.
+ ResultCode resultCode = ResultCode.SUCCESS;
+ boolean adminActionRequired = false;
+ ArrayList<String> messages = new ArrayList<String>();
+
+ // We can assume that the target scope did not change since its the
+ // naming attribute. Changing it would result in a modify DN.
+
+ this.level =
+ DebugLogLevel.parse(config.getDebugLevel().name());
+
+ Set<LogCategory> logCategories = null;
+ if(!config.getDebugCategory().isEmpty())
+ {
+ logCategories =
+ new HashSet<LogCategory>(config.getDebugCategory().size());
+ for(DebugTargetCfgDefn.DebugCategory category :
+ config.getDebugCategory())
+ {
+ logCategories.add(DebugLogCategory.parse(category.name()));
+ }
+ }
+
+ this.includeCategories = logCategories;
+ this.noArgs = config.isOmitMethodEntryArguments();
+ this.noRetVal = config.isOmitMethodReturnValue();
+ this.stackDepth = config.getThrowableStackFrames();
+ this.includeCause = config.isIncludeThrowableCause();
+
+ this.currentConfig = config;
+
+ return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+ }
+
+ /**
* Parse trace settings from the string representation.
*
* @param value the trace settings string to be parsed.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/Tracer.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/Tracer.java
deleted file mode 100644
index a6e672d..0000000
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/Tracer.java
+++ /dev/null
@@ -1,1237 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2007 Sun Microsystems, Inc.
- */
-
-package org.opends.server.loggers.debug;
-
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.Signature;
-import org.aspectj.lang.annotation.*;
-import org.aspectj.lang.reflect.SourceLocation;
-
-import java.util.Map;
-import java.nio.ByteBuffer;
-
-import static org.opends.server.messages.MessageHandler.getMessage;
-import org.opends.server.util.ServerConstants;
-import org.opends.server.util.StaticUtils;
-import org.opends.server.api.ProtocolElement;
-import org.opends.server.api.DirectoryThread;
-import org.opends.server.loggers.*;
-import org.opends.server.types.DebugLogCategory;
-import org.opends.server.types.DebugLogLevel;
-import com.sleepycat.je.*;
-
-/**
- * An aspect for source-code tracing at the method level.
- *
- * One Tracer aspect instance exists for each Java class using tracing.
- * Tracer must be registered with the DebugLogger.
- *
- * Logging is always done at a level basis, with debug log messages
- * exceeding the trace threshold being traced, others being discarded.
- */
-@Aspect("pertypewithin(!@Tracer.NoDebugTracing org.opends.server..*+ && " +
- "!org.opends.server.loggers.*+ && " +
- "!org.opends.server.loggers.debug..*+ &&" +
- "!org.opends.server.types.DebugLogLevel+ && " +
- "!org.opends.server.types.DebugLogCategory+)")
-public class Tracer
-{
- /**
- * Pointcut for matching static context events.
- */
- @Pointcut("!this(Object)")
- private void staticContext()
- {
- }
-
- /**
- * Pointcut for matching non static context events.
- * @param obj The object being operated on.
- */
- @Pointcut("this(obj)")
- private void nonStaticContext(Object obj)
- {
- }
-
- /**
- * Pointcut for matching all toString() methods.
- */
- @Pointcut("execution(* *..toString(..))")
- private void toStringMethod()
- {
- }
-
- /**
- * Pointcut for matching all getMessage() methods.
- */
- @Pointcut("execution(String org.opends.server." +
- "messages.MessageHandler.getMessage(..))")
- private void getMessageMethod()
- {
- }
-
- /**
- * Pointcut for matching all getDebugProperties() methods.
- * TODO: Make this less general. Find out if pointcut matches
- * subclass methods.
- */
- @Pointcut("execution(* *..getDebugProperties(..))")
- private void getDebugPropertiesMethod()
- {
- }
-
- /**
- * Pointcut for matching debugMessage() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugMessage(..))")
- private void logMessageMethod()
- {
- }
-
- /**
- * Pointcut for matching debugVerbose() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugVerbose(..))")
- private void logVerboseMethod()
- {
- }
-
- /**
- * Pointcut for matching debugInfo() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugInfo(..))")
- private void logInfoMethod()
- {
- }
-
- /**
- * Pointcut for matching debugWarning() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugWarning(..))")
- private void logWarningMethod()
- {
- }
-
- /**
- * Pointcut for matching debugError() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugError(..))")
- private void logErrorMethod()
- {
- }
-
- /**
- * Pointcut for matching debugThrown() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugThrown(..))")
- private void logThrownMethod()
- {
- }
-
- /**
- * Pointcut for matching debugCaught() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugCaught(..))")
- private void logCaughtMethod()
- {
- }
-
- /**
- * Pointcut for matching debugJEAccess() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugJEAccess(..))")
- private void logJEAccessMethod()
- {
- }
-
- /**
- * Pointcut for matching debugData() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugData(..))")
- private void logDataMethod()
- {
- }
-
- /**
- * Pointcut for matching debugProtocolElement() methods.
- */
- @Pointcut("call(public static void org.opends.server." +
- "loggers.debug.DebugLogger.debugProtocolElement(..))")
- private void logProtocolElementMethod()
- {
- }
-
- /**
- * Pointcut for matching all debug logging methods.
- */
- @Pointcut("logMessageMethod() || logVerboseMethod() || logInfoMethod() || " +
- "logWarningMethod() || logErrorMethod() || logCaughtMethod() || " +
- "logJEAccessMethod() || logDataMethod() || logProtocolElementMethod()")
- private void logMethods()
- {
- }
-
- /**
- * Pointcut to exclude all pointcuts which should not be adviced by the
- * debug logger.
- */
- @Pointcut("toStringMethod() || getMessageMethod() || " +
- "getDebugPropertiesMethod() || logMethods()")
- private void excluded()
- {
- }
-
- /**
- * Pointcut for matching the execution of all public methods.
- */
- @Pointcut("execution(!@(Tracer.NoDebugTracing || " +
- "Tracer.NoEntryDebugTracing) public * *(..)) && " +
- "!excluded()")
- void tracedEntryMethod()
- {
- }
-
- /**
- * Pointcut for matching the execution of all public methods.
- */
- @Pointcut("execution(!@(Tracer.NoDebugTracing || " +
- "Tracer.NoExitDebugTracing) public * *(..)) && " +
- "!excluded()")
- void tracedExitMethod()
- {
- }
-
- /**
- * Pointcut for matching the execution of all public methods.
- */
- @Pointcut("execution(@Tracer.TraceThrown public * *(..)) && " +
- "!excluded()")
- void tracedThrownMethod()
- {
- }
-
- /**
- * Pointcut for matching the execution of all constructors.
- */
- @Pointcut("execution(!@(Tracer.NoDebugTracing || " +
- "Tracer.NoEntryDebugTracing) public new(..)) && !excluded()")
- void tracedEntryConstructor()
- {
- }
-
- /**
- * Pointcut for matching the execution of all constructors.
- */
- @Pointcut("execution(!@(Tracer.NoDebugTracing || " +
- "Tracer.NoExitDebugTracing) public new(..)) && !excluded()")
- void tracedExitConstructor()
- {
- }
-
- /**
- * Pointcut for matching only if tracing is enabled.
- *
- * @return if debug logging is enabled.
- */
- @Pointcut("if()")
- public static boolean shouldTrace()
- {
- return DebugLogger.staticEnabled;
- }
-
-
- //The default level to log constructor exectuions.
- private static final LogLevel DEFAULT_CONSTRUCTOR_LEVEL =
- DebugLogLevel.VERBOSE;
- //The default level to log method entry and exit pointcuts.
- private static final LogLevel DEFAULT_ENTRY_EXIT_LEVEL =
- DebugLogLevel.VERBOSE;
- //The default level to log method entry and exit pointcuts.
- private static final LogLevel DEFAULT_THROWN_LEVEL =
- DebugLogLevel.ERROR;
-
- private static final DebugMessageFormatter msgFormatter =
- new DebugMessageFormatter();
-
- // The class this tracer traces.
- private String className;
-
- //The current settings for this tracer.
- private TraceSettings settings;
- private Map<String, TraceSettings> methodSettings;
-
- // The DebugLogger this tracer is genereated by.
- private DebugLogger logger;
-
- /**
- * AspectJ Implementation.
- *
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- */
- @Before("staticinitialization(*)")
- public void initializeTracer(JoinPoint.StaticPart thisJoinPointStaticPart)
- {
- className = thisJoinPointStaticPart.getSignature().getDeclaringTypeName();
- logger = DebugLogger.getLogger();
- logger.registerTracer(className, this);
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisJoinPoint the JoinPoint reflection object.
- */
- @Before("shouldTrace() && tracedEntryConstructor()")
- public void traceConstructor(JoinPoint thisJoinPoint)
- {
- LogCategory category = DebugLogCategory.CONSTRUCTOR;
- LogLevel level = DEFAULT_CONSTRUCTOR_LEVEL;
- Signature signature = thisJoinPoint.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >= getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPoint.getSourceLocation();
- Object[] args = thisJoinPoint.getArgs();
- publish(category, level, signature.toLongString(), sl.toString(), null,
- null, args, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisJoinPoint the JoinPoint reflection object.
- * @param obj the object this method operations on.
- */
- @Before("shouldTrace() && tracedEntryMethod() && nonStaticContext(obj)")
- public void traceNonStaticMethodEntry(JoinPoint thisJoinPoint, Object obj)
- {
- LogCategory category = DebugLogCategory.ENTER;
- LogLevel level = DEFAULT_ENTRY_EXIT_LEVEL;
- Signature signature = thisJoinPoint.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >= getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPoint.getSourceLocation();
- Object[] args = thisJoinPoint.getArgs();
- publish(category, level, signature.toLongString(), sl.toString(), obj,
- null, args, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisJoinPoint the JoinPoint reflection object.
- */
- @Before("shouldTrace() && tracedEntryMethod() && staticContext()")
- public void traceStaticMethodEntry(JoinPoint thisJoinPoint)
- {
- LogCategory category = DebugLogCategory.ENTER;
- LogLevel level = DEFAULT_ENTRY_EXIT_LEVEL;
- Signature signature = thisJoinPoint.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >= getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPoint.getSourceLocation();
- Object[] args = thisJoinPoint.getArgs();
- publish(category, level, signature.toLongString(), sl.toString(), null,
- null, args, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param ret the return value of the method.
- */
- @AfterReturning(pointcut = "shouldTrace() && " +
- "(tracedExitMethod() || tracedExitConstructor())",
- returning = "ret")
- public void traceReturn(JoinPoint.StaticPart thisJoinPointStaticPart,
- Object ret)
- {
- LogCategory category = DebugLogCategory.EXIT;
- LogLevel level = DEFAULT_ENTRY_EXIT_LEVEL;
- Signature signature = thisJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(), null,
- null, new Object[]{ret}, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param ex the exception thrown.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @AfterThrowing(pointcut = "shouldTrace() && tracedThrownMethod()",
- throwing = "ex")
- public void traceThrown(JoinPoint.StaticPart thisJoinPointStaticPart,
- Throwable ex)
- {
- LogCategory category = DebugLogCategory.THROWN;
- LogLevel level = DEFAULT_THROWN_LEVEL;
- Signature signature = thisJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(),
- null, null , new Object[]{ex}, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param msg message to format and log.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logVerboseMethod() && args(msg)")
- public void traceVerbose(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- String msg)
- {
- LogLevel level = DebugLogLevel.VERBOSE;
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(),
- sl.toString(), null, msg, null, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param msg message to format and log.
- * @param msgArgs arguments to place into the format string.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logVerboseMethod() && args(msg, msgArgs)")
- public void traceVerbose(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- String msg, Object[] msgArgs)
- {
- LogLevel level = DebugLogLevel.VERBOSE;
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(),
- sl.toString(), null, msg, msgArgs, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param msg message to format and log.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logInfoMethod() && args(msg)")
- public void traceInfo(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- String msg)
- {
- LogLevel level = DebugLogLevel.INFO;
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(),
- sl.toString(), null, msg, null, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param msg message to format and log.
- * @param msgArgs arguments to place into the format string.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logInfoMethod() && args(msg, msgArgs)")
- public void traceInfo(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- String msg, Object[] msgArgs)
- {
- LogLevel level = DebugLogLevel.INFO;
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(),
- sl.toString(), null, msg, msgArgs, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param msg message to format and log.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logWarningMethod() && args(msg)")
- public void traceWarning(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- String msg)
-
- {
- LogLevel level = DebugLogLevel.WARNING;
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(),
- sl.toString(), null, msg, null, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param msg message to format and log.
- * @param msgArgs arguments to place into the format string.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logWarningMethod() && args(msg, msgArgs)")
- public void traceWarning(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- String msg, Object[] msgArgs)
- {
- LogLevel level = DebugLogLevel.WARNING;
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(),
- sl.toString(), null, msg, msgArgs, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param msg message to format and log.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logErrorMethod() && args(msg)")
- public void traceError(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- String msg)
-
- {
- LogLevel level = DebugLogLevel.ERROR;
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(),
- sl.toString(), null, msg, null, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param msg message to format and log.
- * @param msgArgs arguments to place into the format string.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logErrorMethod() && args(msg, msgArgs)")
- public void traceError(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- String msg, Object[] msgArgs)
- {
- LogLevel level = DebugLogLevel.ERROR;
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(),
- sl.toString(), null, msg, msgArgs, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param level the level of the log message.
- * @param msg message to format and log.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logMessageMethod() && args(level, msg)")
- public void traceMessage(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- LogLevel level, String msg)
- {
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(),
- null, msg, null, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param level the level of the log message.
- * @param msg message to format and log.
- * @param msgArgs arguments to place into the format string.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logMessageMethod() && args(level, msg, msgArgs)")
- public void traceMessage(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- LogLevel level, String msg, Object... msgArgs)
- {
- LogCategory category = DebugLogCategory.MESSAGE;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(),
- null, msg, msgArgs, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param level the level of the log message.
- * @param ex the exception thrown.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logThrownMethod() && args(level, ex)")
- public void traceThrown(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- LogLevel level, Throwable ex)
- {
- LogCategory category = DebugLogCategory.THROWN;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(),
- null, null , new Object[]{ex}, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param level the level of the log message.
- * @param ex the exception caught.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logCaughtMethod() && args(level, ex)")
- public void traceCaught(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- LogLevel level, Throwable ex)
- {
- LogCategory category = DebugLogCategory.CAUGHT;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(),
- null, null , new Object[]{ex}, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param level the level of the log message.
- * @param status status of the JE operation.
- * @param database the database handle.
- * @param txn transaction handle (may be null).
- * @param key the key to dump.
- * @param data the data to dump.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logJEAccessMethod() && args(level, status, " +
- "database, txn, key, data)")
- public void traceJEAccess(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- LogLevel level, OperationStatus status,
- Database database, Transaction txn,
- DatabaseEntry key, DatabaseEntry data)
- {
- LogCategory category = DebugLogCategory.DATABASE_ACCESS;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
-
- // Build the string that is common to category DATABASE_ACCESS.
- StringBuilder builder = new StringBuilder();
- builder.append(" (");
- builder.append(status.toString());
- builder.append(")");
- builder.append(" db=");
- try
- {
- builder.append(database.getDatabaseName());
- }
- catch(DatabaseException de)
- {
- builder.append(de.toString());
- }
- if (txn != null)
- {
- builder.append(" txnid=");
- try
- {
- builder.append(txn.getId());
- }
- catch(DatabaseException de)
- {
- builder.append(de.toString());
- }
- }
- else
- {
- builder.append(" txnid=none");
- }
-
- builder.append(ServerConstants.EOL);
- if(key != null)
- {
- builder.append("key:");
- builder.append(ServerConstants.EOL);
- StaticUtils.byteArrayToHexPlusAscii(builder, key.getData(), 4);
- }
-
- // If the operation was successful we log the same common information
- // plus the data
- if (status == OperationStatus.SUCCESS && data != null)
- {
-
- builder.append("data(len=");
- builder.append(data.getSize());
- builder.append("):");
- builder.append(ServerConstants.EOL);
- StaticUtils.byteArrayToHexPlusAscii(builder, data.getData(), 4);
-
- }
-
-
- SourceLocation sl = thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(), null,
- builder.toString(), null, settings);
- }
- }
-
- /**
- * AspectJ Implementation.
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param level the level of the log message.
- * @param data the data to dump.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logDataMethod() && args(level, data)")
- public void traceData(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- LogLevel level, byte[] data)
- {
- LogCategory category = DebugLogCategory.DATA;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- if(data != null)
- {
- StringBuilder builder = new StringBuilder();
- builder.append(ServerConstants.EOL);
- builder.append("data(len=");
- builder.append(data.length);
- builder.append("):");
- builder.append(ServerConstants.EOL);
- StaticUtils.byteArrayToHexPlusAscii(builder, data, 4);
- SourceLocation sl =
- thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(), null,
- builder.toString(), null, settings);
- }
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param level the level of the log message.
- * @param element the protocol element to dump.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logProtocolElementMethod() && args(level, element)")
- public void traceProtocolElement(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- LogLevel level, ProtocolElement element)
- {
- LogCategory category = DebugLogCategory.PROTOCOL;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- if(element != null)
- {
- StringBuilder builder = new StringBuilder();
- builder.append(ServerConstants.EOL);
- element.toString(builder, 4);
- SourceLocation sl =
- thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(), null,
- builder.toString(), null, settings);
- }
- }
- }
-
- /**
- * AspectJ Implementation.
- *
- * @param thisEnclosingJoinPointStaticPart the JoinPoint reflection object
- * of the code that contains the
- * debug call.
- * @param thisJoinPointStaticPart the JoinPoint reflection object.
- * @param level the level of the log message.
- * @param buffer the data to dump.
- */
- @SuppressAjWarnings({"adviceDidNotMatch"})
- @Around("shouldTrace() && logDataMethod() && args(level, buffer)")
- public void traceData(JoinPoint.EnclosingStaticPart
- thisEnclosingJoinPointStaticPart,
- JoinPoint.StaticPart
- thisJoinPointStaticPart,
- LogLevel level, ByteBuffer buffer)
- {
- LogCategory category = DebugLogCategory.DATA;
- Signature signature = thisEnclosingJoinPointStaticPart.getSignature();
- TraceSettings settings = getSettings(signature.getName());
- if (level.intValue() >=
- getEffectiveLevel(settings, category).intValue())
- {
- if(buffer != null)
- {
- byte[] data = buffer.array();
- StringBuilder builder = new StringBuilder();
- builder.append(ServerConstants.EOL);
- builder.append("data(len=");
- builder.append(data.length);
- builder.append("):");
- builder.append(ServerConstants.EOL);
- StaticUtils.byteArrayToHexPlusAscii(builder, data, 4);
- SourceLocation sl =
- thisJoinPointStaticPart.getSourceLocation();
- publish(category, level, signature.toLongString(), sl.toString(), null,
- builder.toString(), null, settings);
- }
- }
- }
-
- // Publishes a record, optionally performing some "special" work:
- // - injecting a stack trace into the message
- // - format the message with argument values
- private void publish(LogCategory category, LogLevel level,
- String method, String srcLocation, Object srcObject,
- String msg, Object[] msgArgs, TraceSettings settings)
- {
- int stackDepth = 0;
-
- if (DebugLogCategory.ENTER.equals(category) ||
- DebugLogCategory.CONSTRUCTOR.equals(category))
- {
- if(settings.noArgs)
- {
- msgArgs = null;
- }
- else if(msg == null)
- {
- msg = buildDefaultEntryMessage(msgArgs.length);
- }
- }
-
- else if(DebugLogCategory.EXIT.equals(category))
- {
- if(settings.noRetVal)
- {
- msgArgs = null;
- }
- else if(msg == null)
- {
- msg = "returned={%s}";
- }
- }
-
- else if(DebugLogCategory.THROWN.equals(category))
- {
- if(msg == null)
- {
- msg = "threw={%s}";
- }
- }
-
- else if(DebugLogCategory.CAUGHT.equals(category))
- {
- if(msg == null)
- {
- msg = "caught={%s}";
- }
- }
-
- if (msg != null && msgArgs != null)
- {
- msg = msgFormatter.format(msg, msgArgs);
- }
-
-
- DebugLogRecord record = new DebugLogRecord(category, level, srcObject,
- logger, msg);
- record.setSignature(method);
- record.setSourceLocation(srcLocation);
-
- Thread thread = Thread.currentThread();
- if(thread instanceof DirectoryThread)
- {
- record.setThreadProperties(
- ((DirectoryThread)thread).getDebugProperties());
- }
-
- //Stack trace applies only to entry and thrown exception messages.
- if(DebugLogCategory.ENTER.equals(category) ||
- DebugLogCategory.THROWN.equals(category))
- {
- stackDepth = settings.stackDepth;
- }
-
- // Inject a stack trace if requested
- if (stackDepth > 0) {
-
- //Generate a dummy exception to get stack trace if necessary
- Throwable t= new NullPointerException();
- String stack=
- DebugStackTraceFormatter.formatStackTrace(t,
- DebugStackTraceFormatter.SMART_FRAME_FILTER,
- stackDepth, settings.includeCause);
- if (stack != null) record.setStackTrace(stack);
- }
-
- logger.publishRecord(record);
- }
-
- // Publishes a record with a message ID
- private void publish(LogCategory category, LogLevel level,
- String method, String srcLocation, Object srcObject,
- int msgID, Object[] msgArgs, TraceSettings settings)
- {
- String msg = getMessage(msgID);
-
- publish(category, level, method, srcLocation, srcObject, msg,
- msgArgs, settings);
- }
-
- /**
- * Get the current trace settings in effect for the specified method.
- *
- * @param method - the method to get trace settings for
- * @return the current trace settings in effect
- */
- protected TraceSettings getSettings(String method)
- {
- TraceSettings settings = this.settings;
-
- if (methodSettings != null)
- {
- TraceSettings mSettings = methodSettings.get(method);
-
- if (mSettings == null)
- {
- // Try looking for an undecorated method name
- int idx = method.indexOf('(');
- if (idx != -1)
- {
- mSettings = methodSettings.get(method.substring(0, idx));
- }
- }
-
- if (mSettings != null) settings = mSettings;
- }
-
- return settings;
- }
-
- /**
- * Retrieve the current log level given the trace settings and log category.
- *
- * @param settings the trace settings to test from.
- * @param category the log category to test.
- * @return the effective log level.
- */
- protected LogLevel getEffectiveLevel(TraceSettings settings,
- LogCategory category)
- {
- LogLevel level = settings.level;
-
- if(settings.includeCategories != null &&
- !settings.includeCategories.contains(category))
- {
- level = DebugLogLevel.DISABLED;
- }
-
- return level;
- }
-
- private static String buildDefaultEntryMessage(int argCount)
- {
- StringBuffer format = new StringBuffer();
- for (int i = 0; i < argCount; i++)
- {
- if (i != 0) format.append(", ");
- format.append("arg");
- format.append(i + 1);
- format.append("={");
- format.append("%s");
- format.append("}");
- }
-
- return format.toString();
- }
-
- /**
- * Update the settings for this tracer.
- *
- * @param config the new trace configuration.
- */
- protected void updateSettings(DebugConfiguration config)
- {
- synchronized (this)
- {
- this.settings = config.getTraceSettings(className);
- this.methodSettings = config.getMethodSettings(className);
- }
- }
-
- /**
- * Indicates whether a method is traced at the specified level.
- *
- * @param level - the trace level to test.
- * @param category - the category to test.
- * @param method - the method to test.
- * @return <b>true</b> if the logger would trace a message for the
- * method at the level, <b>false</b> otherwise.
- */
- public boolean isLogging(LogLevel level, LogCategory category, String method)
- {
- return level.intValue() >= getLevel(method, category).intValue();
- }
-
- /**
- * Get the current trace level for the specified method.
- *
- * @param method the method to get the trace level for.
- * @param category the category to get the trace level for.
- * @return the current trace level for the method.
- */
- protected LogLevel getLevel(String method, LogCategory category)
- {
- TraceSettings settings = getSettings(method);
- return getEffectiveLevel(settings, category);
- }
-
- /**
- * Classes and methods annotated with @NoDebugTracing will not be weaved with
- * debug logging statements by AspectJ.
- */
- public @interface NoDebugTracing {}
-
- /**
- * Methods annotated with @NoEntryDebugTracing will not be weaved with
- * entry debug logging statements by AspectJ.
- */
- public @interface NoEntryDebugTracing {}
-
- /**
- * Methods annotated with @NoExitDebugTracing will not be weaved with
- * exit debug logging statements by AspectJ.
- */
- public @interface NoExitDebugTracing {}
-
- /**
- * Methods annotated with @TraceThrown will be weaved by AspectJ with
- * debug logging statements when an exception is thrown from the method.
- */
- public @interface TraceThrown {}
-
-}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/messages/ConfigMessages.java b/opendj-sdk/opends/src/server/org/opends/server/messages/ConfigMessages.java
index 94db4da..a7ba3d4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/messages/ConfigMessages.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/messages/ConfigMessages.java
@@ -6620,6 +6620,60 @@
+ /**
+ * The message ID for the message that will be used if a configuration entry
+ * defines a Directory Server rotation policy but the associated class cannot
+ * be instantiated as a rotation policy. This takes three arguments, which
+ * are the class name, the DN of the configuration entry, and a string
+ * representation of the exception that was caught.
+ */
+ public static final int MSGID_CONFIG_ROTATION_POLICY_INVALID_CLASS =
+ CATEGORY_MASK_CONFIG | SEVERITY_MASK_SEVERE_ERROR | 657;
+
+
+ /**
+ * The message ID for the message that will be used if a configuration entry
+ * defines a Directory Server retention policy but the associated class cannot
+ * be instantiated as a retention policy. This takes three arguments, which
+ * are the class name, the DN of the configuration entry, and a string
+ * representation of the exception that was caught.
+ */
+ public static final int MSGID_CONFIG_RETENTION_POLICY_INVALID_CLASS =
+ CATEGORY_MASK_CONFIG | SEVERITY_MASK_SEVERE_ERROR | 658;
+
+
+ /**
+ * The message ID for the message that will be used if an error occurs while
+ * trying to create a rotation policy from a configuration entry. This takes
+ * two arguments, which are the DN of the configuration entry and a message
+ * that explains the problem that occurred.
+ */
+ public static final int MSGID_CONFIG_ROTATION_POLICY_CANNOT_CREATE_POLICY =
+ CATEGORY_MASK_CONFIG | SEVERITY_MASK_SEVERE_ERROR | 659;
+
+
+ /**
+ * The message ID for the message that will be used if an error occurs while
+ * trying to create a retention policy from a configuration entry. This takes
+ * two arguments, which are the DN of the configuration entry and a message
+ * that explains the problem that occurred.
+ */
+ public static final int MSGID_CONFIG_RETENTION_POLICY_CANNOT_CREATE_POLICY =
+ CATEGORY_MASK_CONFIG | SEVERITY_MASK_SEVERE_ERROR | 660;
+
+
+ /**
+ * The message ID for the message that will be used if an error occurs while
+ * trying to create a text writer for a text log publisher. This takes
+ * two arguments, the DN of the onfiguration entry and a message that explains
+ * the problem that occurred.
+ */
+ public static final int MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER =
+ CATEGORY_MASK_CONFIG | SEVERITY_MASK_SEVERE_ERROR | 661;
+
+
+
+
/**
* Associates a set of generic messages with the message IDs defined in this
* class.
@@ -9449,6 +9503,27 @@
"An error occurred while trying to load an instance " +
"of class %s referenced in configuration entry %s as a " +
"virtual attribute provider: %s");
+ registerMessage(MSGID_CONFIG_ROTATION_POLICY_INVALID_CLASS,
+ "Class %s specified in attribute " + ATTR_LOGGER_CLASS +
+ " of configuration entry %s cannot be instantiated as " +
+ "a Directory Server log rotation policy: %s");
+ registerMessage(MSGID_CONFIG_RETENTION_POLICY_INVALID_CLASS,
+ "Class %s specified in attribute " + ATTR_LOGGER_CLASS +
+ " of configuration entry %s cannot be instantiated as " +
+ "a Directory Server log retention policy: %s");
+ registerMessage(MSGID_CONFIG_ROTATION_POLICY_CANNOT_CREATE_POLICY,
+ "An error occurred while attempting to create a " +
+ "Directory Server log rotation policy from the " +
+ "information in configuration entry %s: %s");
+ registerMessage(MSGID_CONFIG_RETENTION_POLICY_CANNOT_CREATE_POLICY,
+ "An error occurred while attempting to create a " +
+ "Directory Server log retention policy from the " +
+ "information in configuration entry %s: %s");
+ registerMessage(MSGID_CONFIG_LOGGING_CANNOT_CREATE_WRITER,
+ "An error occured while attempting create a text writer " +
+ "for a Directory Server logger from the information " +
+ "in configuration entry %s: %s");
+
}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/messages/LoggerMessages.java b/opendj-sdk/opends/src/server/org/opends/server/messages/LoggerMessages.java
index 2310ab7..4dd61fe 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/messages/LoggerMessages.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/messages/LoggerMessages.java
@@ -39,93 +39,75 @@
public class LoggerMessages
{
/**
- * The message ID for the message that will be used if the access logger
- * cannot add an appropriate log handler. This takes a single argument, which
- * is a string representation of the exception that was caught.
+ * The message ID for the message that will be used if an error occured
+ * while writing a log record. This takes a two arguments, which
+ * are the logger that encountered the error and a string
+ * representation of the exception that was caught.
*/
- public static final int MSGID_LOG_ACCESS_CANNOT_ADD_FILE_HANDLER =
+ public static final int MSGID_LOGGER_ERROR_WRITING_RECORD =
CATEGORY_MASK_LOG | SEVERITY_MASK_SEVERE_ERROR | 1;
/**
- * The message ID for the message that will be used if the error logger
- * cannot add an appropriate log handler. This takes a single argument, which
- * is a string representation of the exception that was caught.
+ * The message ID for the message that will be used if an error occured
+ * while opening a log file. This takes a two arguments, which
+ * are the logger that encountered the error and a string
+ * representation of the exception that was caught.
*/
- public static final int MSGID_LOG_ERROR_CANNOT_ADD_FILE_HANDLER =
+ public static final int MSGID_LOGGER_ERROR_OPENING_FILE =
CATEGORY_MASK_LOG | SEVERITY_MASK_SEVERE_ERROR | 2;
/**
- * The message ID for the message that will be used if the debug logger
- * cannot add an appropriate log handler. This takes a single argument, which
- * is a string representation of the exception that was caught.
+ * The message ID for the message that will be used if an error occured
+ * while closing a log file. This takes a two arguments, which
+ * are the logger that encountered the error and a string
+ * representation of the exception that was caught.
*/
- public static final int MSGID_LOG_DEBUG_CANNOT_ADD_FILE_HANDLER =
+ public static final int MSGID_LOGGER_ERROR_CLOSING_FILE =
CATEGORY_MASK_LOG | SEVERITY_MASK_SEVERE_ERROR | 3;
- /**
- * The message ID for the message that will be used as the description of the
- * configuration attribute specifying the nickname of the certificate to use
- * for SSL and StartTLS communication.
- */
- public static final int MSGID_LOG_DESCRIPTION_SSL_CERT_NICKNAME =
- CATEGORY_MASK_LOG | SEVERITY_MASK_INFORMATIONAL | 4;
/**
- * The message ID for the description of the configuration attribute that
- * specifies the file size limit for rotation.
+ * The message ID for the message that will be used if an error occured
+ * while flushing the writer buffer. This takes a two arguments, which
+ * are the logger that encountered the error and a string
+ * representation of the exception that was caught.
*/
- public static final int MSGID_LOGGER_ROTATION_SIZE_LIMIT =
- CATEGORY_MASK_LOG | SEVERITY_MASK_INFORMATIONAL | 5;
+ public static final int MSGID_LOGGER_ERROR_FLUSHING_BUFFER =
+ CATEGORY_MASK_LOG | SEVERITY_MASK_SEVERE_ERROR | 4;
- /**
- * The message ID for the description of the configuration attribute that
- * specifies the time limit for rotation.
- */
- public static final int MSGID_LOGGER_ROTATION_FIXED_TIME_LIMIT =
- CATEGORY_MASK_LOG | SEVERITY_MASK_INFORMATIONAL | 6;
/**
- * The message ID for the description of the configuration attribute that
- * specifies the number of files for the retention policy.
+ * The message ID for the message that will be used if the specified
+ * string is not a valid error severity name. This takes the name
+ * of the invalid severity as the argument.
*/
- public static final int MSGID_LOGGER_RETENTION_NUMBER_OF_FILES =
- CATEGORY_MASK_LOG | SEVERITY_MASK_INFORMATIONAL | 7;
+ public static final int MSGID_ERROR_LOGGER_INVALID_SEVERITY =
+ CATEGORY_MASK_LOG | SEVERITY_MASK_MILD_WARNING | 5;
- /**
- * The message ID for the description of the configuration attribute that
- * specifies the disk space used for the size based retention policy.
+
+ /**
+ * The message ID for the message that will be used if the specified
+ * string is not a valid error category name. This takes the name
+ * of the invalid category as the argument.
*/
- public static final int MSGID_LOGGER_RETENTION_DISK_SPACE_USED =
- CATEGORY_MASK_LOG | SEVERITY_MASK_INFORMATIONAL | 8;
+ public static final int MSGID_ERROR_LOGGER_INVALID_CATEGORY =
+ CATEGORY_MASK_LOG | SEVERITY_MASK_MILD_WARNING | 6;
- /**
- * The message ID for the description of the configuration attribute that
- * specifies the thread time interval.
+
+ /**
+ * The message ID for the message that will be used if the specified
+ * string is not a valid error override severity. This takes the name
+ * of the invalid severity as the argument.
*/
- public static final int MSGID_LOGGER_THREAD_INTERVAL =
- CATEGORY_MASK_LOG | SEVERITY_MASK_INFORMATIONAL | 9;
-
- /**
- * The message ID for the description of the configuration attribute that
- * specifies the log buffer size.
- */
- public static final int MSGID_LOGGER_BUFFER_SIZE =
- CATEGORY_MASK_LOG | SEVERITY_MASK_INFORMATIONAL | 10;
-
-
- /**
- * The message ID for the description of the configuration attribute that
- * specifies the free disk space allowed.
- */
- public static final int MSGID_LOGGER_RETENTION_FREE_DISK_SPACE =
- CATEGORY_MASK_LOG | SEVERITY_MASK_INFORMATIONAL | 11;
+ public static final int MSGID_ERROR_LOGGER_INVALID_OVERRIDE_SEVERITY =
+ CATEGORY_MASK_LOG | SEVERITY_MASK_MILD_WARNING | 7;
@@ -135,41 +117,21 @@
*/
public static void registerMessages()
{
- registerMessage(MSGID_LOG_ACCESS_CANNOT_ADD_FILE_HANDLER,
- "Unable to add a file handler for the Directory Server " +
- "access logger: %s");
- registerMessage(MSGID_LOG_ERROR_CANNOT_ADD_FILE_HANDLER,
- "Unable to add a file handler for the Directory Server " +
- "error logger: %s");
- registerMessage(MSGID_LOG_DEBUG_CANNOT_ADD_FILE_HANDLER,
- "Unable to add a file handler for the Directory Server " +
- "debug logger: %s");
- registerMessage(MSGID_LOG_DESCRIPTION_SSL_CERT_NICKNAME,
- "Specifies the nickname of the certificate that the " +
- "connection handler should use when accepting SSL-based " +
- "connections or performing StartTLS negotiation. " +
- "Changes to this configuration attribute will not take " +
- "effect until the connection handler is disabled and " +
- "re-enabled, or until the Directory Server is restarted");
- registerMessage(MSGID_LOGGER_ROTATION_SIZE_LIMIT,
- "Specifies the size limit for the file before rotation " +
- "takes place");
- registerMessage(MSGID_LOGGER_ROTATION_FIXED_TIME_LIMIT,
- "Specifies the time interval before the log file rotation" +
- " takes place");
- registerMessage(MSGID_LOGGER_RETENTION_NUMBER_OF_FILES,
- "Specifies the number of log files that need to " +
- " be retained");
- registerMessage(MSGID_LOGGER_RETENTION_DISK_SPACE_USED,
- "Specifies the amount of disk space that log files " +
- " can use");
- registerMessage(MSGID_LOGGER_THREAD_INTERVAL,
- "Specifies the time interval that the logger thread " +
- " wakes up after");
- registerMessage(MSGID_LOGGER_BUFFER_SIZE,
- "Specifies the log file buffer size");
- registerMessage(MSGID_LOGGER_RETENTION_FREE_DISK_SPACE,
- "Specifies the free disk space allowed");
+ registerMessage(MSGID_LOGGER_ERROR_WRITING_RECORD,
+ "Unable to write log record for logger " +
+ "%s: %s. Any further writing errors will be ignored");
+ registerMessage(MSGID_LOGGER_ERROR_OPENING_FILE,
+ "Unable to open log file %s for logger %s: %s");
+ registerMessage(MSGID_LOGGER_ERROR_CLOSING_FILE,
+ "Unable to close log file for logger %s: %s");
+ registerMessage(MSGID_LOGGER_ERROR_FLUSHING_BUFFER,
+ "Unable to flush writer buffer for logger %s: %s");
+ registerMessage(MSGID_ERROR_LOGGER_INVALID_SEVERITY,
+ "Invalid error log severity %s");
+ registerMessage(MSGID_ERROR_LOGGER_INVALID_CATEGORY,
+ "Invalid error log category %s");
+ registerMessage(MSGID_ERROR_LOGGER_INVALID_OVERRIDE_SEVERITY,
+ "invalid override of severity level %s");
}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java b/opendj-sdk/opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java
index c208f5f..8878a9c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -58,7 +58,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.PluginMessages.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfilerPlugin.java b/opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfilerPlugin.java
index 1a248e4..03eeb35 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfilerPlugin.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfilerPlugin.java
@@ -50,7 +50,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.PluginMessages.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
index ea5a7d6..d719611 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -90,7 +90,7 @@
import static
org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.ProtocolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
index 1e55145..b27bb2c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
@@ -28,7 +28,7 @@
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ProtocolMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index d23ae7b..a52837d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -75,13 +75,13 @@
import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.SearchResultReference;
-import static org.opends.server.loggers.Access.*;
+import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugData;
import static org.opends.server.loggers.debug.DebugLogger.debugProtocolElement;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.ProtocolMessages.*;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
index 0ebb489..d3f7052 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -28,8 +28,8 @@
-import static org.opends.server.loggers.Access.logConnect;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.AccessLogger.logConnect;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.messages.MessageHandler.getMessage;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java
index a2cb596..2311dd1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java
@@ -47,7 +47,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.ProtocolMessages.*;
import org.opends.server.types.DisconnectReason;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ListenerThread.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ListenerThread.java
index 6adedc1..5300d58 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ListenerThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ListenerThread.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.plugin;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
index 64251e2..0579de3 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.plugin;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
index de74c3a..8319aa1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.plugin;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
import static org.opends.server.messages.MessageHandler.getMessage;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
index 53f3547..96f38f9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
@@ -30,7 +30,7 @@
import static org.opends.server.config.ConfigConstants.ATTR_BACKEND_CLASS;
import static org.opends.server.config.ConfigConstants.ATTR_BACKEND_ID;
import static org.opends.server.config.ConfigConstants.DN_BACKEND_BASE;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
import static org.opends.server.messages.ConfigMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/DbHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/DbHandler.java
index f8d5e45..9102301 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/DbHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/DbHandler.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.server;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationCache.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationCache.java
index d2e9fb8..24aa6e4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationCache.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationCache.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.server;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDB.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
index 65b34ae..0206294 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.server;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
index 39a04bc..8a48001 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.server;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
index d93cb84..3c27378 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.server;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
import static org.opends.server.util.StaticUtils.getFileForPath;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerHandler.java
index 386591d..d2b3d5b 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerHandler.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.server;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
import static org.opends.server.messages.MessageHandler.getMessage;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java
index 40e5f9d..3c72463 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.server;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java
index 53154ee..5344e20 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication.server;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ReplicationMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java
index b0d135e..bc19eb9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java
@@ -29,7 +29,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/AciSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/AciSyntax.java
index 0082f35..a4f4886 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/AciSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/AciSyntax.java
@@ -42,7 +42,7 @@
import org.opends.server.types.DN;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.messages.SchemaMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java
index ff7b6ea..e871910 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java
@@ -44,7 +44,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordSyntax.java
index c510d61..cd5d3ff 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordSyntax.java
@@ -42,12 +42,10 @@
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/BinarySyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/BinarySyntax.java
index 96f2fff..0ac9804 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/BinarySyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/BinarySyntax.java
@@ -38,7 +38,7 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.ByteString;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
import org.opends.server.types.ErrorLogCategory;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java
index 8154456..6bd4f6d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java
@@ -40,7 +40,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/BitStringSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/BitStringSyntax.java
index 798b6ff..0dbc292 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/BitStringSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/BitStringSyntax.java
@@ -40,12 +40,10 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java
index 3d959db..199f56f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java
@@ -42,7 +42,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/BooleanSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/BooleanSyntax.java
index 4974760..013df37 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/BooleanSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/BooleanSyntax.java
@@ -45,7 +45,7 @@
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java
index 2260f03..69e1aa4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java
@@ -42,7 +42,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java
index 3f499ed..0bec2f6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java
@@ -42,12 +42,10 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java
index b53f793..8b30694 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java
@@ -42,7 +42,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java
index 5861e10..3ec3bac 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java
@@ -42,7 +42,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/CertificateListSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/CertificateListSyntax.java
index 7c2feef..9ef3ad4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/CertificateListSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/CertificateListSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/CertificatePairSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/CertificatePairSyntax.java
index d4b21de..c654ff0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/CertificatePairSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/CertificatePairSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/CertificateSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/CertificateSyntax.java
index b612367..aa2fc1f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/CertificateSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/CertificateSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/CountryStringSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/CountryStringSyntax.java
index c79793f..048b4fc 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/CountryStringSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/CountryStringSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.PrintableString.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/DeliveryMethodSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/DeliveryMethodSyntax.java
index 4870484..57c4005 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/DeliveryMethodSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/DeliveryMethodSyntax.java
@@ -43,10 +43,9 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
-import static org.opends.server.schema.PrintableString.*;
import static org.opends.server.schema.SchemaConstants.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/DirectoryStringSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/DirectoryStringSyntax.java
index 2ea9e80..5e4c42f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/DirectoryStringSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/DirectoryStringSyntax.java
@@ -57,7 +57,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/DistinguishedNameSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/DistinguishedNameSyntax.java
index 1416431..2ac7309 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/DistinguishedNameSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/DistinguishedNameSyntax.java
@@ -46,7 +46,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/EnhancedGuideSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/EnhancedGuideSyntax.java
index 1a98150..deb5f11 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/EnhancedGuideSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/EnhancedGuideSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/FaxNumberSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/FaxNumberSyntax.java
index 66353e7..e33365f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/FaxNumberSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/FaxNumberSyntax.java
@@ -42,7 +42,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/FaxSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/FaxSyntax.java
index 9280b22..7b9def0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/FaxSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/FaxSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java
index 0f6e7af..9f4a0f1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java
@@ -46,13 +46,9 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.messages.SchemaMessages.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.schema.SchemaConstants.*;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
index 6f75eae..8a420db 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
@@ -46,13 +46,9 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.messages.SchemaMessages.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.schema.SchemaConstants.*;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java
index cc204be..5020a69 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java
@@ -54,7 +54,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/GuideSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/GuideSyntax.java
index 29dc4b0..24034bc 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/GuideSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/GuideSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/IA5StringSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/IA5StringSyntax.java
index 45f55a9..1cec743 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/IA5StringSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/IA5StringSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java
index e4e9f6f..754d0b7 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java
@@ -42,7 +42,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
index 9cca677..a38fa1b 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
@@ -40,12 +40,10 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerSyntax.java
index d802fda..c0a59f4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/IntegerSyntax.java
@@ -44,7 +44,7 @@
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/JPEGSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/JPEGSyntax.java
index ccc5dd3..3b83dbc 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/JPEGSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/JPEGSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
index 38e3d56..8881ce0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
@@ -44,7 +44,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/MatchingRuleSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/MatchingRuleSyntax.java
index 3405ebd..4fc0c94 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/MatchingRuleSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/MatchingRuleSyntax.java
@@ -48,7 +48,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java
index ba8b15e..5d1c306 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java
@@ -43,7 +43,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java
index 03ff9c4..09bcb7a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java
@@ -42,7 +42,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
index 8f16d62..fec74d7 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
@@ -40,7 +40,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java
index b2c56c5..412e486 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java
@@ -42,7 +42,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSyntax.java
index 6b7be31..a20aade 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/OIDSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/OIDSyntax.java
index 4e69943..b4f00ba 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/OIDSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/OIDSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java
index 44bfce2..dca97a9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java
@@ -46,7 +46,7 @@
import org.opends.server.types.ObjectClass;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/OctetStringSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/OctetStringSyntax.java
index c04f382..250f2cf 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/OctetStringSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/OctetStringSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/OtherMailboxSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/OtherMailboxSyntax.java
index 490dafe..c9ba8d3 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/OtherMailboxSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/OtherMailboxSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/PostalAddressSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/PostalAddressSyntax.java
index 3f4318b..646b48d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/PostalAddressSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/PostalAddressSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/PresentationAddressSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/PresentationAddressSyntax.java
index 8005148..463737b 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/PresentationAddressSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/PresentationAddressSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/PrintableStringSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/PrintableStringSyntax.java
index bd5ae96..53d54fc 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/PrintableStringSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/PrintableStringSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/ProtocolInformationSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/ProtocolInformationSyntax.java
index 41e8666..1192d71 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/ProtocolInformationSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/ProtocolInformationSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/RFC3672SubtreeSpecificationSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/RFC3672SubtreeSpecificationSyntax.java
index 2183d79..6c68329 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/RFC3672SubtreeSpecificationSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/RFC3672SubtreeSpecificationSyntax.java
@@ -28,7 +28,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/RelativeSubtreeSpecificationSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/RelativeSubtreeSpecificationSyntax.java
index c8ee214..c49fbdb 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/RelativeSubtreeSpecificationSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/RelativeSubtreeSpecificationSyntax.java
@@ -29,7 +29,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/SubstringAssertionSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/SubstringAssertionSyntax.java
index 3e7b20a..6b517ec 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/SubstringAssertionSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/SubstringAssertionSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java
index 4c55891..4fbc81d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java
@@ -40,8 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/TelephoneNumberSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/TelephoneNumberSyntax.java
index d0ddbca..16cf18a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/TelephoneNumberSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/TelephoneNumberSyntax.java
@@ -54,7 +54,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java
index 724143e..de5e8e9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java
@@ -42,7 +42,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/TelexNumberSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/TelexNumberSyntax.java
index 03105f0..16ae94e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/TelexNumberSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/TelexNumberSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/UTCTimeSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/UTCTimeSyntax.java
index 25164db..8de339c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/UTCTimeSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/UTCTimeSyntax.java
@@ -51,7 +51,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java
index 43dfb29..ad5abde 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java
@@ -42,7 +42,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
index 7814baf..1e4b811 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
@@ -40,7 +40,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDSyntax.java
index ca0953f..92b7eaa 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/UUIDSyntax.java
@@ -40,7 +40,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java b/opendj-sdk/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java
index b5d6dc9..2f69953 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java
@@ -45,7 +45,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java b/opendj-sdk/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java
index 83c7427..b91c3a7 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java
@@ -42,7 +42,7 @@
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.ResultCode;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.SchemaMessages.*;
import static org.opends.server.schema.SchemaConstants.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tasks/BackupTask.java b/opendj-sdk/opends/src/server/org/opends/server/tasks/BackupTask.java
index f05b01c..d1bd7a2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tasks/BackupTask.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tasks/BackupTask.java
@@ -32,7 +32,7 @@
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.ServerConstants.DATE_FORMAT_GMT_TIME;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.util.ServerConstants.
BACKUP_DIRECTORY_DESCRIPTOR_FILE;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tasks/ExportTask.java b/opendj-sdk/opends/src/server/org/opends/server/tasks/ExportTask.java
index 0a42b18..1b6ebd6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tasks/ExportTask.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tasks/ExportTask.java
@@ -32,7 +32,7 @@
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import org.opends.server.backends.task.Task;
import org.opends.server.backends.task.TaskState;
import org.opends.server.core.DirectoryServer;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tasks/TaskUtils.java b/opendj-sdk/opends/src/server/org/opends/server/tasks/TaskUtils.java
index ffd1971..5208d12 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tasks/TaskUtils.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tasks/TaskUtils.java
@@ -41,7 +41,7 @@
import org.opends.server.config.StringConfigAttribute;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
-import org.opends.server.loggers.Error;
+import org.opends.server.loggers.ErrorLogger;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.messages.TaskMessages;
import org.opends.server.protocols.asn1.ASN1OctetString;
@@ -97,8 +97,9 @@
int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID;
String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
ce.getMessage());
- Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
+ ErrorLogger.logError(ErrorLogCategory.BACKEND,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
return null;
}
catch (Exception e)
@@ -106,8 +107,9 @@
int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID;
String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
getExceptionMessage(e));
- Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
+ ErrorLogger.logError(ErrorLogCategory.BACKEND,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
return null;
}
}
@@ -133,8 +135,9 @@
{
int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN;
String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage());
- Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
+ ErrorLogger.logError(ErrorLogCategory.BACKEND,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
return configEntries;
}
catch (Exception e)
@@ -142,8 +145,9 @@
int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN;
String message = getMessage(msgID, DN_BACKEND_BASE,
getExceptionMessage(e));
- Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
+ ErrorLogger.logError(ErrorLogCategory.BACKEND,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
return configEntries;
}
@@ -156,8 +160,9 @@
{
int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY;
String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage());
- Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
+ ErrorLogger.logError(ErrorLogCategory.BACKEND,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
return configEntries;
}
catch (Exception e)
@@ -165,8 +170,9 @@
int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY;
String message = getMessage(msgID, DN_BACKEND_BASE,
getExceptionMessage(e));
- Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
+ ErrorLogger.logError(ErrorLogCategory.BACKEND,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
return configEntries;
}
@@ -200,8 +206,9 @@
int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID;
String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
ce.getMessage());
- Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
+ ErrorLogger.logError(ErrorLogCategory.BACKEND,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
continue;
}
catch (Exception e)
@@ -209,8 +216,9 @@
int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID;
String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
getExceptionMessage(e));
- Error.logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
+ ErrorLogger.logError(ErrorLogCategory.BACKEND,
+ ErrorLogSeverity.SEVERE_ERROR,
+ message, msgID);
continue;
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/BackUpDB.java b/opendj-sdk/opends/src/server/org/opends/server/tools/BackUpDB.java
index 713dde7..c80462a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/BackUpDB.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/BackUpDB.java
@@ -40,13 +40,13 @@
import org.opends.server.api.Backend;
import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
-import org.opends.server.config.DNConfigAttribute;
-import org.opends.server.config.StringConfigAttribute;
import org.opends.server.core.CoreConfigManager;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.extensions.ConfigFileHandler;
-import org.opends.server.loggers.StartupErrorLogger;
+import org.opends.server.loggers.ThreadFilterTextErrorLogPublisher;
+import org.opends.server.loggers.TextWriter;
+import org.opends.server.loggers.ErrorLogger;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.DirectoryException;
@@ -59,13 +59,12 @@
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.StringArgument;
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.messages.ConfigMessages.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
+import org.opends.server.util.StaticUtils;
import static org.opends.server.tools.ToolConstants.*;
@@ -80,6 +79,7 @@
*/
public class BackUpDB
{
+ private static DN publisherDN = null;
/**
* The main method for BackUpDB tool.
*
@@ -89,6 +89,11 @@
{
int retCode = mainBackUpDB(args);
+ if(publisherDN != null)
+ {
+ ErrorLogger.removeErrorLogPublisher(publisherDN);
+ }
+
if(retCode != 0)
{
System.exit(retCode);
@@ -481,9 +486,20 @@
// FIXME -- Install a custom logger to capture information about the state
// of the export.
- StartupErrorLogger startupLogger = new StartupErrorLogger();
- startupLogger.initializeErrorLogger(null);
- addErrorLogger(startupLogger);
+ try
+ {
+ publisherDN = DN.decode("cn=Custom Logger for BackUpDB");
+ ThreadFilterTextErrorLogPublisher publisher =
+ new ThreadFilterTextErrorLogPublisher(Thread.currentThread(),
+ new TextWriter.STDOUT());
+ ErrorLogger.addErrorLogPublisher(publisherDN, publisher);
+
+ }
+ catch(Exception e)
+ {
+ System.err.println("Error installing the custom error logger: " +
+ StaticUtils.stackTraceToSingleLineString(e));
+ }
}
@@ -492,7 +508,7 @@
ArrayList<Backend> backendList = new ArrayList<Backend>();
ArrayList<ConfigEntry> entryList = new ArrayList<ConfigEntry>();
ArrayList<List<DN>> dnList = new ArrayList<List<DN>>();
- getBackends(backendList, entryList, dnList);
+ BackendToolUtils.getBackends(backendList, entryList, dnList);
int numBackends = backendList.size();
boolean multiple;
@@ -922,229 +938,5 @@
}
return 0;
}
-
-
-
- /**
- * Retrieves information about the backends defined in the Directory Server
- * configuration.
- *
- * @param backendList A list into which instantiated (but not initialized)
- * backend instances will be placed.
- * @param entryList A list into which the config entries associated with
- * the backends will be placed.
- * @param dnList A list into which the set of base DNs for each backend
- * will be placed.
- */
- private static void getBackends(ArrayList<Backend> backendList,
- ArrayList<ConfigEntry> entryList,
- ArrayList<List<DN>> dnList)
- {
- // Get the base entry for all backend configuration.
- DN backendBaseDN = null;
- try
- {
- backendBaseDN = DN.decode(DN_BACKEND_BASE);
- }
- catch (DirectoryException de)
- {
- int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN;
- String message = getMessage(msgID, DN_BACKEND_BASE, de.getErrorMessage());
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
- msgID);
- System.exit(1);
- }
- catch (Exception e)
- {
- int msgID = MSGID_CANNOT_DECODE_BACKEND_BASE_DN;
- String message = getMessage(msgID, DN_BACKEND_BASE,
- getExceptionMessage(e));
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
- msgID);
-
- System.exit(1);
- }
-
- ConfigEntry baseEntry = null;
- try
- {
- baseEntry = DirectoryServer.getConfigEntry(backendBaseDN);
- }
- catch (ConfigException ce)
- {
- int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY;
- String message = getMessage(msgID, DN_BACKEND_BASE, ce.getMessage());
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
- msgID);
- System.exit(1);
- }
- catch (Exception e)
- {
- int msgID = MSGID_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY;
- String message = getMessage(msgID, DN_BACKEND_BASE,
- getExceptionMessage(e));
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
- msgID);
- System.exit(1);
- }
-
-
- // Iterate through the immediate children, attempting to parse them as
- // backends.
- for (ConfigEntry configEntry : baseEntry.getChildren().values())
- {
- // Get the backend ID attribute from the entry. If there isn't one, then
- // skip the entry.
- String backendID = null;
- try
- {
- int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID;
- StringConfigAttribute idStub =
- new StringConfigAttribute(ATTR_BACKEND_ID, getMessage(msgID),
- true, false, true);
- StringConfigAttribute idAttr =
- (StringConfigAttribute) configEntry.getConfigAttribute(idStub);
- if (idAttr == null)
- {
- continue;
- }
- else
- {
- backendID = idAttr.activeValue();
- }
- }
- catch (ConfigException ce)
- {
- int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID;
- String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
- ce.getMessage());
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
- System.exit(1);
- }
- catch (Exception e)
- {
- int msgID = MSGID_CANNOT_DETERMINE_BACKEND_ID;
- String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
- getExceptionMessage(e));
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
- System.exit(1);
- }
-
-
- // Get the backend class name attribute from the entry. If there isn't
- // one, then just skip the entry.
- String backendClassName = null;
- try
- {
- int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS;
- StringConfigAttribute classStub =
- new StringConfigAttribute(ATTR_BACKEND_CLASS, getMessage(msgID),
- true, false, false);
- StringConfigAttribute classAttr =
- (StringConfigAttribute) configEntry.getConfigAttribute(classStub);
- if (classAttr == null)
- {
- continue;
- }
- else
- {
- backendClassName = classAttr.activeValue();
- }
- }
- catch (ConfigException ce)
- {
- int msgID = MSGID_CANNOT_DETERMINE_BACKEND_CLASS;
- String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
- ce.getMessage());
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
- System.exit(1);
- }
- catch (Exception e)
- {
- int msgID = MSGID_CANNOT_DETERMINE_BACKEND_CLASS;
- String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
- getExceptionMessage(e));
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
- System.exit(1);
- }
-
- Class backendClass = null;
- try
- {
- backendClass = Class.forName(backendClassName);
- }
- catch (Exception e)
- {
- int msgID = MSGID_CANNOT_LOAD_BACKEND_CLASS;
- String message = getMessage(msgID, backendClassName,
- String.valueOf(configEntry.getDN()),
- getExceptionMessage(e));
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
- System.exit(1);
- }
-
- Backend backend = null;
- try
- {
- backend = (Backend) backendClass.newInstance();
- backend.setBackendID(backendID);
- }
- catch (Exception e)
- {
- int msgID = MSGID_CANNOT_INSTANTIATE_BACKEND_CLASS;
- String message = getMessage(msgID, backendClassName,
- String.valueOf(configEntry.getDN()),
- getExceptionMessage(e));
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
- System.exit(1);
- }
-
-
- // Get the base DN attribute from the entry. If there isn't one, then
- // just skip this entry.
- List<DN> baseDNs = null;
- try
- {
- int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS;
- DNConfigAttribute baseDNStub =
- new DNConfigAttribute(ATTR_BACKEND_BASE_DN, getMessage(msgID),
- true, true, true);
- DNConfigAttribute baseDNAttr =
- (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub);
- if (baseDNAttr == null)
- {
- msgID = MSGID_NO_BASES_FOR_BACKEND;
- String message = getMessage(msgID,
- String.valueOf(configEntry.getDN()));
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
- }
- else
- {
- baseDNs = baseDNAttr.activeValues();
- }
- }
- catch (Exception e)
- {
- int msgID = MSGID_CANNOT_DETERMINE_BASES_FOR_BACKEND;
- String message = getMessage(msgID, String.valueOf(configEntry.getDN()),
- getExceptionMessage(e));
- logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
- message, msgID);
- System.exit(1);
- }
-
-
- backendList.add(backend);
- entryList.add(configEntry);
- dnList.add(baseDNs);
- }
- }
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/BackendToolUtils.java b/opendj-sdk/opends/src/server/org/opends/server/tools/BackendToolUtils.java
index 42c2a50..cfb0214 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/BackendToolUtils.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/BackendToolUtils.java
@@ -41,7 +41,7 @@
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.ConfigMessages.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.util.StaticUtils.*;
import java.util.ArrayList;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java b/opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java
index 139e229..d9eb6fd 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/ExportLDIF.java
@@ -40,7 +40,9 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.extensions.ConfigFileHandler;
-import org.opends.server.loggers.StartupErrorLogger;
+import org.opends.server.loggers.ThreadFilterTextErrorLogPublisher;
+import org.opends.server.loggers.TextWriter;
+import org.opends.server.loggers.ErrorLogger;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
@@ -56,11 +58,12 @@
import org.opends.server.util.args.IntegerArgument;
import org.opends.server.util.args.StringArgument;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
+import org.opends.server.util.StaticUtils;
import static org.opends.server.tools.ToolConstants.*;
@@ -73,6 +76,7 @@
*/
public class ExportLDIF
{
+ private static DN publisherDN = null;
/**
* The main method for ExportLDIF tool.
*
@@ -83,6 +87,11 @@
{
int retCode = mainExportLDIF(args);
+ if(publisherDN != null)
+ {
+ ErrorLogger.removeErrorLogPublisher(publisherDN);
+ }
+
if(retCode != 0)
{
System.exit(retCode);
@@ -423,9 +432,21 @@
// FIXME -- Install a custom logger to capture information about the state
// of the export.
- StartupErrorLogger startupLogger = new StartupErrorLogger();
- startupLogger.initializeErrorLogger(null);
- addErrorLogger(startupLogger);
+ try
+ {
+ publisherDN = DN.decode("cn=Custom Logger for ExportLDIF");
+ ThreadFilterTextErrorLogPublisher publisher =
+ new ThreadFilterTextErrorLogPublisher(Thread.currentThread(),
+ new TextWriter.STDOUT());
+ ErrorLogger.addErrorLogPublisher(publisherDN, publisher);
+
+ }
+ catch(Exception e)
+ {
+ System.err.println("Error installing the custom error logger: " +
+ StaticUtils.stackTraceToSingleLineString(e));
+ }
+
// Make sure that the Directory Server plugin initialization is performed.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/ImportLDIF.java b/opendj-sdk/opends/src/server/org/opends/server/tools/ImportLDIF.java
index 274fff4..6648072 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/ImportLDIF.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/ImportLDIF.java
@@ -42,7 +42,9 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.extensions.ConfigFileHandler;
-import org.opends.server.loggers.StartupErrorLogger;
+import org.opends.server.loggers.ThreadFilterTextErrorLogPublisher;
+import org.opends.server.loggers.TextWriter;
+import org.opends.server.loggers.ErrorLogger;
import org.opends.server.tools.makeldif.TemplateFile;
import org.opends.server.types.AttributeType;
import org.opends.server.types.DirectoryException;
@@ -60,11 +62,12 @@
import org.opends.server.util.args.StringArgument;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
+import org.opends.server.util.StaticUtils;
import static org.opends.server.tools.ToolConstants.*;
@@ -82,6 +85,7 @@
*/
public static final int LDIF_BUFFER_SIZE = 1048576;
+ private static DN publisherDN = null;
/**
@@ -93,6 +97,11 @@
{
int retCode = mainImportLDIF(args);
+ if(publisherDN != null)
+ {
+ ErrorLogger.removeErrorLogPublisher(publisherDN);
+ }
+
if(retCode != 0)
{
System.exit(retCode);
@@ -489,9 +498,20 @@
{
// FIXME -- Install a custom logger to capture information about the
// state of the import.
- StartupErrorLogger startupLogger = new StartupErrorLogger();
- startupLogger.initializeErrorLogger(null);
- addErrorLogger(startupLogger);
+ try
+ {
+ publisherDN = DN.decode("cn=Custom Logger for ImportLDIF");
+ ThreadFilterTextErrorLogPublisher publisher =
+ new ThreadFilterTextErrorLogPublisher(Thread.currentThread(),
+ new TextWriter.STDOUT());
+ ErrorLogger.addErrorLogPublisher(publisherDN, publisher);
+
+ }
+ catch(Exception e)
+ {
+ System.err.println("Error installing the custom error logger: " +
+ StaticUtils.stackTraceToSingleLineString(e));
+ }
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java b/opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java
index 82b053a..a9c5a3d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/RebuildIndex.java
@@ -36,12 +36,14 @@
import static org.opends.server.messages.ToolMessages.*;
import org.opends.server.config.ConfigException;
import org.opends.server.config.ConfigEntry;
-import static org.opends.server.loggers.Error.*;
-import static org.opends.server.loggers.Error.logError;
-import org.opends.server.loggers.StartupErrorLogger;
+import static org.opends.server.loggers.ErrorLogger.logError;
+import org.opends.server.loggers.ThreadFilterTextErrorLogPublisher;
+import org.opends.server.loggers.TextWriter;
+import org.opends.server.loggers.ErrorLogger;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
+import org.opends.server.util.StaticUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.CoreConfigManager;
import org.opends.server.core.LockFileManager;
@@ -62,6 +64,8 @@
*/
public class RebuildIndex
{
+ private static DN publisherDN = null;
+
/**
* Processes the command-line arguments and invokes the rebuild process.
*
@@ -69,6 +73,28 @@
*/
public static void main(String[] args)
{
+ int retCode = mainRebuildIndex(args);
+
+ if(publisherDN != null)
+ {
+ ErrorLogger.removeErrorLogPublisher(publisherDN);
+ }
+
+ if(retCode != 0)
+ {
+ System.exit(retCode);
+ }
+ }
+
+ /**
+ * Processes the command-line arguments and invokes the rebuild process.
+ *
+ * @param args The command-line arguments provided to this program.
+ *
+ * @return The error code.
+ */
+ public static int mainRebuildIndex(String[] args)
+ {
// Define the command-line arguments that may be used with this program.
StringArgument configClass = null;
StringArgument configFile = null;
@@ -132,7 +158,7 @@
String message = getMessage(msgID, ae.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
@@ -148,14 +174,14 @@
System.err.println(wrapText(message, MAX_LINE_WIDTH));
System.err.println(argParser.getUsage());
- System.exit(1);
+ return 1;
}
// If we should just display usage information, then print it and exit.
if (argParser.usageDisplayed())
{
- System.exit(0);
+ return 0;
}
@@ -166,7 +192,7 @@
if (numArgs == 0)
{
System.out.println(argParser.getUsage());
- System.exit(1);
+ return 1;
}
@@ -177,7 +203,7 @@
System.err.println(wrapText(message, MAX_LINE_WIDTH));
System.out.println(argParser.getUsage());
- System.exit(1);
+ return 1;
}
// Perform the initial bootstrap of the Directory Server and process the
@@ -194,7 +220,7 @@
int msgID = MSGID_SERVER_BOOTSTRAP_ERROR;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
try
@@ -207,14 +233,14 @@
int msgID = MSGID_CANNOT_LOAD_CONFIG;
String message = getMessage(msgID, ie.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
int msgID = MSGID_CANNOT_LOAD_CONFIG;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
@@ -229,21 +255,21 @@
int msgID = MSGID_CANNOT_LOAD_SCHEMA;
String message = getMessage(msgID, ce.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (InitializationException ie)
{
int msgID = MSGID_CANNOT_LOAD_SCHEMA;
String message = getMessage(msgID, ie.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
int msgID = MSGID_CANNOT_LOAD_SCHEMA;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
@@ -258,21 +284,21 @@
int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG;
String message = getMessage(msgID, ce.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (InitializationException ie)
{
int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG;
String message = getMessage(msgID, ie.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
@@ -286,30 +312,41 @@
int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER;
String message = getMessage(msgID, ce.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (InitializationException ie)
{
int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER;
String message = getMessage(msgID, ie.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
// FIXME -- Install a custom logger to capture information about the state
// of the verify process.
- StartupErrorLogger startupLogger = new StartupErrorLogger();
- startupLogger.initializeErrorLogger(null);
- addErrorLogger(startupLogger);
+ try
+ {
+ publisherDN = DN.decode("cn=Custom Logger for RebuildIndex");
+ ThreadFilterTextErrorLogPublisher publisher =
+ new ThreadFilterTextErrorLogPublisher(Thread.currentThread(),
+ new TextWriter.STDOUT());
+ ErrorLogger.addErrorLogPublisher(publisherDN, publisher);
+
+ }
+ catch(Exception e)
+ {
+ System.err.println("Error installing the custom error logger: " +
+ StaticUtils.stackTraceToSingleLineString(e));
+ }
// Decode the base DN provided by the user.
DN rebuildBaseDN = null;
@@ -324,7 +361,7 @@
de.getErrorMessage());
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
msgID);
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
@@ -333,7 +370,7 @@
getExceptionMessage(e));
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
msgID);
- System.exit(1);
+ return 1;
}
// Get information about the backends defined in the server.
@@ -370,7 +407,7 @@
String message = getMessage(msgID, baseDNString.getValue());
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
message, msgID);
- System.exit(1);
+ return 1;
}
break;
}
@@ -383,7 +420,7 @@
String message = getMessage(msgID, baseDNString.getValue());
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
msgID);
- System.exit(1);
+ return 1;
}
if (!(backend instanceof BackendImpl))
@@ -392,7 +429,7 @@
String message = getMessage(msgID);
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
msgID);
- System.exit(1);
+ return 1;
}
// Initialize the rebuild configuration.
@@ -416,7 +453,7 @@
String.valueOf(failureReason));
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
message, msgID);
- return;
+ return 1;
}
}
catch (Exception e)
@@ -426,7 +463,7 @@
getExceptionMessage(e));
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
message, msgID);
- return;
+ return 1;
}
// Launch the rebuild process.
@@ -467,5 +504,7 @@
message, msgID);
}
}
+
+ return 0;
}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/RestoreDB.java b/opendj-sdk/opends/src/server/org/opends/server/tools/RestoreDB.java
index 81a7c59..cb9798a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/RestoreDB.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/RestoreDB.java
@@ -42,7 +42,9 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.extensions.ConfigFileHandler;
-import org.opends.server.loggers.StartupErrorLogger;
+import org.opends.server.loggers.ThreadFilterTextErrorLogPublisher;
+import org.opends.server.loggers.TextWriter;
+import org.opends.server.loggers.ErrorLogger;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.BackupInfo;
import org.opends.server.types.DirectoryException;
@@ -56,11 +58,12 @@
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.StringArgument;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
+import org.opends.server.util.StaticUtils;
import static org.opends.server.tools.ToolConstants.*;
@@ -73,6 +76,7 @@
*/
public class RestoreDB
{
+ private static DN publisherDN = null;
/**
* The main method for RestoreDB tool.
*
@@ -83,6 +87,11 @@
{
int retCode = mainRestoreDB(args);
+ if(publisherDN != null)
+ {
+ ErrorLogger.removeErrorLogPublisher(publisherDN);
+ }
+
if(retCode != 0)
{
System.exit(retCode);
@@ -342,9 +351,20 @@
// FIXME -- Install a custom logger to capture information about the state
// of the export.
- StartupErrorLogger startupLogger = new StartupErrorLogger();
- startupLogger.initializeErrorLogger(null);
- addErrorLogger(startupLogger);
+ try
+ {
+ publisherDN = DN.decode("cn=Custom Logger for RestoreDB");
+ ThreadFilterTextErrorLogPublisher publisher =
+ new ThreadFilterTextErrorLogPublisher(Thread.currentThread(),
+ new TextWriter.STDOUT());
+ ErrorLogger.addErrorLogPublisher(publisherDN, publisher);
+
+ }
+ catch(Exception e)
+ {
+ System.err.println("Error installing the custom error logger: " +
+ StaticUtils.stackTraceToSingleLineString(e));
+ }
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/VerifyIndex.java b/opendj-sdk/opends/src/server/org/opends/server/tools/VerifyIndex.java
index fdd86bf..ceaecf4 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/VerifyIndex.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/VerifyIndex.java
@@ -37,7 +37,9 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.extensions.ConfigFileHandler;
-import org.opends.server.loggers.StartupErrorLogger;
+import org.opends.server.loggers.ThreadFilterTextErrorLogPublisher;
+import org.opends.server.loggers.TextWriter;
+import org.opends.server.loggers.ErrorLogger;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
import org.opends.server.types.ErrorLogCategory;
@@ -52,10 +54,11 @@
import java.util.List;
import static org.opends.server.messages.ToolMessages.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
+import org.opends.server.util.StaticUtils;
import static org.opends.server.tools.ToolConstants.*;
@@ -68,6 +71,7 @@
*/
public class VerifyIndex
{
+ private static DN publisherDN = null;
/**
* Processes the command-line arguments and invokes the verify process.
*
@@ -75,6 +79,27 @@
*/
public static void main(String[] args)
{
+ int retCode = mainVerifyIndex(args);
+
+ if(publisherDN != null)
+ {
+ ErrorLogger.removeErrorLogPublisher(publisherDN);
+ }
+
+ if(retCode != 0)
+ {
+ System.exit(retCode);
+ }
+ }
+
+ /**
+ * Processes the command-line arguments and invokes the verify process.
+ *
+ * @param args The command-line arguments provided to this program.
+ * @return The error code.
+ */
+ public static int mainVerifyIndex(String[] args)
+ {
// Define the command-line arguments that may be used with this program.
StringArgument configClass = null;
StringArgument configFile = null;
@@ -146,7 +171,7 @@
String message = getMessage(msgID, ae.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
@@ -162,14 +187,14 @@
System.err.println(wrapText(message, MAX_LINE_WIDTH));
System.err.println(argParser.getUsage());
- System.exit(1);
+ return 1;
}
// If we should just display usage information, then print it and exit.
if (argParser.usageDisplayed())
{
- System.exit(0);
+ return 0;
}
@@ -180,7 +205,7 @@
if (numArgs == 0)
{
System.out.println(argParser.getUsage());
- System.exit(1);
+ return 1;
}
@@ -191,7 +216,7 @@
System.err.println(wrapText(message, MAX_LINE_WIDTH));
System.out.println(argParser.getUsage());
- System.exit(1);
+ return 1;
}
// Perform the initial bootstrap of the Directory Server and process the
@@ -208,7 +233,7 @@
int msgID = MSGID_SERVER_BOOTSTRAP_ERROR;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
try
@@ -221,14 +246,14 @@
int msgID = MSGID_CANNOT_LOAD_CONFIG;
String message = getMessage(msgID, ie.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
int msgID = MSGID_CANNOT_LOAD_CONFIG;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
@@ -243,21 +268,21 @@
int msgID = MSGID_CANNOT_LOAD_SCHEMA;
String message = getMessage(msgID, ce.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (InitializationException ie)
{
int msgID = MSGID_CANNOT_LOAD_SCHEMA;
String message = getMessage(msgID, ie.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
int msgID = MSGID_CANNOT_LOAD_SCHEMA;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
@@ -272,21 +297,21 @@
int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG;
String message = getMessage(msgID, ce.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (InitializationException ie)
{
int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG;
String message = getMessage(msgID, ie.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
int msgID = MSGID_CANNOT_INITIALIZE_CORE_CONFIG;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
@@ -300,29 +325,40 @@
int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER;
String message = getMessage(msgID, ce.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (InitializationException ie)
{
int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER;
String message = getMessage(msgID, ie.getMessage());
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
int msgID = MSGID_CANNOT_INITIALIZE_CRYPTO_MANAGER;
String message = getMessage(msgID, getExceptionMessage(e));
System.err.println(wrapText(message, MAX_LINE_WIDTH));
- System.exit(1);
+ return 1;
}
// FIXME -- Install a custom logger to capture information about the state
// of the verify process.
- StartupErrorLogger startupLogger = new StartupErrorLogger();
- startupLogger.initializeErrorLogger(null);
- addErrorLogger(startupLogger);
+ try
+ {
+ publisherDN = DN.decode("cn=Custom Logger for VerifyIndex");
+ ThreadFilterTextErrorLogPublisher publisher =
+ new ThreadFilterTextErrorLogPublisher(Thread.currentThread(),
+ new TextWriter.STDOUT());
+ ErrorLogger.addErrorLogPublisher(publisherDN, publisher);
+
+ }
+ catch(Exception e)
+ {
+ System.err.println("Error installing the custom error logger: " +
+ StaticUtils.stackTraceToSingleLineString(e));
+ }
// Decode the base DN provided by the user.
@@ -338,7 +374,7 @@
de.getErrorMessage());
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
msgID);
- System.exit(1);
+ return 1;
}
catch (Exception e)
{
@@ -347,7 +383,7 @@
getExceptionMessage(e));
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
msgID);
- System.exit(1);
+ return 1;
}
@@ -386,7 +422,7 @@
String message = getMessage(msgID, baseDNString.getValue());
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
message, msgID);
- System.exit(1);
+ return 1;
}
break;
}
@@ -399,7 +435,7 @@
String message = getMessage(msgID, baseDNString.getValue());
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
msgID);
- System.exit(1);
+ return 1;
}
if (!(backend instanceof BackendImpl))
@@ -408,7 +444,7 @@
String message = getMessage(msgID);
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR, message,
msgID);
- System.exit(1);
+ return 1;
}
// Initialize the verify configuration.
@@ -442,7 +478,7 @@
String.valueOf(failureReason));
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
message, msgID);
- return;
+ return 1;
}
}
catch (Exception e)
@@ -452,7 +488,7 @@
getExceptionMessage(e));
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_ERROR,
message, msgID);
- return;
+ return 1;
}
@@ -493,5 +529,7 @@
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_WARNING,
message, msgID);
}
+
+ return 0;
}
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/Entry.java b/opendj-sdk/opends/src/server/org/opends/server/types/Entry.java
index 92e7de6..c722da8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/Entry.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/Entry.java
@@ -54,7 +54,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.UtilityMessages.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/Schema.java b/opendj-sdk/opends/src/server/org/opends/server/types/Schema.java
index 6732d5a..dad1894 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/Schema.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/Schema.java
@@ -53,7 +53,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.BackendMessages.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/SearchFilter.java b/opendj-sdk/opends/src/server/org/opends/server/types/SearchFilter.java
index d3844a8..64a2a2a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/SearchFilter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/SearchFilter.java
@@ -48,7 +48,7 @@
import static
org.opends.server.loggers.debug.DebugLogger.debugVerbose;
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
-import static org.opends.server.loggers.Error.*;
+import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.messages.CoreMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/LDIFReader.java b/opendj-sdk/opends/src/server/org/opends/server/util/LDIFReader.java
index b6bf142..2c91cc5 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/LDIFReader.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/LDIFReader.java
@@ -33,7 +33,7 @@
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
import static org.opends.server.loggers.debug.DebugLogger.debugProtocolElement;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.UtilityMessages.*;
import static org.opends.server.util.StaticUtils.toLowerCase;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java b/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
index 50faed6..550b66d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
@@ -2446,21 +2446,19 @@
/**
- * The name of the system property that can be used to enable or disable
- * the debug logger on startup.
- */
- public static final String PROPERTY_DEBUG_ENABLED =
- "org.opends.server.debug.enabled";
-
-
-
- /**
* The name of the system property that can be used to specify a target
* for the debug logger on startup.
*/
public static final String PROPERTY_DEBUG_TARGET =
"org.opends.server.debug.target";
+ /**
+ * The name of the system property that can be used to specify a level
+ * for the error logger on startup.
+ */
+ public static final String PROPERTY_ERROR_LEVEL =
+ "org.opends.server.error.level";
+
/**
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/Validator.java b/opendj-sdk/opends/src/server/org/opends/server/util/Validator.java
index 121492d..a12c662 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/Validator.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/Validator.java
@@ -392,7 +392,7 @@
}
// Log to the error log.
- org.opends.server.loggers.Error.logError(ErrorLogCategory.CORE_SERVER,
+ org.opends.server.loggers.ErrorLogger.logError(ErrorLogCategory.CORE_SERVER,
ErrorLogSeverity.SEVERE_ERROR,
UtilityMessages.MSGID_VALIDATOR_PRECONDITION_NOT_MET,
messageWithStack);
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/resource/config-changes.ldif b/opendj-sdk/opends/tests/unit-tests-testng/resource/config-changes.ldif
index df6788f..d653288 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/resource/config-changes.ldif
+++ b/opendj-sdk/opends/tests/unit-tests-testng/resource/config-changes.ldif
@@ -333,11 +333,6 @@
-
replace: ds-cfg-key-store-pin-file
-dn: cn=File-Based Debug Logger,cn=Loggers,cn=config
-changetype: modify
-replace: ds-cfg-override-severity
-ds-cfg-override-severity: EXCEPTION=INFO
-
dn: ds-cfg-backend-id=unindexedRoot,cn=Backends,cn=config
changetype: add
objectClass: top
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestAccessLogger.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestAccessLogger.java
deleted file mode 100644
index b0747ce..0000000
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestAccessLogger.java
+++ /dev/null
@@ -1,1162 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2007 Sun Microsystems, Inc.
- */
-package org.opends.server;
-
-
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-import org.opends.server.api.AccessLogger;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.api.ConnectionSecurityProvider;
-import org.opends.server.core.AbandonOperation;
-import org.opends.server.core.AddOperation;
-import org.opends.server.core.BindOperation;
-import org.opends.server.core.CompareOperation;
-import org.opends.server.core.DeleteOperation;
-import org.opends.server.core.ExtendedOperation;
-import org.opends.server.core.ModifyOperation;
-import org.opends.server.core.ModifyDNOperation;
-import org.opends.server.core.SearchOperation;
-import org.opends.server.core.UnbindOperation;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.protocols.asn1.ASN1OctetString;
-import org.opends.server.protocols.ldap.LDAPModification;
-import org.opends.server.types.Attribute;
-import org.opends.server.types.AttributeValue;
-import org.opends.server.types.Control;
-import org.opends.server.types.ByteString;
-import org.opends.server.types.DisconnectReason;
-import org.opends.server.types.DN;
-import org.opends.server.types.Operation;
-import org.opends.server.types.RawAttribute;
-import org.opends.server.types.RawModification;
-import org.opends.server.types.SearchResultEntry;
-import org.opends.server.types.SearchResultReference;
-import org.opends.server.util.TimeThread;
-
-
-
-/**
- * This class provides an implementation of an access logger which will store
- * all messages logged in memory. It provides methods to retrieve and clear the
- * sets of accumulated log messages. It is only intended for use in the context
- * of the unit test framework, where it will provide a means of getting any
- * access log messages associated with failed test cases. Note that because it
- * is only intended for testing purposes, it may include information that might
- * otherwise be considered sensitive or too verbose to include in the log.
- */
-public class TestAccessLogger
- extends AccessLogger
-{
- // The list that will hold the messages logged.
- private final LinkedList<String> messageList;
-
-
-
- /**
- * The singleton instance of this test access logger.
- */
- private static final TestAccessLogger SINGLETON = new TestAccessLogger();
-
-
-
- /**
- * Creates a new instance of this test access logger.
- */
- private TestAccessLogger()
- {
- super();
-
- messageList = new LinkedList<String>();
- }
-
-
-
- /**
- * Retrieves the singleton instance of this test access logger.
- *
- * @return The singleton instance of this test access logger.
- */
- public static TestAccessLogger getInstance()
- {
- return SINGLETON;
- }
-
-
-
- /**
- * Retrieves a copy of the set of messages logged to this error logger since
- * the last time it was cleared. A copy of the list is returned to avoid
- * a ConcurrentModificationException.
- *
- * @return The set of messages logged to this error logger since the last
- * time it was cleared.
- */
- public static List<String> getMessages()
- {
- synchronized (SINGLETON) {
- return new ArrayList<String>(SINGLETON.messageList);
- }
- }
-
-
-
- /**
- * Clears any messages currently stored by this logger.
- */
- public static void clear()
- {
- synchronized (SINGLETON) {
- SINGLETON.messageList.clear();
- }
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public void initializeAccessLogger(ConfigEntry configEntry)
- {
- // No implementation is required.
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void closeAccessLogger()
- {
- messageList.clear();
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logConnect(ClientConnection clientConnection)
- {
- StringBuilder buffer = new StringBuilder();
-
- buffer.append("CONNECT conn=");
- buffer.append(clientConnection.getConnectionID());
- buffer.append(" address=\"");
- buffer.append(clientConnection.getClientAddress());
- buffer.append("\" connhandler=\"");
- buffer.append(
- clientConnection.getConnectionHandler().getConnectionHandlerName());
- buffer.append("\" security=\"");
-
- ConnectionSecurityProvider securityProvider =
- clientConnection.getConnectionSecurityProvider();
- if (securityProvider == null)
- {
- buffer.append("none\"");
- }
- else
- {
- buffer.append(securityProvider.getSecurityMechanismName());
- buffer.append("\"");
- }
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logDisconnect(ClientConnection clientConnection,
- DisconnectReason disconnectReason,
- String message)
- {
- StringBuilder buffer = new StringBuilder();
-
- buffer.append("DISCONNECT conn=");
- buffer.append(clientConnection.getConnectionID());
- buffer.append(" reason=\"");
- buffer.append(disconnectReason);
- buffer.append("\" message=\"");
-
- if (message != null)
- {
- buffer.append(message);
- }
-
- buffer.append("\"");
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logAbandonRequest(AbandonOperation abandonOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(abandonOperation, buffer);
- buffer.append(" targetMsgID=");
- buffer.append(abandonOperation.getIDToAbandon());
- addRequestControls(abandonOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logAbandonResult(AbandonOperation abandonOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(abandonOperation, buffer);
- addResponseControls(abandonOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logAddRequest(AddOperation addOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(addOperation, buffer);
- buffer.append(" dn=\"");
- buffer.append(addOperation.getRawEntryDN());
- buffer.append("\" attributes={");
-
- Iterator<RawAttribute> attrIterator =
- addOperation.getRawAttributes().iterator();
- if (attrIterator.hasNext())
- {
- RawAttribute attr = attrIterator.next();
- buffer.append(attr.getAttributeType());
- buffer.append("={\"");
-
- Iterator<ASN1OctetString> valueIterator = attr.getValues().iterator();
- if (valueIterator.hasNext())
- {
- buffer.append(valueIterator.next().stringValue());
- while (valueIterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(valueIterator.next().stringValue());
- }
- }
- buffer.append("\"}");
-
- while (attrIterator.hasNext())
- {
- buffer.append(",");
- attr = attrIterator.next();
- buffer.append(attr.getAttributeType());
- buffer.append("={\"");
-
- valueIterator = attr.getValues().iterator();
- if (valueIterator.hasNext())
- {
- buffer.append(valueIterator.next().stringValue());
- while (valueIterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(valueIterator.next().stringValue());
- }
- }
- buffer.append("\"}");
- }
- }
-
- buffer.append("}");
- addRequestControls(addOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logAddResponse(AddOperation addOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(addOperation, buffer);
- addResponseControls(addOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logBindRequest(BindOperation bindOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(bindOperation, buffer);
-
- switch (bindOperation.getAuthenticationType())
- {
- case SIMPLE:
- buffer.append(" type=\"SIMPLE\" dn=\"");
- buffer.append(bindOperation.getRawBindDN().stringValue());
- buffer.append("\" password=\"");
- buffer.append(bindOperation.getSimplePassword());
- buffer.append("\"");
- break;
- case SASL:
- buffer.append(" type=\"SASL\" mechanism=\"");
- buffer.append(bindOperation.getSASLMechanism());
- buffer.append("\" dn=\"");
- buffer.append(bindOperation.getRawBindDN().stringValue());
- buffer.append("\"");
- break;
- default:
- buffer.append(" type=\"");
- buffer.append(bindOperation.getAuthenticationType());
- buffer.append("\"");
- break;
- }
-
- addRequestControls(bindOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logBindResponse(BindOperation bindOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(bindOperation, buffer);
-
- String authFailureReason = bindOperation.getAuthFailureReason();
- if (authFailureReason != null)
- {
- buffer.append(" authFailureReason=\"");
- buffer.append(authFailureReason);
- buffer.append("\"");
- }
-
- DN authDN = bindOperation.getClientConnection().getAuthenticationInfo().
- getAuthenticationDN();
- if (authDN == null)
- {
- buffer.append(" authDN=\"\"");
- }
- else
- {
- buffer.append(" authDN=\"");
- buffer.append(authDN);
- buffer.append("\"");
- }
-
- addResponseControls(bindOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logCompareRequest(CompareOperation compareOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(compareOperation, buffer);
-
- buffer.append(" dn=\"");
- buffer.append(compareOperation.getRawEntryDN().stringValue());
- buffer.append("\" attributeType=\"");
- buffer.append(compareOperation.getRawAttributeType());
- buffer.append("\" assertionValue=\"");
- buffer.append(compareOperation.getAssertionValue().stringValue());
- buffer.append("\"");
-
- addRequestControls(compareOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logCompareResponse(CompareOperation
- compareOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(compareOperation, buffer);
- addResponseControls(compareOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logDeleteRequest(DeleteOperation deleteOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(deleteOperation, buffer);
- buffer.append(" dn=\"");
- buffer.append(deleteOperation.getRawEntryDN().stringValue());
- buffer.append("\"");
- addRequestControls(deleteOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logDeleteResponse(DeleteOperation deleteOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(deleteOperation, buffer);
- addResponseControls(deleteOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logExtendedRequest(ExtendedOperation
- extendedOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(extendedOperation, buffer);
- buffer.append(" requestOID=\"");
- buffer.append(extendedOperation.getRequestOID());
- buffer.append("\"");
- addRequestControls(extendedOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logExtendedResponse(ExtendedOperation
- extendedOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(extendedOperation, buffer);
-
- String responseOID = extendedOperation.getResponseOID();
- if (responseOID == null)
- {
- buffer.append(" responseOID=\"\"");
- }
- else
- {
- buffer.append(" responseOID=\"");
- buffer.append(responseOID);
- buffer.append("\"");
- }
-
- addResponseControls(extendedOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logModifyRequest(ModifyOperation modifyOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(modifyOperation, buffer);
-
- buffer.append(" dn=\"");
- buffer.append(modifyOperation.getRawEntryDN().stringValue());
- buffer.append("\" mods={");
-
- Iterator<RawModification> modIterator =
- modifyOperation.getRawModifications().iterator();
- if (modIterator.hasNext())
- {
- RawModification mod = modIterator.next();
- buffer.append(mod.getModificationType().toString());
- buffer.append(" attribute=");
- buffer.append(mod.getAttribute().getAttributeType());
- buffer.append(" values={");
-
- Iterator<ASN1OctetString> valueIterator =
- mod.getAttribute().getValues().iterator();
- if (valueIterator.hasNext())
- {
- buffer.append("\"");
- buffer.append(valueIterator.next().stringValue());
-
- while(valueIterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(valueIterator.next().stringValue());
- }
-
- buffer.append("\"");
- }
-
- while (modIterator.hasNext())
- {
- mod = modIterator.next();
- buffer.append(mod.getModificationType().toString());
- buffer.append(" attribute=");
- buffer.append(mod.getAttribute().getAttributeType());
- buffer.append(" values={");
-
- valueIterator = mod.getAttribute().getValues().iterator();
- if (valueIterator.hasNext())
- {
- buffer.append("\"");
- buffer.append(valueIterator.next().stringValue());
-
- while(valueIterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(valueIterator.next().stringValue());
- }
-
- buffer.append("\"");
- }
- }
- }
-
- buffer.append("}");
-
- addRequestControls(modifyOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logModifyResponse(ModifyOperation modifyOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(modifyOperation, buffer);
- addResponseControls(modifyOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logModifyDNRequest(ModifyDNOperation
- modifyDNOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(modifyDNOperation, buffer);
-
- buffer.append(" dn=\"");
- buffer.append(modifyDNOperation.getRawEntryDN().stringValue());
- buffer.append("\" newRDN=\"");
- buffer.append(modifyDNOperation.getRawNewRDN().stringValue());
- buffer.append("\" deleteOldRDN=");
- buffer.append(modifyDNOperation.deleteOldRDN());
-
- ByteString newSuperior = modifyDNOperation.getRawNewSuperior();
- if (newSuperior == null)
- {
- buffer.append(" newSuperior=\"\"");
- }
- else
- {
- buffer.append(" newSuperior=\"");
- buffer.append(newSuperior.stringValue());
- buffer.append("\"");
- }
-
- addRequestControls(modifyDNOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logModifyDNResponse(ModifyDNOperation
- modifyDNOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(modifyDNOperation, buffer);
- addResponseControls(modifyDNOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logSearchRequest(SearchOperation searchOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(searchOperation, buffer);
-
- buffer.append(" baseDN=\"");
- buffer.append(searchOperation.getRawBaseDN().stringValue());
- buffer.append("\" scope=");
- buffer.append(searchOperation.getScope());
- buffer.append(" derefAliases=");
- buffer.append(searchOperation.getDerefPolicy());
- buffer.append(" sizeLimit=");
- buffer.append(searchOperation.getSizeLimit());
- buffer.append(" timeLimit=");
- buffer.append(searchOperation.getTimeLimit());
- buffer.append(" typesOnly=");
- buffer.append(searchOperation.getTypesOnly());
- buffer.append(" filter=\"");
- buffer.append(searchOperation.getRawFilter().toString());
- buffer.append("\" attrs={");
-
- Iterator<String> iterator = searchOperation.getAttributes().iterator();
- if (iterator.hasNext())
- {
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(",");
- buffer.append(iterator.next());
- }
- }
-
- buffer.append("}");
-
- addRequestControls(searchOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logSearchResultEntry(SearchOperation searchOperation,
- SearchResultEntry searchEntry)
- {
- StringBuilder buffer = new StringBuilder();
-
- buffer.append("SEARCH ENTRY conn=");
- buffer.append(searchOperation.getConnectionID());
- buffer.append(" op=");
- buffer.append(searchOperation.getOperationID());
- buffer.append(" msgID=");
- buffer.append(searchOperation.getMessageID());
- buffer.append(" dn=\"");
- buffer.append(searchEntry.getDN());
- buffer.append("\" userAttributes={");
-
- Iterator<List<Attribute>> attrListIterator =
- searchEntry.getUserAttributes().values().iterator();
- if (attrListIterator.hasNext())
- {
- List<Attribute> attrList = attrListIterator.next();
- Iterator<Attribute> attrIterator = attrList.iterator();
- if (attrIterator.hasNext())
- {
- Attribute attr = attrIterator.next();
- buffer.append(attr.getName());
- buffer.append(" values={");
-
- Iterator<AttributeValue> valueIterator = attr.getValues().iterator();
- if (valueIterator.hasNext())
- {
- buffer.append("\"");
- buffer.append(valueIterator.next().getStringValue());
-
- while (valueIterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(valueIterator.next().getStringValue());
- }
-
- buffer.append("\"");
- }
-
- buffer.append("}");
- }
-
- while (attrListIterator.hasNext())
- {
- attrList = attrListIterator.next();
- attrIterator = attrList.iterator();
- if (attrIterator.hasNext())
- {
- Attribute attr = attrIterator.next();
- buffer.append(attr.getName());
- buffer.append(" values={");
-
- Iterator<AttributeValue> valueIterator = attr.getValues().iterator();
- if (valueIterator.hasNext())
- {
- buffer.append("\"");
- buffer.append(valueIterator.next().getStringValue());
-
- while (valueIterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(valueIterator.next().getStringValue());
- }
-
- buffer.append("\"");
- }
-
- buffer.append("}");
- }
- }
- }
-
- buffer.append("}");
- buffer.append("\" operationalAttributes={");
-
- attrListIterator =
- searchEntry.getOperationalAttributes().values().iterator();
- if (attrListIterator.hasNext())
- {
- List<Attribute> attrList = attrListIterator.next();
- Iterator<Attribute> attrIterator = attrList.iterator();
- if (attrIterator.hasNext())
- {
- Attribute attr = attrIterator.next();
- buffer.append(attr.getName());
- buffer.append(" values={");
-
- Iterator<AttributeValue> valueIterator = attr.getValues().iterator();
- if (valueIterator.hasNext())
- {
- buffer.append("\"");
- buffer.append(valueIterator.next().getStringValue());
-
- while (valueIterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(valueIterator.next().getStringValue());
- }
-
- buffer.append("\"");
- }
-
- buffer.append("}");
- }
-
- while (attrListIterator.hasNext())
- {
- attrList = attrListIterator.next();
- attrIterator = attrList.iterator();
- if (attrIterator.hasNext())
- {
- Attribute attr = attrIterator.next();
- buffer.append(attr.getName());
- buffer.append(" values={");
-
- Iterator<AttributeValue> valueIterator = attr.getValues().iterator();
- if (valueIterator.hasNext())
- {
- buffer.append("\"");
- buffer.append(valueIterator.next().getStringValue());
-
- while (valueIterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(valueIterator.next().getStringValue());
- }
-
- buffer.append("\"");
- }
-
- buffer.append("}");
- }
- }
- }
-
- buffer.append("}");
-
- List<Control> controls = searchEntry.getControls();
- if ((controls != null) && (! controls.isEmpty()))
- {
- buffer.append(" controls={");
-
- Iterator<Control> iterator = controls.iterator();
-
- Control c = iterator.next();
- buffer.append(c.getOID());
- buffer.append(":");
- buffer.append(c.isCritical());
-
- while (iterator.hasNext())
- {
- buffer.append(",");
- c = iterator.next();
- buffer.append(c.getOID());
- buffer.append(":");
- buffer.append(c.isCritical());
- }
-
- buffer.append("}");
- }
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logSearchResultReference(
- SearchOperation searchOperation,
- SearchResultReference searchReference)
- {
- StringBuilder buffer = new StringBuilder();
-
- buffer.append("SEARCH REFERENCE conn=");
- buffer.append(searchOperation.getConnectionID());
- buffer.append(" op=");
- buffer.append(searchOperation.getOperationID());
- buffer.append(" msgID=");
- buffer.append(searchOperation.getMessageID());
- buffer.append(" referralURLs={");
-
- if (searchReference.getReferralURLs() != null)
- {
- Iterator<String> iterator = searchReference.getReferralURLs().iterator();
- if (iterator.hasNext())
- {
- buffer.append("\"");
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(iterator.next());
- }
-
- buffer.append("\"");
- }
- }
-
- buffer.append("}");
-
- List<Control> controls = searchReference.getControls();
- if ((controls != null) && (! controls.isEmpty()))
- {
- buffer.append(" controls={");
-
- Iterator<Control> iterator = controls.iterator();
-
- Control c = iterator.next();
- buffer.append(c.getOID());
- buffer.append(":");
- buffer.append(c.isCritical());
-
- while (iterator.hasNext())
- {
- buffer.append(",");
- c = iterator.next();
- buffer.append(c.getOID());
- buffer.append(":");
- buffer.append(c.isCritical());
- }
-
- buffer.append("}");
- }
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logSearchResultDone(SearchOperation searchOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonResultElements(searchOperation, buffer);
- buffer.append(" numEntries=");
- buffer.append(searchOperation.getEntriesSent());
- buffer.append(" numReferences=");
- buffer.append(searchOperation.getReferencesSent());
- addResponseControls(searchOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logUnbind(UnbindOperation unbindOperation)
- {
- StringBuilder buffer = new StringBuilder();
-
- addCommonRequestElements(unbindOperation, buffer);
- addRequestControls(unbindOperation, buffer);
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(Object o)
- {
- return (this == o);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public int hashCode()
- {
- return 1;
- }
-
-
-
- /**
- * Adds a set of information common to all types of operation requests to the
- * provided buffer.
- *
- * @param operation The operation from which to obtain the information.
- * @param buffer The buffer to which the information is to be written.
- */
- private void addCommonRequestElements(Operation operation,
- StringBuilder buffer)
- {
- buffer.append(operation.getOperationType().getOperationName());
- buffer.append(" REQUEST conn=");
- buffer.append(operation.getConnectionID());
- buffer.append(" op=");
- buffer.append(operation.getOperationID());
- buffer.append(" msgID=");
- buffer.append(operation.getMessageID());
- buffer.append(" time=" + TimeThread.getTime());
- buffer.append(" thread=" + Thread.currentThread().getName());
- }
-
-
-
- /**
- * Adds a set of information common to all types of operation results to the
- * provided buffer.
- *
- * @param operation The operation from which to obtain the information.
- * @param buffer The buffer to which the information is to be written.
- */
- private void addCommonResultElements(Operation operation,
- StringBuilder buffer)
- {
- buffer.append(operation.getOperationType().getOperationName());
- buffer.append(" RESULT conn=");
- buffer.append(operation.getConnectionID());
- buffer.append(" op=");
- buffer.append(operation.getOperationID());
- buffer.append(" msgID=");
- buffer.append(operation.getMessageID());
- buffer.append(" time=" + TimeThread.getTime());
- buffer.append(" thread=" + Thread.currentThread().getName());
- buffer.append(" resultCode=\"");
- buffer.append(operation.getResultCode());
- buffer.append("\" message=\"");
- buffer.append(operation.getErrorMessage().toString());
- buffer.append("\" matchedDN=\"");
-
- DN matchedDN = operation.getMatchedDN();
- if (matchedDN != null)
- {
- buffer.append(matchedDN);
- }
- buffer.append("\" referralURLs={");
-
- if (operation.getReferralURLs() != null)
- {
- Iterator<String> iterator = operation.getReferralURLs().iterator();
- if (iterator.hasNext())
- {
- buffer.append("\"");
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append("\",\"");
- buffer.append(iterator.next());
- }
-
- buffer.append("\"");
- }
- }
-
- StringBuilder additionalLogMessage = operation.getAdditionalLogMessage();
- if (additionalLogMessage.length() > 0)
- {
- buffer.append(" additionalLogMessage\"");
- buffer.append(additionalLogMessage.toString());
- buffer.append("\"");
- }
-
- buffer.append("}");
- }
-
-
-
- /**
- * Adds information about the request controls (if any) for the operation into
- * the provided buffer.
- *
- * @param operation The operation from which to obtain the information.
- * @param buffer The buffer to which the information is to be written.
- */
- private void addRequestControls(Operation operation, StringBuilder buffer)
- {
- List<Control> controls = operation.getRequestControls();
- if ((controls != null) && (! controls.isEmpty()))
- {
- buffer.append(" controls={");
-
- Iterator<Control> iterator = controls.iterator();
-
- Control c = iterator.next();
- buffer.append(c.getOID());
- buffer.append(":");
- buffer.append(c.isCritical());
-
- while (iterator.hasNext())
- {
- buffer.append(",");
- c = iterator.next();
- buffer.append(c.getOID());
- buffer.append(":");
- buffer.append(c.isCritical());
- }
-
- buffer.append("}");
- }
- }
-
-
-
- /**
- * Adds information about the response controls (if any) for the operation
- * into the provided buffer.
- *
- * @param operation The operation from which to obtain the information.
- * @param buffer The buffer to which the information is to be written.
- */
- private void addResponseControls(Operation operation, StringBuilder buffer)
- {
- List<Control> controls = operation.getResponseControls();
- if ((controls != null) && (! controls.isEmpty()))
- {
- buffer.append(" controls={");
-
- Iterator<Control> iterator = controls.iterator();
-
- Control c = iterator.next();
- buffer.append(c.getOID());
- buffer.append(":");
- buffer.append(c.isCritical());
-
- while (iterator.hasNext())
- {
- buffer.append(",");
- c = iterator.next();
- buffer.append(c.getOID());
- buffer.append(":");
- buffer.append(c.isCritical());
- }
-
- buffer.append("}");
- }
- }
-}
-
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index 8d6a286..c356d62 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -55,10 +55,11 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.extensions.ConfigFileHandler;
-import org.opends.server.loggers.Access;
-import org.opends.server.loggers.Error;
-import org.opends.server.loggers.debug.DebugLogFormatter;
-import org.opends.server.loggers.debug.DebugConfiguration;
+import org.opends.server.loggers.AccessLogger;
+import org.opends.server.loggers.TextErrorLogPublisher;
+import org.opends.server.loggers.ErrorLogger;
+import org.opends.server.loggers.TextAccessLogPublisher;
+import org.opends.server.loggers.debug.TextDebugLogPublisher;
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.plugins.InvocationCounterPlugin;
import org.opends.server.protocols.internal.InternalClientConnection;
@@ -165,20 +166,6 @@
return;
}
- String debugTarget = System.getProperty("org.opends.test.debug.target");
- if(debugTarget != null)
- {
- System.setProperty("org.opends.server.debug.enabled", "true");
- System.setProperty("org.opends.server.debug.target.1", debugTarget);
- }
- DebugConfiguration testDebugConfig =
- DebugConfiguration.getStartupConfiguration();
- testDebugConfig.removeAllPublishers(true);
- testDebugConfig.addPublisher(TestListener.DEBUG_LOG_PUBLISHER);
-
- DebugLogger debugLogger = DebugLogger.getLogger();
- debugLogger.updateConfiguration(testDebugConfig);
-
InvocationCounterPlugin.resetStartupCalled();
// Get the build root and use it to create a test package directory.
@@ -196,6 +183,8 @@
testRoot.mkdirs();
//db_verify is second jeb backend used by the jeb verify test cases
//db_rebuild is the third jeb backend used by the jeb rebuild test cases
+ //db_unindexed is the forth backend used by the unindexed search privilege
+ //test cases
String[] subDirectories = { "bak", "bin", "changelogDb", "classes",
"config", "db", "db_verify", "ldif", "lib",
"locks", "logs", "db_rebuild", "db_unindexed",
@@ -315,9 +304,43 @@
DirectoryServer directoryServer = DirectoryServer.getInstance();
directoryServer.bootstrapServer();
directoryServer.initializeConfiguration(configClass, configFile);
- Error.removeAllErrorLoggers(false);
- Access.addAccessLogger(TestAccessLogger.getInstance());
- Error.addErrorLogger(TestErrorLogger.getInstance());
+
+ String debugTarget = System.getProperty("org.opends.test.debug.target");
+ if(debugTarget != null)
+ {
+ System.setProperty("org.opends.server.debug.enabled", "true");
+ System.setProperty("org.opends.server.debug.target.1", debugTarget);
+ }
+
+ try
+ {
+ TextDebugLogPublisher startupDebugPublisher =
+ TextDebugLogPublisher.getStartupTextDebugPublisher(
+ TestListener.DEBUG_TEXT_WRITER);
+ DebugLogger.removeAllDebugLogPublishers();
+ DebugLogger.addDebugLogPublisher(DN.decode("cn=Test Debug Publisher"),
+ startupDebugPublisher);
+
+ TextErrorLogPublisher startupErrorPublisher =
+ TextErrorLogPublisher.getStartupTextErrorPublisher(
+ TestListener.ERROR_TEXT_WRITER);
+ ErrorLogger.removeAllErrorLogPublishers();
+ ErrorLogger.addErrorLogPublisher(DN.decode("cn=Test Error Publisher"),
+ startupErrorPublisher);
+
+ TextAccessLogPublisher startupAccessPublisher =
+ TextAccessLogPublisher.getStartupTextAccessPublisher(
+ TestListener.ACCESS_TEXT_WRITER);
+ AccessLogger.removeAllAccessLogPublishers();
+ AccessLogger.addAccessLogPublisher(DN.decode("cn=Test Access Publisher"),
+ startupAccessPublisher);
+ }
+ catch(Exception e)
+ {
+ System.out.println("Error installing test log publishers: " +
+ e.toString());
+ }
+
directoryServer.startServer();
assertTrue(InvocationCounterPlugin.startupCalled());
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestErrorLogger.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestErrorLogger.java
deleted file mode 100644
index 7be5bc6..0000000
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestErrorLogger.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2007 Sun Microsystems, Inc.
- */
-package org.opends.server;
-
-
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-import org.opends.server.api.ErrorLogger;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.types.ErrorLogCategory;
-import org.opends.server.types.ErrorLogSeverity;
-
-
-/**
- * This class provides an implementation of an error logger which will store all
- * messages logged in memory. It provides methods to retrieve and clear the
- * sets of accumulated log messages. It is only intended for use in the context
- * of the unit test framework, where it will provide a means of getting any
- * error log messages associated with failed test cases.
- */
-public class TestErrorLogger
- extends ErrorLogger
-{
- // The list that will hold the messages logged.
- private final LinkedList<String> messageList;
-
-
-
- /**
- * The singleton instance of this test access logger.
- */
- private static final TestErrorLogger SINGLETON = new TestErrorLogger();
-
-
-
- /**
- * Creates a new instance of this test error logger.
- */
- private TestErrorLogger()
- {
- super();
-
- messageList = new LinkedList<String>();
- }
-
-
-
- /**
- * Retrieves the singleton instance of this test error logger.
- *
- * @return The singleton instance of this test error logger.
- */
- public static TestErrorLogger getInstance()
- {
- return SINGLETON;
- }
-
-
-
- /**
- * Retrieves a copy of the set of messages logged to this error logger since
- * the last time it was cleared. A copy of the list is returned to avoid
- * a ConcurrentModificationException.
- *
- * @return The set of messages logged to this error logger since the last
- * time it was cleared.
- */
- public static List<String> getMessages()
- {
- synchronized (SINGLETON) {
- return new ArrayList<String>(SINGLETON.messageList);
- }
- }
-
-
-
- /**
- * Clears any messages currently stored by this logger.
- */
- public static void clear()
- {
- synchronized (SINGLETON) {
- SINGLETON.messageList.clear();
- }
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public void initializeErrorLogger(ConfigEntry configEntry)
- {
- // No implementation is required.
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void closeErrorLogger()
- {
- messageList.clear();
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized void logError(ErrorLogCategory category,
- ErrorLogSeverity severity, String message,
- int errorID)
- {
- StringBuilder buffer = new StringBuilder();
-
- buffer.append("category=\"");
- buffer.append(category);
- buffer.append("\" severity=\"");
- buffer.append(severity);
- buffer.append("\" msgID=");
- buffer.append(errorID);
- buffer.append(" message=\"");
- buffer.append(message);
- buffer.append("\"");
-
- messageList.add(buffer.toString());
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized boolean equals(Object o)
- {
- return (this == o);
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public synchronized int hashCode()
- {
- return 1;
- }
-}
-
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestListener.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestListener.java
index 9c47ba6..f596587 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestListener.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestListener.java
@@ -36,12 +36,6 @@
import org.testng.xml.XmlSuite;
import static org.opends.server.util.ServerConstants.EOL;
import static org.opends.server.TestCaseUtils.originalSystemErr;
-import org.opends.server.loggers.debug.DebugLogFormatter;
-import org.opends.server.loggers.debug.DebugConfiguration;
-import org.opends.server.loggers.debug.TraceSettings;
-import org.opends.server.loggers.debug.DebugLogger;
-import org.opends.server.loggers.LogLevel;
-import org.opends.server.types.DebugLogLevel;
import java.util.List;
import java.util.LinkedHashMap;
@@ -71,10 +65,22 @@
public static final String ANT_TESTS_FAILED_FILE_NAME = ".tests-failed-marker";
/**
- * The Log Publisher for the Debug Logger
+ * The test text writer for the Debug Logger
*/
- public static TestLogPublisher DEBUG_LOG_PUBLISHER =
- new TestLogPublisher(new DebugLogFormatter());
+ public static TestTextWriter DEBUG_TEXT_WRITER =
+ new TestTextWriter();
+
+ /**
+ * The test text writer for the Debug Logger
+ */
+ public static TestTextWriter ERROR_TEXT_WRITER =
+ new TestTextWriter();
+
+ /**
+ * The test text writer for the Debug Logger
+ */
+ public static TestTextWriter ACCESS_TEXT_WRITER =
+ new TestTextWriter();
private static final String DIVIDER_LINE = "-------------------------------------------------------------------------------" + EOL;
@@ -181,12 +187,11 @@
public void onTestStart(ITestResult tr) {
super.onTestStart(tr);
- TestAccessLogger.clear();
- TestErrorLogger.clear();
+ ACCESS_TEXT_WRITER.clear();
+ ERROR_TEXT_WRITER.clear();
+ DEBUG_TEXT_WRITER.clear();
TestCaseUtils.clearSystemOutContents();
TestCaseUtils.clearSystemErrContents();
-
- DEBUG_LOG_PUBLISHER.clear();
}
@@ -219,7 +224,7 @@
failureInfo.append("parameter[" + i + "]: ").append(parameter).append(EOL);
}
- List<String> messages = TestAccessLogger.getMessages();
+ List<String> messages = ACCESS_TEXT_WRITER.getMessages();
if (! messages.isEmpty())
{
failureInfo.append(EOL);
@@ -232,7 +237,7 @@
}
}
- messages = TestErrorLogger.getMessages();
+ messages = ERROR_TEXT_WRITER.getMessages();
if (! messages.isEmpty())
{
failureInfo.append(EOL);
@@ -245,7 +250,7 @@
}
}
- messages = DEBUG_LOG_PUBLISHER.getMessages();
+ messages = DEBUG_TEXT_WRITER.getMessages();
if(! messages.isEmpty())
{
failureInfo.append(EOL);
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestLogPublisher.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestTextWriter.java
similarity index 61%
rename from opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestLogPublisher.java
rename to opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestTextWriter.java
index aeb3c84..581393a 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestLogPublisher.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestTextWriter.java
@@ -26,57 +26,53 @@
*/
package org.opends.server;
-import org.opends.server.api.LogPublisher;
-import org.opends.server.loggers.LoggerErrorHandler;
-import org.opends.server.loggers.TextLogFormatter;
-import org.opends.server.loggers.LogRecord;
+import org.opends.server.loggers.TextWriter;
import java.util.LinkedList;
import java.util.List;
import java.util.ArrayList;
-/**
- * This class provides an implementation of an log publisher which will store
- * all messages logged in memory. It provides methods to retrieve and clear the
- * sets of accumulated log messages. It is only intended for use in the context
- * of the unit test framework, where it will provide a means of getting any
- * log messages associated with failed test cases.
- */
-public class TestLogPublisher implements LogPublisher
+public class TestTextWriter implements TextWriter
{
- private TextLogFormatter formatter;
-
// The list that will hold the messages logged.
private final LinkedList<String> messageList;
- public TestLogPublisher(TextLogFormatter formatter)
+ public TestTextWriter()
{
- this.messageList = new LinkedList<String>();
- this.formatter = formatter;
+ messageList = new LinkedList<String>();
}
- public synchronized void publish(LogRecord record,
- LoggerErrorHandler handler)
+ public synchronized void writeRecord(String record)
{
- try
- {
- messageList.add(formatter.format(record));
- }
- catch(Throwable t)
- {
- if(handler != null)
- {
- handler.handleError(record, t);
- }
- }
+ messageList.add(record);
}
- public synchronized void shutdown()
+ /**
+ * {@inheritDoc}
+ */
+ public void flush()
+ {
+ // No implementation is required.
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void shutdown()
{
messageList.clear();
}
/**
+ * {@inheritDoc}
+ */
+ public long getBytesWritten()
+ {
+ // No implemention is required. Just return 0;
+ return 0;
+ }
+
+ /**
* Retrieves a copy of the set of messages logged to this error logger since
* the last time it was cleared. A copy of the list is returned to avoid
* a ConcurrentModificationException.
@@ -89,6 +85,8 @@
return new ArrayList<String>(messageList);
}
+
+
/**
* Clears any messages currently stored by this logger.
*/
@@ -96,4 +94,6 @@
{
messageList.clear();
}
+
+
}
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java
index 2eeb7d3..b14d47e 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java
@@ -27,7 +27,7 @@
package org.opends.server.replication;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.debugInfo;
import static org.opends.server.messages.MessageHandler.getMessage;
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java
index 9c081b7..2aef96e 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java
@@ -27,7 +27,7 @@
package org.opends.server.replication;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.testng.Assert.*;
import java.net.ServerSocket;
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
index 6761c4a..9b083a6 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.fail;
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java
index 2cef676..ce43db3 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.replication;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/StressTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/StressTest.java
index eef2ec6..62cdfca 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/StressTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/StressTest.java
@@ -27,7 +27,7 @@
package org.opends.server.replication;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
index 108cd9b..5dda8dd 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
@@ -27,7 +27,7 @@
package org.opends.server.replication;
-import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.loggers.ErrorLogger.logError;
import static org.testng.Assert.*;
import java.net.ServerSocket;
--
Gitblit v1.10.0