diff --git a/src/Spring/Spring.Core/Context/Attributes/AssemblyObjectDefinitionScanner.cs b/src/Spring/Spring.Core/Context/Attributes/AssemblyObjectDefinitionScanner.cs index e4f9cf8b..a1b9a342 100644 --- a/src/Spring/Spring.Core/Context/Attributes/AssemblyObjectDefinitionScanner.cs +++ b/src/Spring/Spring.Core/Context/Attributes/AssemblyObjectDefinitionScanner.cs @@ -70,6 +70,9 @@ namespace Spring.Context.Attributes { var definition = new ScannedGenericObjectDefinition(type, Defaults); string objectName = ObjectNameGenerator.GenerateObjectName(definition, registry); + string fullname = type.FullName; + + Logger.Debug(m => m("Register Type: {0} with object name '{1}'", fullname, objectName)); registry.RegisterObjectDefinition(objectName, definition); } } diff --git a/src/Spring/Spring.Core/Context/Attributes/AssemblyTypeScanner.cs b/src/Spring/Spring.Core/Context/Attributes/AssemblyTypeScanner.cs index 15ab0f9a..30a4d62e 100644 --- a/src/Spring/Spring.Core/Context/Attributes/AssemblyTypeScanner.cs +++ b/src/Spring/Spring.Core/Context/Attributes/AssemblyTypeScanner.cs @@ -179,6 +179,7 @@ namespace Spring.Context.Attributes { if (IsCompoundPredicateSatisfiedBy(type)) { + Logger.Debug(m => m("Satisfied Type: {0}", type.FullName)); types.Add(type); } } @@ -274,6 +275,9 @@ namespace Spring.Context.Attributes if (null != loadedAssembly) { + string fullname = loadedAssembly.FullName; + Logger.Debug(m => m("Add Assembly: {0}", fullname)); + assemblies.Add(loadedAssembly); } } @@ -313,9 +317,12 @@ namespace Spring.Context.Attributes /// protected virtual IEnumerable ApplyAssemblyFiltersTo(IEnumerable assemblyCandidates) { - return - assemblyCandidates.Where(IsIncludedAssembly). - AsEnumerable(); + var filteredAssemblies = assemblyCandidates.Where(IsIncludedAssembly). + AsEnumerable(); + + Logger.Debug(m => m("Filtered Assemblies: {0}", StringUtils.ArrayToCommaDelimitedString(filteredAssemblies.ToArray()))); + + return filteredAssemblies; } /// @@ -351,7 +358,15 @@ namespace Spring.Context.Attributes /// protected virtual bool IsIncludedAssembly(Assembly assembly) { - return AssemblyInclusionPredicates.Any(include => include(assembly)); + bool result = AssemblyInclusionPredicates.Any(include => include(assembly)); + + if (result) + { + string fullname = assembly.FullName; + Logger.Debug(m => m("Include Assembly: {0}", fullname)); + } + + return result; } /// diff --git a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AssignableTypeFilter.cs b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AssignableTypeFilter.cs index 2c073144..76d5f967 100644 --- a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AssignableTypeFilter.cs +++ b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AssignableTypeFilter.cs @@ -52,5 +52,16 @@ namespace Spring.Context.Attributes.TypeFilters return (type.GetInterfaces().Any(i => i.Equals(RequiredType)) || RequiredType.Equals(type.BaseType)); } + /// + /// Returns a string that represents the current object. + /// + /// + /// A string that represents the current object. + /// + /// 2 + public override string ToString() + { + return string.Format("Required Type: {0}", RequiredType != null ? RequiredType.FullName : ""); + } } } diff --git a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AttributeTypeFilter.cs b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AttributeTypeFilter.cs index 22ad4642..d5343a58 100644 --- a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AttributeTypeFilter.cs +++ b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/AttributeTypeFilter.cs @@ -52,5 +52,17 @@ namespace Spring.Context.Attributes.TypeFilters return (Attribute.GetCustomAttribute(type, RequiredType) != null); } + /// + /// Returns a string that represents the current object. + /// + /// + /// A string that represents the current object. + /// + /// 2 + public override string ToString() + { + return string.Format("Required Type: {0}", RequiredType != null ? RequiredType.FullName : ""); + } + } } diff --git a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/RegexPatternTypeFilter.cs b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/RegexPatternTypeFilter.cs index f4e5468b..0b26bd0a 100644 --- a/src/Spring/Spring.Core/Context/Attributes/TypeFilters/RegexPatternTypeFilter.cs +++ b/src/Spring/Spring.Core/Context/Attributes/TypeFilters/RegexPatternTypeFilter.cs @@ -49,5 +49,17 @@ namespace Spring.Context.Attributes.TypeFilters { return Regex.IsMatch(type.FullName, _pattern); } + + /// + /// Returns a string that represents the current object. + /// + /// + /// A string that represents the current object. + /// + /// 2 + public override string ToString() + { + return string.Format("Pattern: {0}", _pattern); + } } } diff --git a/src/Spring/Spring.Core/Context/Config/ComponentScanObjectDefinitionParser.cs b/src/Spring/Spring.Core/Context/Config/ComponentScanObjectDefinitionParser.cs index e63bae82..e4027bdf 100644 --- a/src/Spring/Spring.Core/Context/Config/ComponentScanObjectDefinitionParser.cs +++ b/src/Spring/Spring.Core/Context/Config/ComponentScanObjectDefinitionParser.cs @@ -102,6 +102,9 @@ namespace Spring.Context.Config foreach (var baseAssembly in baseAssemblies.Split(',')) { + if (Logger.IsDebugEnabled) + Logger.Debug("Start With Assembly Filter: " + baseAssembly); + scanner.WithAssemblyFilter(assy => assy.FullName.StartsWith(baseAssembly)); } } @@ -111,7 +114,10 @@ namespace Spring.Context.Config var nameGeneratorString = element.GetAttribute(NAME_GENERATOR_ATTRIBUTE); var nameGenerator = CustomTypeFactory.GetNameGenerator(nameGeneratorString); if (nameGenerator != null) + { + Logger.Debug(m => m("Use NameTable Generator: {0}", nameGeneratorString)); scanner.ObjectNameGenerator = nameGenerator; + } } private void ParseTypeFilters(AssemblyObjectDefinitionScanner scanner, XmlElement element) @@ -119,9 +125,17 @@ namespace Spring.Context.Config foreach (XmlNode node in element.ChildNodes) { if (node.Name.Contains(INCLUDE_FILTER_ELEMENT)) - scanner.WithIncludeFilter(CreateTypeFilter(node)); + { + var filter = CreateTypeFilter(node); + Logger.Debug(m => m("Inlude Filter: {0}", filter)); + scanner.WithIncludeFilter(filter); + } else if (node.Name.Contains(EXCLUDE_FILTER_ELEMENT)) - scanner.WithExcludeFilter(CreateTypeFilter(node)); + { + var filter = CreateTypeFilter(node); + Logger.Debug(m => m("Exclude Filter: {0}", filter)); + scanner.WithExcludeFilter(filter); + } } } @@ -154,6 +168,5 @@ namespace Spring.Context.Config throw new InvalidEnumArgumentException(string.Format("Filter type {0} is not defined", type)); } } - } }