use of org.slf4j.Logger in project sling by apache.
the class InjectorSpecificAnnotationTest method testOSGiServiceField.
@Test
public void testOSGiServiceField() throws InvalidSyntaxException {
ServiceReference ref = mock(ServiceReference.class);
Logger log = mock(Logger.class);
when(bundleContext.getServiceReferences(Logger.class.getName(), null)).thenReturn(new ServiceReference[] { ref });
when(bundleContext.getService(ref)).thenReturn(log);
InjectorSpecificAnnotationModel model = factory.getAdapter(request, InjectorSpecificAnnotationModel.class);
assertNotNull("Could not instanciate model", model);
assertEquals(log, model.getService());
}
use of org.slf4j.Logger in project sling by apache.
the class InjectorSpecificAnnotationTest method testOrderForValueAnnotationField.
@Test
public void testOrderForValueAnnotationField() {
// make sure that that the correct injection is used
// make sure that log is adapted from value map
// and not coming from request attribute
Logger logFromValueMap = LoggerFactory.getLogger(this.getClass());
Map<String, Object> map = new HashMap<String, Object>();
map.put("first", "first-value");
map.put("log", logFromValueMap);
ValueMap vm = new ValueMapDecorator(map);
Resource res = mock(Resource.class);
when(res.adaptTo(ValueMap.class)).thenReturn(vm);
when(request.getResource()).thenReturn(res);
InjectorSpecificAnnotationModel model = factory.getAdapter(request, InjectorSpecificAnnotationModel.class);
assertNotNull("Could not instanciate model", model);
assertEquals("first-value", model.getFirst());
assertEquals(logFromValueMap, model.getLog());
}
use of org.slf4j.Logger in project sling by apache.
the class Activator method initializeLogbackManager.
private void initializeLogbackManager(boolean immediateInit) throws InvalidSyntaxException {
logManager = new LogbackManager(context);
final Logger log = LoggerFactory.getLogger(getClass());
if (immediateInit) {
log.info("LogbackManager initialized at bundle startup");
} else {
log.info("LogbackManager initialized after waiting for Slf4j, {} msec after startup", System.currentTimeMillis() - startTime);
}
}
use of org.slf4j.Logger in project spring-boot by spring-projects.
the class LoggingApplicationListenerIntegrationTests method loggingPerformedDuringChildApplicationStartIsNotLost.
@Test
public void loggingPerformedDuringChildApplicationStartIsNotLost() {
new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE).child(Config.class).web(WebApplicationType.NONE).listeners(new ApplicationListener<ApplicationStartingEvent>() {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void onApplicationEvent(ApplicationStartingEvent event) {
this.logger.info("Child application starting");
}
}).run();
assertThat(this.outputCapture.toString()).contains("Child application starting");
}
use of org.slf4j.Logger in project openhab1-addons by openhab.
the class MBrickletSegmentDisplay4x7Impl method setLogger.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setLogger(Logger newLogger) {
Logger oldLogger = logger;
logger = newLogger;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_SEGMENT_DISPLAY4X7__LOGGER, oldLogger, logger));
}
Aggregations