Georg Henzler created SLING-4767: ------------------------------------ Summary: Optional sub models are logged as warn if they cannot be adapted Key: SLING-4767 URL: https://issues.apache.org/jira/browse/SLING-4767 Project: Sling Issue Type: Improvement Reporter: Georg Henzler
Currently Sling Models logs the example model \[1] as warning \[2] if the sub model image does not exist. This really should be a debug log as it is totally fine if in optional field cannot be set? \[1] {code} com......mediagallery.MediaGalleryElement ... @Inject @Optional @Named(value = ".") private Image image; {code} \[2] org.apache.sling.models.impl.ModelAdapterFactory.injectElement(InjectableElement, Object, Model, DisposalCallbackRegistry, InjectCallback) {code} // log previous injection error, if there was any if (lastInjectionException != null) { log.warn("Although falling back to default value worked, injection into {} failed because of: " + lastInjectionException.getMessage(), element.getAnnotatedElement(), lastInjectionException); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)