@Test public void testAddingLogstashHandlerToExistingRootHandlers() { this.customizer.logging.rootLogger(Level.INFO, "HANDLER1", "HANDLER2"); this.customizer.logstash.enabled(true); this.customizer.customize(); assertThat(customizer.logging.subresources().rootLogger().handlers()) .contains("HANDLER1", "HANDLER2", "logstash-handler"); }
@Override public void customize() { if (logstash.enabled()) { Properties handlerProps = new Properties(); handlerProps.put("hostname", this.logstash.hostname()); handlerProps.put("port", "" + this.logstash.port()); final CustomHandler<?> logstashHandler = new CustomHandler<>("logstash-handler") .module("org.jboss.logmanager.ext") .attributeClass("org.jboss.logmanager.ext.handlers.SocketHandler") .namedFormatter("logstash") .properties(handlerProps) .level(this.logstash.level()); this.logging .customFormatter("logstash", "org.jboss.logmanager.ext", "org.jboss.logmanager.ext.formatters.LogstashFormatter", this.logstash.formatterProperties()) .customHandler(logstashHandler) .subresources() .rootLogger() .handler(logstashHandler.getKey()); } }
LogstashCustomizer implements Customizer { @Override public void customize() { if (logstash.enabled()) { Properties handlerProps = new Properties(); handlerProps.put("hostname", this.logstash.hostname()); handlerProps.put("port", "" + this.logstash.port()); final CustomHandler<?> logstashHandler = new CustomHandler<>("logstash-handler") .module("org.jboss.logmanager.ext") .attributeClass("org.jboss.logmanager.ext.handlers.SocketHandler") .namedFormatter("logstash") .properties(handlerProps) .level(this.logstash.level()); this.logging .customFormatter("logstash", "org.jboss.logmanager.ext", "org.jboss.logmanager.ext.formatters.LogstashFormatter", this.logstash.formatterProperties()) .customHandler(logstashHandler) .subresources() .rootLogger() .handler(logstashHandler.getKey()); } } }
LogstashCustomizer implements Customizer { @Override public void customize() { if (logstash.enabled()) { Properties handlerProps = new Properties(); handlerProps.put("hostname", this.logstash.hostname()); handlerProps.put("port", "" + this.logstash.port()); final CustomHandler<?> logstashHandler = new CustomHandler<>("logstash-handler") .module("org.jboss.logmanager.ext") .attributeClass("org.jboss.logmanager.ext.handlers.SocketHandler") .namedFormatter("logstash") .properties(handlerProps) .level(this.logstash.level()); this.logging .customFormatter("logstash", "org.jboss.logmanager.ext", "org.jboss.logmanager.ext.formatters.LogstashFormatter", this.logstash.formatterProperties()) .customHandler(logstashHandler) .subresources() .rootLogger() .handler(logstashHandler.getKey()); } }  }
LogstashCustomizer implements Customizer { @Override public void customize() { if (logstash.enabled()) { Properties handlerProps = new Properties(); handlerProps.put("hostname", this.logstash.hostname()); handlerProps.put("port", "" + this.logstash.port()); final CustomHandler<?> logstashHandler = new CustomHandler<>("logstash-handler") .module("org.jboss.logmanager.ext") .attributeClass("org.jboss.logmanager.ext.handlers.SocketHandler") .namedFormatter("logstash") .properties(handlerProps) .level(this.logstash.level()); this.logging .customFormatter("logstash", "org.jboss.logmanager.ext", "org.jboss.logmanager.ext.formatters.LogstashFormatter", this.logstash.formatterProperties()) .customHandler(logstashHandler) .subresources() .rootLogger() .handler(logstashHandler.getKey()); } }  @Override void customize(); }
LogstashCustomizer implements Customizer { @Override public void customize() { if (logstash.enabled()) { Properties handlerProps = new Properties(); handlerProps.put("hostname", this.logstash.hostname()); handlerProps.put("port", "" + this.logstash.port()); final CustomHandler<?> logstashHandler = new CustomHandler<>("logstash-handler") .module("org.jboss.logmanager.ext") .attributeClass("org.jboss.logmanager.ext.handlers.SocketHandler") .namedFormatter("logstash") .properties(handlerProps) .level(this.logstash.level()); this.logging .customFormatter("logstash", "org.jboss.logmanager.ext", "org.jboss.logmanager.ext.formatters.LogstashFormatter", this.logstash.formatterProperties()) .customHandler(logstashHandler) .subresources() .rootLogger() .handler(logstashHandler.getKey()); } }  @Override void customize();  }