本文整理汇总了Java中ch.qos.logback.core.util.StatusPrinter.print方法的典型用法代码示例。如果您正苦于以下问题:Java StatusPrinter.print方法的具体用法?Java StatusPrinter.print怎么用?Java StatusPrinter.print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.core.util.StatusPrinter
的用法示例。
在下文中一共展示了StatusPrinter.print方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSanity
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
static void checkSanity(Auditor auditor) throws AuditException {
StatusManager sm = auditor.getStatusManager();
if (getHighestLevel(0, sm) > Status.INFO) {
StatusPrinter.print(sm);
}
if (auditor.getClientApplication() == null) {
throw new AuditException("Client application has not been set");
}
if (auditor.getAuditAppender() == null) {
throw new AuditException("No audit appender. Please see "
+ NULL_AUDIT_APPENDER_URL);
}
}
示例2: main
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Context context = new ContextBase();
Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>();
// Associate "/computation" pattern with ComputationAction1
ruleMap.put(new ElementSelector("/computation"), new ComputationAction1());
// Other associations
ruleMap.put(new ElementSelector("/computation/literal"), new LiteralAction());
ruleMap.put(new ElementSelector("/computation/add"), new AddAction());
ruleMap.put(new ElementSelector("/computation/multiply"), new MultiplyAction());
SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
// link the configurator with its context
simpleConfigurator.setContext(context);
simpleConfigurator.doConfigure(args[0]);
// Print any errors that might have occured.
StatusPrinter.print(context);
}
示例3: IOPerformance
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public IOPerformance(boolean _immediateFlush, long _len) {
this.len = _len;
this.immediateFlush = _immediateFlush;
context = new LoggerContext();
logger = context.getLogger("logger-" + getName());
// A FileAppender is created according to the buffering and
// immediate flush setting of this IO instance.
FileAppender<ILoggingEvent> fa = new FileAppender<ILoggingEvent>();
fa.setName("FILE");
PatternLayoutEncoder pa = new PatternLayoutEncoder();
pa.setPattern("%r %5p %c [%t] - %m%n");
pa.setContext(context);
pa.start();
fa.setEncoder(pa);
fa.setFile(LOG_FILE);
fa.setAppend(true);
fa.setContext(context);
fa.start();
((ch.qos.logback.classic.Logger) logger).addAppender(fa);
StatusPrinter.print(context);
}
示例4: init
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
static void init(String portStr, String configFile) throws JoranException {
try {
port = Integer.parseInt(portStr);
} catch (java.lang.NumberFormatException e) {
e.printStackTrace();
usage("Could not interpret port number [" + portStr + "].");
}
basicContext = new AccessContext();
if (configFile.endsWith(".xml")) {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(basicContext);
configurator.doConfigure(configFile);
StatusPrinter.print(basicContext);
}
}
示例5: main
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>();
// Note the wild card character '*', in the paterns, signifying any level
// of nesting.
ruleMap.put(new ElementSelector("*/computation"), new ComputationAction2());
ruleMap.put(new ElementSelector("*/computation/literal"), new LiteralAction());
ruleMap.put(new ElementSelector("*/computation/add"), new AddAction());
ruleMap.put(new ElementSelector("*/computation/multiply"), new MultiplyAction());
Context context = new ContextBase();
SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
// link the configurator with its context
simpleConfigurator.setContext(context);
try {
simpleConfigurator.doConfigure(args[0]);
} catch (JoranException e) {
// Print any errors that might have occured.
StatusPrinter.print(context);
}
}
示例6: testCheckNoHeadersAreInserted
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
public void testCheckNoHeadersAreInserted() throws Exception {
setInsertHeadersAndStart(false);
IAccessEvent event = createAccessEvent();
appender.append(event);
StatusPrinter.print(context.getStatusManager());
//Check that no headers were inserted
Statement stmt = connectionSource.getConnection().createStatement();
ResultSet rs = null;
rs = stmt.executeQuery("SELECT * FROM access_event_header where EVENT_ID = " + existingEventTableRowCount);
assertFalse(rs.next());
rs.close();
stmt.close();
}
示例7: authenticatedGmail_SSL
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
@Ignore
public void authenticatedGmail_SSL() throws Exception {
smtpAppender.setSMTPHost("smtp.gmail.com");
smtpAppender.setSMTPPort(465);
smtpAppender.addTo("[email protected]");
smtpAppender.setSSL(true);
smtpAppender.setUsername("[email protected]");
smtpAppender.setPassword("XXX");
smtpAppender.setLayout(buildPatternLayout(loggerContext));
smtpAppender.start();
Logger logger = loggerContext.getLogger("authenticatedGmail_SSL");
logger.addAppender(smtpAppender);
logger.debug("hello");
logger.error("en error", new Exception("an exception"));
StatusPrinter.print(loggerContext);
}
示例8: authenticatedGmailStartTLS
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
@Ignore
public void authenticatedGmailStartTLS() throws Exception {
smtpAppender.setSMTPHost("smtp.gmail.com");
smtpAppender.setSMTPPort(587);
smtpAppender.addTo("[email protected]");
smtpAppender.setSTARTTLS(true);
smtpAppender.setUsername("[email protected]");
smtpAppender.setPassword("XXX");
smtpAppender.setLayout(buildPatternLayout(loggerContext));
smtpAppender.start();
Logger logger = loggerContext.getLogger("authenticatedGmailSTARTTLS");
logger.addAppender(smtpAppender);
logger.debug("hello");
logger.error("en error", new Exception("an exception"));
StatusPrinter.print(loggerContext);
}
示例9: main
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
Logger logger = (Logger) LoggerFactory.getLogger(ConfigurationTester.class);
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.reset();
configurator.doConfigure(args[0]);
} catch (JoranException je) {
je.printStackTrace();
}
// After we've called Joran, let's print information about the
// internal status of logback
StatusPrinter.print(lc);
logger.debug("**Hello {}", new Bar());
MDC.put("testKey", "testValueFromMDC");
MDC.put("testKey2", "value2");
for (int i = 0; i < 10; i++) {
logger.debug("logging statement " + i);
Thread.sleep(100);
}
Bar bar = new Bar();
bar.createLoggingRequest();
}
示例10: start
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Override
public void start() throws LifecycleException {
super.start();
ctx.start();
if (filename == null) {
filename = OptionHelper.getSystemProperty("logbackAccess.configurationFile");
if (filename == null) {
filename = DEFAULT_CONFIG_FILE;
}
ctx.getStatusManager().add(new InfoStatus("filename property not set. Assuming [" + filename + "]", this));
}
// TODO: Support classpath config
File configFile = new File(filename);
if (configFile.exists()) {
try {
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(ctx);
jc.doConfigure(filename);
} catch (JoranException e) {
// TODO can we do better than printing a stack trace on syserr?
e.printStackTrace();
}
} else {
ctx.getStatusManager().add(new WarnStatus("[" + filename + "] does not exist", this));
}
if (!quiet) {
StatusPrinter.print(ctx.getStatusManager());
}
}
示例11: debugLoggingConfiguration
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public void debugLoggingConfiguration() {
// For debugging problems with the logback configuration
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
// print logback's internal status
StatusPrinter.print(lc);
// Logger logger = LoggerFactory.getLogger(Logging.class);
}
示例12: testConversionRuleSupportInHtmlLayout
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
public void testConversionRuleSupportInHtmlLayout() throws JoranException {
configure(ClassicTestConstants.JORAN_INPUT_PREFIX
+ "conversionRule/htmlLayout0.xml");
root.getAppender("LIST");
String msg = "Simon says";
root.debug(msg);
StringListAppender<ILoggingEvent> sla = (StringListAppender<ILoggingEvent>) root
.getAppender("LIST");
assertNotNull(sla);
StatusPrinter.print(lc);
assertEquals(1, sla.strList.size());
assertFalse(sla.strList.get(0).contains("PARSER_ERROR"));
}
示例13: start
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Override
public void start() {
configure();
if (!isQuiet()) {
StatusPrinter.print(getStatusManager());
}
started = true;
}
示例14: main
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public static void main(String[] args) {
// assume SLF4J is bound to logback in the current environment
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
// print logback's internal status
StatusPrinter.print(lc);
logger.info("Entering application.");
Foo foo = new Foo();
foo.doIt();
logger.info("Exiting application.");
}
示例15: MANUAL_renamingOnDifferentVolumesOnLinux
import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
@Ignore
public void MANUAL_renamingOnDifferentVolumesOnLinux() throws IOException, RolloverFailure {
RenameUtil renameUtil = new RenameUtil();
renameUtil.setContext(context);
String src = "/tmp/ramdisk/foo.txt";
FileOutputStream fis = new FileOutputStream(src);
fis.write(("hello" + diff).getBytes());
renameUtil.rename(src, "/tmp/foo" + diff + ".txt");
StatusPrinter.print(context);
}