@Override protected LogLevel getPropertyDefaultValue() throws JPNotAvailableException { try { return LogLevel.valueOf(getRootLogger().getLevel().toString()); } catch (Exception ex) { throw new JPNotAvailableException(getClass(), ex); } }
/** * @param cause */ public static void printError(Throwable cause) { getApplicationLogger().error("========================================================================="); printError(cause, "="); try { if (getProperty(JPVerbose.class).getValue()) { cause.printStackTrace(System.err); } } catch (JPNotAvailableException ex) { getApplicationLogger().error("Could not load exception stack: " + ex.getMessage()); } getApplicationLogger().error("========================================================================="); }
/** * Returns the property related to the given {@code propertyClass}. * <p> * If the property is never registered but the class is known in the classpath, the method returns the default value. * * @param <C> the property type. * @param propertyClass property class which defines the property. * * @return the property. * * @throws org.openbase.jps.exception.JPNotAvailableException thrown if the given property could not be found. */ public static synchronized <C extends AbstractJavaProperty> C getProperty(Class<C> propertyClass) throws JPNotAvailableException { try { if (propertyClass == null) { throw new JPNotAvailableException(propertyClass, new JPServiceException("Given propertyClass is a Nullpointer!")); } // load if not already done. if (!loadedProperties.containsKey(propertyClass) || loadedProperties.get(propertyClass).neetToBeParsed()) { // init if not already done. if (!initializedProperties.containsKey(propertyClass)) { initProperty(propertyClass); } loadProperty(initializedProperties.get(propertyClass)); } return (C) loadedProperties.get(propertyClass); } catch (JPServiceException ex) { throw new JPNotAvailableException(propertyClass, ex); } }