本文整理汇总了Java中org.wildfly.swarm.config.logging.Level类的典型用法代码示例。如果您正苦于以下问题:Java Level类的具体用法?Java Level怎么用?Java Level使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Level类属于org.wildfly.swarm.config.logging包,在下文中一共展示了Level类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Swarm container = new Swarm();
System.out.println("\tBuilding kie server deployable...");
JAXRSArchive deployment = createDeployment(container);
container.fraction(
new LoggingFraction()
.consoleHandler("CONSOLE", c -> {
c.level(Level.INFO);
c.formatter("%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n");
})
.rootLogger(Level.INFO, "CONSOLE")
);
System.out.println("\tStaring Wildfly Swarm....");
container.start();
System.out.println("\tConfiguring kjars to be auto deployed to server " + Arrays.toString(args));
installKJars(args);
System.out.println("\tDeploying kie server ....");
container.deploy(deployment);
}
示例2: newContainer
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
System.out.println("Log file: " + LOG_FILE);
return new Swarm()
.fraction(
new LoggingFraction()
.defaultColorFormatter()
.consoleHandler(Level.INFO, "COLOR_PATTERN")
.fileHandler("FILE", f -> {
Map<String, String> fileProps = new HashMap<>();
fileProps.put("path", LOG_FILE);
f.file(fileProps);
f.level(Level.INFO);
f.formatter("%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n");
})
.rootLogger(Level.INFO, "CONSOLE", "FILE")
)
.fraction(new ZipkinFraction("wildfly-swarm-service"));
}
示例3: newContainer
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
return new Swarm()
.fraction(
new LoggingFraction().periodicSizeRotatingFileHandler("FILE", (h) -> {
h.level(Level.INFO)
.append(true)
.suffix(".yyyy-MM-dd")
.rotateSize("30m")
.enabled(true)
.encoding("UTF-8")
.maxBackupIndex(2);
Map<String, String> fileSpec = new HashMap<>();
fileSpec.put("path", logFile);
h.file(fileSpec);
}).logger("br.org.sistemafieg.cliente", (l) -> {
l.level(Level.INFO)
.handler("FILE");
}));
}
示例4: applyDefaults
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
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;
}
示例5: newContainer
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
@CreateSwarm
public static Swarm newContainer() throws Exception {
return new Swarm()
.fraction(
LoggingFraction.createDebugLoggingFraction()
.logger("cheese.gouda", l -> {
l.level(Level.FINEST);
})
.logger("cheese.cheddar", l -> {
l.level(Level.OFF);
})
);
}
示例6: testExplicitlyEnabledWithLevelConfigValue
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
@Test
public void testExplicitlyEnabledWithLevelConfigValue() {
this.customizer.logstash.level(Level.DEBUG);
this.customizer.logstash.enabled(true);
this.customizer.customize();
assertThat(customizer.logging.subresources().customHandler("logstash-handler").level())
.isEqualTo(Level.DEBUG);
}
示例7: testAddingLogstashHandlerToExistingRootHandlers
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
@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");
}
示例8: testHonoringExistingRootLoggerLevel
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
@Test
public void testHonoringExistingRootLoggerLevel() {
this.customizer.logging.rootLogger(Level.WARN, "HANDLER");
this.customizer.logstash.enabled(true);
this.customizer.customize();
assertThat(customizer.logging.subresources().rootLogger().level())
.isEqualTo(Level.WARN);
}
示例9: fileHandler
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
/**
* Add a FileHandler to the list of handlers for this logger
*
* @param name The name of the handler
* @param path The log file path
* @param level The logging level
* @param formatter The pattern string for the formatter
* @return This fraction
*/
public LoggingFraction fileHandler(String name, String path, Level level, String formatter) {
Map<Object, Object> fileProperties = new HashMap<>();
fileProperties.put("path", path);
fileProperties.put("relative-to", "jboss.server.log.dir");
fileHandler(new FileHandler(name)
.level(level)
.formatter(formatter)
.file(fileProperties));
return this;
}
示例10: apply
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
private void apply(LevelNode node) {
if (!node.getName().equals("")) {
this.fraction.logger(node.getName(), (l) -> {
l.level(Level.valueOf(node.getLevel().toString()));
});
}
for (LevelNode each : node.getChildren()) {
apply(each);
}
}
示例11: customize
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
@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
//.consoleHandler(level, LoggingFraction.COLOR_PATTERN)
.customHandler(fluentd)
.rootLogger(level, LoggingFraction.CONSOLE, fluentd.getKey());
} else {
throw new IllegalArgumentException("Not enabling fluentd, no host set");
}
}
示例12: createDefaultLoggingFraction
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
/**
* Create a default logging fraction for the specified level.
*
* @return The fully-configured fraction.
*/
public static LoggingFraction createDefaultLoggingFraction(Level level) {
return new LoggingFraction()
.defaultColorFormatter()
.consoleHandler(level, COLOR_PATTERN)
.rootLogger(level, CONSOLE);
}
示例13: apply
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
private void apply(LevelNode node, LoggingFraction fraction) {
if (!node.getName().equals("")) {
fraction.logger(node.getName(), (l) -> {
l.level(Level.valueOf(node.getLevel().toString()));
});
}
for (LevelNode each : node.getChildren()) {
apply(each, fraction);
}
}
示例14: level
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
public Level level() {
return this.level;
}
示例15: setUp
import org.wildfly.swarm.config.logging.Level; //导入依赖的package包/类
@Before
public void setUp() {
this.customizer = new LogstashCustomizer();
this.customizer.logging = new LoggingFraction().rootLogger(Level.INFO, "HANDLER");
this.customizer.logstash = new LogstashFraction();
}