public static RedirectOutputHandler<java.util.logging.Logger, java.util.logging.Level> fromJavaUtilLogging(java.util.logging.Logger logger) { Map <Object, java.util.logging.Level> channelMapping = Generics.newHashMap(); channelMapping.put(Redwood.WARN, java.util.logging.Level.WARNING); channelMapping.put(Redwood.DBG, java.util.logging.Level.FINE); channelMapping.put(Redwood.ERR, java.util.logging.Level.SEVERE); try { return new RedirectOutputHandler<>( logger, java.util.logging.Logger.class.getMethod("log", java.util.logging.Level.class, String.class), channelMapping, java.util.logging.Level.INFO ); } catch (NoSuchMethodException e) { throw new IllegalStateException(e); } } }
/** * Determine where, in the end, console output should go. * The default is stdout. * * @param method An output, one of: stdout, stderr, or java.util.logging * @return this */ public RedwoodConfiguration output(final String method) { if (method.equalsIgnoreCase("stdout") || method.equalsIgnoreCase("out")){ edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = Redwood.ConsoleHandler.out(); } else if (method.equalsIgnoreCase("stderr") || method.equalsIgnoreCase("err")) { edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = Redwood.ConsoleHandler.err(); } else if (method.equalsIgnoreCase("java.util.logging")){ edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = RedirectOutputHandler.fromJavaUtilLogging(Logger.getLogger("``error``")); } else { throw new IllegalArgumentException("Unknown value for log.method"); } return this; }
line = line.substring(0, line.length() - 1); if (shouldLogChannels()) {
RedirectOutputHandler.fromJavaUtilLogging(topLogger)); Redwood.log("Hello from Redwood -> Java!"); Redwood.log("Hello from Redwood -> Java again!");
public static RedirectOutputHandler<Logger, Level> fromJavaUtilLogging(Logger logger) { Map <Object, Level> channelMapping = Generics.newHashMap(); channelMapping.put(Redwood.WARN, Level.WARNING); channelMapping.put(Redwood.DBG, Level.FINE); channelMapping.put(Redwood.ERR, Level.SEVERE); try { return new RedirectOutputHandler<Logger, Level>( logger, Logger.class.getMethod("log", Level.class, String.class), channelMapping, Level.INFO ); } catch (NoSuchMethodException e) { throw new IllegalStateException(e); } }
line = line.substring(0, line.length() - 1); if (shouldLogChannels()) {
/** * Determine where, in the end, console output should go. * The default is stdout. * * @param method An output, one of: stdout, stderr, or java.util.logging * @return this */ public RedwoodConfiguration output(final String method) { if (method.equalsIgnoreCase("stdout") || method.equalsIgnoreCase("out")){ edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = Redwood.ConsoleHandler.out(); } else if (method.equalsIgnoreCase("stderr") || method.equalsIgnoreCase("err")) { edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = Redwood.ConsoleHandler.err(); } else if (method.equalsIgnoreCase("java.util.logging")){ edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = RedirectOutputHandler.fromJavaUtilLogging(Logger.getLogger("``error``")); } else { throw new IllegalArgumentException("Unknown value for log.method"); } return this; }
public static RedirectOutputHandler<java.util.logging.Logger, java.util.logging.Level> fromJavaUtilLogging(java.util.logging.Logger logger) { Map <Object, java.util.logging.Level> channelMapping = Generics.newHashMap(); channelMapping.put(Redwood.WARN, java.util.logging.Level.WARNING); channelMapping.put(Redwood.DBG, java.util.logging.Level.FINE); channelMapping.put(Redwood.ERR, java.util.logging.Level.SEVERE); try { return new RedirectOutputHandler<>( logger, java.util.logging.Logger.class.getMethod("log", java.util.logging.Level.class, String.class), channelMapping, java.util.logging.Level.INFO ); } catch (NoSuchMethodException e) { throw new IllegalStateException(e); } } }
line = line.substring(0, line.length() - 1); if (shouldLogChannels()) {
/** * Determine where, in the end, console output should go. * The default is stdout. * @param method An output, one of: stdout, stderr, or java.util.logging * @return this */ public RedwoodConfiguration output(final String method) { if (method.equalsIgnoreCase("stdout") || method.equalsIgnoreCase("out")){ edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = Redwood.ConsoleHandler.out(); } else if (method.equalsIgnoreCase("stderr") || method.equalsIgnoreCase("err")) { edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = Redwood.ConsoleHandler.err(); } else if (method.equalsIgnoreCase("java.util.logging")){ edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = RedirectOutputHandler.fromJavaUtilLogging(Logger.getLogger("``error``")); } else { throw new IllegalArgumentException("Unknown value for log.method"); } return this; }
public static RedirectOutputHandler<java.util.logging.Logger, java.util.logging.Level> fromJavaUtilLogging(java.util.logging.Logger logger) { Map <Object, java.util.logging.Level> channelMapping = Generics.newHashMap(); channelMapping.put(Redwood.WARN, java.util.logging.Level.WARNING); channelMapping.put(Redwood.DBG, java.util.logging.Level.FINE); channelMapping.put(Redwood.ERR, java.util.logging.Level.SEVERE); try { return new RedirectOutputHandler<>( logger, java.util.logging.Logger.class.getMethod("log", java.util.logging.Level.class, String.class), channelMapping, java.util.logging.Level.INFO ); } catch (NoSuchMethodException e) { throw new IllegalStateException(e); } } }
line = line.substring(0, line.length() - 1); if (shouldLogChannels()) {
/** * Determine where, in the end, console output should go. * The default is stdout. * * @param method An output, one of: stdout, stderr, or java.util.logging * @return this */ public RedwoodConfiguration output(final String method) { if (method.equalsIgnoreCase("stdout") || method.equalsIgnoreCase("out")){ edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = Redwood.ConsoleHandler.out(); } else if (method.equalsIgnoreCase("stderr") || method.equalsIgnoreCase("err")) { edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = Redwood.ConsoleHandler.err(); } else if (method.equalsIgnoreCase("java.util.logging")){ edu.stanford.nlp.util.logging.JavaUtilLoggingAdaptor.adapt(); this.outputHandler = RedirectOutputHandler.fromJavaUtilLogging(Logger.getLogger("``error``")); } else { throw new IllegalArgumentException("Unknown value for log.method"); } return this; }
RedirectOutputHandler.fromJavaUtilLogging(topLogger)); Redwood.log("Hello from Redwood -> Java!"); Redwood.log("Hello from Redwood -> Java again!");
RedirectOutputHandler.fromJavaUtilLogging(topLogger)); Redwood.log("Hello from Redwood -> Java!"); Redwood.log("Hello from Redwood -> Java again!");
RedirectOutputHandler.fromJavaUtilLogging(topLogger)); Redwood.log("Hello from Redwood -> Java!"); Redwood.log("Hello from Redwood -> Java again!");