/** * Get a {@code Logger} for class {@code clazz}. * * <p>If this is called in an OSGi context this method will return the {@code Logger} of the Riena * framework. Otherwise if the boolean system property {@code LoggerMill.RIENA_DEFAULT_LOGGING} is * {@code true} a simple {@code Logger} that writes to the console will be returned. If the system * property is {@code false} a <i>null</i> logger that does nothing will be returned. * * @param clazz categorizes the logger * @return the {@code Logger} */ public static Logger getLogger(final Class<?> clazz) { final Bundle bundle = FrameworkUtil.getBundle(clazz); if (bundle != null) { return LoggerProvider.instance().getLogger(clazz); } return getEmergencyLogger(clazz.getName()); }
/** * Get a {@code Logger} for class {@code className}. * * @param activator If the activator is NOT {@code null} this method will return the {@code * Logger} of the Riena framework. Otherwise if the boolean system property {@code * LoggerMill.RIENA_DEFAULT_LOGGING} is {@code true} a simple {@code Logger} that writes to * the console will be returned. If the system property is {@code false} a <i>null</i> logger * that does nothing will be returned. * @param className categorizes the logger * @return the {@code Logger} */ public static Logger getLogger(final IRienaActivator activator, final String className) { if (activator != null) { return LoggerProvider.instance().getLogger(className); } return getEmergencyLogger(className); }
/** * Get a {@code Logger} for class {@code clazz}. * * <p><b>Note: </b>Consider using {@code Log4r.getLogger(Class<? clazz)}. It is functional * identical but does not have the dependency to the activator. * * @param activator If the activator is NOT {@code null} this method will return the {@code * Logger} of the Riena framework. Otherwise if the boolean system property {@code * LoggerMill.RIENA_DEFAULT_LOGGING} is {@code true} a simple {@code Logger} that writes to * the console will be returned. If the system property is {@code false} a <i>null</i> logger * that does nothing will be returned. * @param clazz categorizes the logger * @return the {@code Logger} */ public static Logger getLogger(final IRienaActivator activator, final Class<?> clazz) { if (activator != null) { return LoggerProvider.instance().getLogger(clazz); } return getEmergencyLogger(clazz.getName()); }