use of org.wildfly.swarm.config.logging.Level in project wildfly-swarm by wildfly-swarm.
the class FluentdCustomizer method customize.
@Override
public void customize() {
String hostname = this.hostname.orElse(this.fluentdFraction.hostname());
int port = this.port.orElse(this.fluentdFraction.port());
if (hostname != null) {
Properties handlerProps = new Properties();
handlerProps.put("hostname", hostname);
handlerProps.put("port", "" + port);
handlerProps.put("tag", this.fluentdFraction.getTag());
final CustomHandler<?> fluentd = new CustomHandler<>("fluentd-handler").module("org.wildfly.swarm.fluentd:runtime").attributeClass(FluentdHandler.class.getName()).properties(handlerProps);
final Level level = this.fluentdFraction.level();
this.loggingFraction.customHandler(fluentd).rootLogger(level, LoggingFraction.CONSOLE, fluentd.getKey());
} else {
throw new IllegalArgumentException("Not enabling fluentd, no host set");
}
}
use of org.wildfly.swarm.config.logging.Level in project wildfly-swarm by wildfly-swarm.
the class LoggingFraction method applyDefaults.
public LoggingFraction applyDefaults(Level level) {
defaultColorFormatter().consoleHandler(Level.ALL, COLOR_PATTERN).rootLogger(level, CONSOLE);
Properties allProps = System.getProperties();
for (String name : allProps.stringPropertyNames()) {
if (isSimpleLoggerName(name)) {
String logger = name.substring((LoggingProperties.LOGGING + ".").length());
try {
Level loggerLevel = Level.valueOf(allProps.getProperty(name).trim().toUpperCase());
logger(logger, (l) -> {
l.level(loggerLevel);
l.category(logger);
});
} catch (IllegalArgumentException e) {
// apparently wasn't a logging category+level, ignore.
}
}
}
return this;
}
use of org.wildfly.swarm.config.logging.Level in project wildfly-swarm by wildfly-swarm.
the class LoggingFraction method applyDefaults.
public LoggingFraction applyDefaults() {
Level level = Level.INFO;
String prop = System.getProperty(LoggingProperties.LOGGING);
if (prop != null) {
prop = prop.trim().toUpperCase();
try {
level = Level.valueOf(prop);
} catch (IllegalArgumentException e) {
// Go with default of Level.INFO
}
}
return applyDefaults(level);
}
Aggregations