private void writeField( String fieldName, Boolean value ) { if ( value == null ) { return; } try { generator.writeObjectField( fieldName, value ); } catch ( IOException e ) { Log.error( e.getMessage() ); } }
/** * Sets the model comments. * * @param modelComments the model comments. */ public void setModelComments(final Comments modelComments) { Log.debug ("Model: Comment set: " + modelComments); this.modelComments = modelComments; }
/** * Converts a given string into a color. * * @param value the string, either a name or a hex-string. * @return the color. */ public static Color stringToColor(String value) { if (value == null) { return Color.black; } try { // get color by hex or octal value return Color.decode(value); } catch (NumberFormatException nfe) { // if we can't decode lets try to get it by name try { // try to get a color by name using reflection final Field f = Color.class.getField(value); return (Color) f.get(null); } catch (Exception ce) { Log.info("No such Color : " + value); // if we can't get any color return black return Color.black; } } } }
/** * Gets a file resource from a project * * @param file * @return */ protected static CSharpFile from(Project project, File file, boolean unitTest) { if (unitTest) { Log.error("test " + file); } File directory = file.getParentFile(); CSharpFolder folder = CSharpFolder.fromDirectory(project, directory); if (folder == null) { Log.warn("Could not find the folder for directory : " + directory + " in project " + project); } return new CSharpFile(folder, file, unitTest); }
public static void put(@Nonnull User user, @Nonnull String accessToken) { Log.debug("Populating the cache for username: " + user.getId()); try { user.addProperty(new GithubAccessTokenProperty(accessToken)); } catch (IOException e) { Log.warn("Received an exception when trying to add the GitHub access token to the user: " + user.getId(), e); } } }
Log.warn("Module " + module.getName() + ": required version: " + moduleInfo + ", but found Version: \n" + module); final PackageState state = new PackageState(module, PackageState.STATE_ERROR); Log.debug("Indicated failure for module: " + module.getModuleClass()); final PackageState state = new PackageState(module, PackageState.STATE_ERROR); dropFailedModule(state); Log.error(new Log.SimpleMessage ("Circular module reference: This module definition is invalid: ", module.getClass())); for (int i = 0; i < required.length; i++) { if (loadModule(required[i], incompleteModules, modules, true) == false) { Log.debug("Indicated failure for module: " + module.getModuleClass()); final PackageState state = new PackageState(module, PackageState.STATE_ERROR); dropFailedModule(state); for (int i = 0; i < optional.length; i++) { if (loadModule(optional[i], incompleteModules, modules, true) == false) { Log.debug(new Log.SimpleMessage("Optional module: ", optional[i].getModuleClass(), " was not loaded.")); Log.warn(new Log.SimpleMessage ("Unresolved dependency for package: ", moduleInfo.getModuleClass())); Log.debug(new Log.SimpleMessage("ClassNotFound: ", cnfe.getMessage())); return false;
Log.getInstance().addTarget(new PrintStreamLogTarget()); Log.getInstance().init(); Log.info("Default log target started ... previous log messages " + "could have been ignored.");
Log.warn (new Log.SimpleMessage("Unable to load module classes for ", this.module.getName(), ":", noClassDef.getMessage())); this.state = STATE_ERROR; if (Log.isDebugEnabled()) Log.warn("Unable to configure the module " + this.module.getName(), e); else if (Log.isWarningEnabled()) Log.warn("Unable to configure the module " + this.module.getName());
Log.getInstance().addTarget(new PrintStreamLogTarget()); Log.debug("Unable to load default model. Ignoring...");
/** * Creates a log context. * * @param context the class (<code>null</code> not permitted). * * @return A log context. */ public static LogContext createContext(final Class context) { return createContext(context.getName()); }
/** * Returns the singleton Log instance. A new instance is created if necessary. * * @return the singleton instance. */ public static synchronized Log getInstance() { if (singleton == null) { singleton = new Log(); } return singleton; }
/** * Adds a log target to this facility. Log targets get informed, via the * LogTarget interface, whenever a message is logged with this class. * * @param target the target. */ public synchronized void addTarget(final LogTarget target) { super.addTarget(target); // as soon as there is a real log target added, we do no longer need // the default logging. This was only installed to be able to send messages // if the deepest basic logging failed. if (target != DEFAULT_LOG_TARGET) { removeTarget(DEFAULT_LOG_TARGET); } }
Log.warn("Module " + module.getName() + ": required version: " + moduleInfo + ", but found Version: \n" + module); final PackageState state = new PackageState(module, PackageState.STATE_ERROR); Log.debug("Indicated failure for module: " + module.getModuleClass()); final PackageState state = new PackageState(module, PackageState.STATE_ERROR); dropFailedModule(state); Log.error(new Log.SimpleMessage ("Circular module reference: This module definition is invalid: ", module.getClass())); for (int i = 0; i < required.length; i++) { if (loadModule(required[i], incompleteModules, modules, true) == false) { Log.debug("Indicated failure for module: " + module.getModuleClass()); final PackageState state = new PackageState(module, PackageState.STATE_ERROR); dropFailedModule(state); for (int i = 0; i < optional.length; i++) { if (loadModule(optional[i], incompleteModules, modules, true) == false) { Log.debug(new Log.SimpleMessage("Optional module: ", optional[i].getModuleClass(), " was not loaded.")); Log.warn(new Log.SimpleMessage ("Unresolved dependency for package: ", moduleInfo.getModuleClass())); Log.debug(new Log.SimpleMessage("ClassNotFound: ", cnfe.getMessage())); return false;
Log.getInstance().addTarget(new PrintStreamLogTarget()); Log.getInstance().init(); Log.info("Default log target started ... previous log messages " + "could have been ignored.");
/** * Creates a log context. * * @param context the class (<code>null</code> not permitted). * * @return A log context. */ public static LogContext createContext(final Class context) { return createContext(context.getName()); }
/** * Returns the singleton Log instance. A new instance is created if necessary. * * @return the singleton instance. */ public static synchronized Log getInstance() { if (singleton == null) { singleton = new Log(); } return singleton; }
/** * Adds a log target to this facility. Log targets get informed, via the * LogTarget interface, whenever a message is logged with this class. * * @param target the target. */ public synchronized void addTarget(final LogTarget target) { super.addTarget(target); // as soon as there is a real log target added, we do no longer need // the default logging. This was only installed to be able to send messages // if the deepest basic logging failed. if (target != DEFAULT_LOG_TARGET) { removeTarget(DEFAULT_LOG_TARGET); } }