private URL findConfigFileURLFromSystemProperties(ClassLoader classLoader, boolean updateStatus) { String logbackConfigFile = OptionHelper.getSystemProperty(CONFIG_FILE_PROPERTY); if (logbackConfigFile != null) { URL result = null; try { result = new URL(logbackConfigFile); return result; } catch (MalformedURLException e) { // so, resource is not a URL: // attempt to get the resource from the class path result = Loader.getResource(logbackConfigFile, classLoader); if (result != null) { return result; } File f = new File(logbackConfigFile); if (f.exists() && f.isFile()) { try { result = f.toURI().toURL(); return result; } catch (MalformedURLException e1) { } } } finally { if (updateStatus) { statusOnResourceSearch(logbackConfigFile, classLoader, result); } } } return null; }
/** * FOR INTERNAL USE. This method is intended for use by StaticLoggerBinder. * * @param defaultLoggerContext * @throws ClassNotFoundException * @throws NoSuchMethodException * @throws InstantiationException * @throws IllegalAccessException * @throws InvocationTargetException */ public void init(LoggerContext defaultLoggerContext, Object key) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { if (this.key == null) { this.key = key; } else if (this.key != key) { throw new IllegalAccessException("Only certain classes can access this method."); } String contextSelectorStr = OptionHelper.getSystemProperty(ClassicConstants.LOGBACK_CONTEXT_SELECTOR); if (contextSelectorStr == null) { contextSelector = new DefaultContextSelector(defaultLoggerContext); } else if (contextSelectorStr.equals("JNDI")) { // if jndi is specified, let's use the appropriate class contextSelector = new ContextJNDISelector(defaultLoggerContext); } else { contextSelector = dynamicalContextSelector(defaultLoggerContext, contextSelectorStr); } }
/** * Search for value of DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY in the web-app first, then as a system property and * as an environment variable last. * * @param ctx * @return True if value of DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY is available and set to "true", false otherwise. */ boolean isDisabledByConfiguration(ServletContext ctx) { String disableAttributeStr = null; Object disableAttribute = ctx.getInitParameter(DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY); if (disableAttribute instanceof String) { disableAttributeStr = (String) disableAttribute; } if (OptionHelper.isEmpty(disableAttributeStr)) { disableAttributeStr = OptionHelper.getSystemProperty(DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY); } if (OptionHelper.isEmpty(disableAttributeStr)) { disableAttributeStr = OptionHelper.getEnv(DISABLE_SERVLET_CONTAINER_INITIALIZER_KEY); } if (OptionHelper.isEmpty(disableAttributeStr)) return false; return disableAttributeStr.equalsIgnoreCase("true"); }
public static String getJavaVendor() { return OptionHelper.getSystemProperty("java.vendor", null); }
static void installIfAsked(LoggerContext loggerContext) { String slClass = OptionHelper.getSystemProperty( ContextInitializer.STATUS_LISTENER_CLASS); if (!OptionHelper.isEmpty(slClass)) { addStatusListener(loggerContext, slClass); } }
private URL findConfigFileURLFromSystemProperties(ClassLoader classLoader, boolean updateStatus) { String logbackConfigFile = OptionHelper.getSystemProperty(CONFIG_FILE_PROPERTY); if (logbackConfigFile != null) { URL result = null; try { result = new URL(logbackConfigFile); return result; } catch (MalformedURLException e) { // so, resource is not a URL: // attempt to get the resource from the class path result = Loader.getResource(logbackConfigFile, classLoader); if (result != null) { return result; } File f = new File(logbackConfigFile); if (f.exists() && f.isFile()) { try { result = f.toURI().toURL(); return result; } catch (MalformedURLException e1) { } } } finally { if (updateStatus) { statusOnResourceSearch(logbackConfigFile, classLoader, result); } } } return null; }
.getSystemProperty(ClassicConstants.LOGBACK_CONTEXT_SELECTOR); if (contextSelectorStr == null) { contextSelector = new DefaultContextSelector(defaultLoggerContext);
public static String propertyLookup(String key, PropertyContainer pc1, PropertyContainer pc2) { String value = null; // first try the props passed as parameter value = pc1.getProperty(key); // then try the pc2 if (value == null && pc2 != null) { value = pc2.getProperty(key); } // then try in System properties if (value == null) { value = getSystemProperty(key, null); } if (value == null) { value = getEnv(key); } return value; }
private String lookupKey(String key) { String value = propertyContainer0.getProperty(key); if (value != null) return value; if (propertyContainer1 != null) { value = propertyContainer1.getProperty(key); if (value != null) return value; } value = OptionHelper.getSystemProperty(key, null); if (value != null) return value; value = OptionHelper.getEnv(key); if (value != null) { return value; } return null; }
public static String getJavaVendor() { return OptionHelper.getSystemProperty("java.vendor", null); }
public static String getJavaVendor() { return OptionHelper.getSystemProperty("java.vendor", null); }
public static String getJavaVendor() { return OptionHelper.getSystemProperty("java.vendor", null); }
public static String getJavaVendor() { return OptionHelper.getSystemProperty("java.vendor", null); }
/** * Heuristically determines whether the current OS is Android */ static public boolean isAndroidOS() { String osname = OptionHelper.getSystemProperty("os.name"); String root = OptionHelper.getEnv("ANDROID_ROOT"); String data = OptionHelper.getEnv("ANDROID_DATA"); return osname != null && osname.contains("Linux") && root != null && root.contains("/system") && data != null && data.contains("/data"); }
public static void installIfAsked(Context context) { String slClass = OptionHelper.getSystemProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY); if (!OptionHelper.isEmpty(slClass)) { addStatusListener(context, slClass); } }
public static void installIfAsked(Context context) { String slClass = OptionHelper.getSystemProperty(CoreConstants.STATUS_LISTENER_CLASS); if (!OptionHelper.isEmpty(slClass)) { addStatusListener(context, slClass); } }
static void installIfAsked(LoggerContext loggerContext) { String slClass = OptionHelper.getSystemProperty( ContextInitializer.STATUS_LISTENER_CLASS); if (!OptionHelper.isEmpty(slClass)) { addStatusListener(loggerContext, slClass); } }
public static void installIfAsked(Context context) { String slClass = OptionHelper.getSystemProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY); if (!OptionHelper.isEmpty(slClass)) { addStatusListener(context, slClass); } }
public static void installIfAsked(Context context) { String slClass = OptionHelper.getSystemProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY); if (!OptionHelper.isEmpty(slClass)) { addStatusListener(context, slClass); } }
static void installIfAsked(LoggerContext loggerContext) { String slClass = OptionHelper.getSystemProperty( ContextInitializer.STATUS_LISTENER_CLASS); if (!OptionHelper.isEmpty(slClass)) { addStatusListener(loggerContext, slClass); } }