MCPcopy Create free account
hub / github.com/GateNLP/gate-core / logOnce

Method logOnce

src/main/java/gate/Utils.java:765–779  ·  view source on GitHub ↗

Issue a message to the log but only if the same message has not been logged already in the same GATE session. This is intended for explanations or warnings that should not be repeated every time the same situation occurs. @param logger - the logger instance to use @param level - a Log4J severity l

(org.apache.log4j.Logger logger, org.apache.log4j.Level level, String message)

Source from the content-addressed store, hash-verified

763 * @deprecated Log4J support will be removed in future, please use SLF4J
764 */
765 @Deprecated
766 public static void logOnce (org.apache.log4j.Logger logger, org.apache.log4j.Level level, String message) {
767 if(!alreadyLoggedMessages.contains(message)) {
768
769 try {
770 logger.log(level, message);
771 } catch (Exception e) {
772 System.err.println(
773 "Failed to access logger through deprecated gate.Utils.logOnce method.\n"+
774 "Log message was: " + message);
775 }
776
777 alreadyLoggedMessages.add(message);
778 }
779 }
780
781 /**
782 * Issue a message to the log but only if the same message has not

Callers 2

isValidMethod · 0.95
parseCreoleMethod · 0.95

Calls 5

infoMethod · 0.80
addMethod · 0.65
containsMethod · 0.45
printlnMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected