当前位置: 首页>>代码示例>>Java>>正文


Java JoranException.printStackTrace方法代码示例

本文整理汇总了Java中ch.qos.logback.core.joran.spi.JoranException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java JoranException.printStackTrace方法的具体用法?Java JoranException.printStackTrace怎么用?Java JoranException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ch.qos.logback.core.joran.spi.JoranException的用法示例。


在下文中一共展示了JoranException.printStackTrace方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeLogback

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
@PostConstruct
public void initializeLogback() {
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    InputStream is = InitLogback.class.getClassLoader().getResourceAsStream("tasfe-logback.xml");
    if (is == null)
        return;
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.reset();

    try {
        configurator.doConfigure(is);
    } catch (JoranException e) {
        e.printStackTrace();
    }
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:17,代码来源:InitLogback.java

示例2: initializeLogging

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
private void initializeLogging() {
    String graviteeHome = System.getProperty("gravitee.home");
    String logbackConfiguration = graviteeHome + File.separator + "config" + File.separator + "logback.xml";
    File logbackConfigurationfile = new File(logbackConfiguration);

    // If logback configuration available, load it, else, load default logback configuration
    if (logbackConfigurationfile.exists()) {
        System.setProperty("logback.configurationFile", logbackConfigurationfile.getAbsolutePath());
        StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton();
        LoggerContext loggerContext = (LoggerContext) loggerBinder.getLoggerFactory();
        loggerContext.reset();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(loggerContext);
        try {
            configurator.doConfigure(logbackConfigurationfile);
        } catch( JoranException e ) {
            e.printStackTrace();
        }

        // Internal status data is printed in case of warnings or errors.
        StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
    }
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:24,代码来源:Container.java

示例3: buildFruit

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
public Fruit buildFruit() {
  
  Context context = new ContextBase();
  this.fruit = null;
  context.putProperty("fruitKey", "orange-"+count);
  // for next round
  count++;
  FruitConfigurator fruitConfigurator = new FruitConfigurator(this);
  fruitConfigurator.setContext(context);
  try {
    fruitConfigurator.doConfigure(eventList);
  } catch(JoranException je) {
    je.printStackTrace();
  }
  return fruit;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:17,代码来源:FruitFactory.java

示例4: start

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
public void start(BundleContext context) {
  LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
  
  try {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    // the context was probably already configured by default configuration 
    // rules
    lc.reset(); 
    configurator.doConfigure("src/test/input/osgi/simple.xml");
  } catch (JoranException je) {
     je.printStackTrace();
  }
  StatusPrinter.printInCaseOfErrorsOrWarnings(lc);

  
  Logger logger = LoggerFactory.getLogger(this.getClass());
  logger.info("Activator.start()");
  m_context = context;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:21,代码来源:Activator.java

示例5: main

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的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();
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:27,代码来源:ConfigurationTester.java

示例6: start

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的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());
    }
    
}
 
开发者ID:goodees,项目名称:goodees,代码行数:32,代码来源:CatalinaValve.java

示例7: loggingConfigOff

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
private static void loggingConfigOff() {
    try {
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
        ((LoggerContext) LoggerFactory.getILoggerFactory()).reset();
        configurator.doConfigure(App.class.getResourceAsStream("/logback-cli-off.xml"));
    } catch (JoranException e) {
        e.printStackTrace();
    }
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:11,代码来源:App.java

示例8: loggingConfigOn

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
private static void loggingConfigOn() {
    try {
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
        ((LoggerContext) LoggerFactory.getILoggerFactory()).reset();
        configurator.doConfigure(App.class.getResourceAsStream("/logback-cli-on.xml"));
    } catch (JoranException e) {
        e.printStackTrace();
    }
}
 
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:11,代码来源:App.java

示例9: configureLogback

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
/**
 * @param loggerFactory
 *            the logger factory context
 * @param stream
 *            The input stream to be configured
 */
private static void configureLogback(final LoggerContext context, final InputStream stream) {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(context);

    try {
        configurator.doConfigure(stream);
    } catch (JoranException e) {
        // not much we can do since logger may not be configured yet
        e.printStackTrace(System.out);
    }

   
}
 
开发者ID:att,项目名称:EELF,代码行数:20,代码来源:EELFManager.java

示例10: loadLogFile

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
private static void loadLogFile() {
	LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
	JoranConfigurator configurator = new JoranConfigurator();
	configurator.setContext(lc);
	lc.reset();
	try {
		configurator.doConfigure("src/test/resources/test-logback.xml");
	} catch (JoranException e) {
		e.printStackTrace();
	}
}
 
开发者ID:herowzz,项目名称:SimLogMonitor,代码行数:12,代码来源:TestLog.java

示例11: main

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
public static void main(String[] args) {
  if (args.length != 1) {
    usage("Wrong number of arguments.");
  }

  String configFile = args[0];

  if (configFile.endsWith(".xml")) {
    try {
      LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(lc);
      lc.reset();
      configurator.doConfigure(args[0]);
    } catch (JoranException je) {
      je.printStackTrace();
    }
  }

  NumberCruncherServer ncs;

  try {
    ncs = new NumberCruncherServer();
    logger.info("Creating registry.");

    Registry registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
    registry.rebind("Factor", ncs);
    logger.info("NumberCruncherServer bound and ready.");
  } catch (Exception e) {
    logger.error("Could not bind NumberCruncherServer.", e);

    return;
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:35,代码来源:NumberCruncherServer.java

示例12: main

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
  if (args.length == 0) {
    System.out.println("A configuration file must be passed as a parameter.");
    return;
  }
  
  Logger logger = (Logger) LoggerFactory.getLogger(FilterEvents.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();
  }
  
  for (int i = 0; i < 10; i++) {
    if (i == 3)  {
      MDC.put("username", "sebastien");
      logger.debug("logging statement {}", i);
      MDC.remove("username");
    } else if (i == 6) {
      Marker billing = MarkerFactory.getMarker("billing");
      logger.error(billing, "billing statement {}", i);
    } else {
      logger.info("logging statement {}", i);
    }
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:32,代码来源:FilterEvents.java

示例13: configureWithPath

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
/**
 * Reads configuration from the given file and loads it.
 */
private static void configureWithPath(String pathToConfig) {
    if (!configured) {
        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();

        try {
            JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(context);
            context.reset();
            configurator.doConfigure(pathToConfig);

            Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
                @Override
                public void uncaughtException(Thread t, Throwable e) {
                    uncaughtExceptionLogger.error("An error occurred in thread {}", t.getName(), e);
                }
            });

            configured = true;
        } catch (JoranException je) {
            System.err.println("Unable to configure Logback");
            je.printStackTrace();
        }
    } else {
        throw new IllegalStateException("Logging has already been configured!");
    }
}
 
开发者ID:dsarlis,项目名称:Cloud-Burst,代码行数:30,代码来源:LoggingConfigurator.java

示例14: startInternal

import ch.qos.logback.core.joran.spi.JoranException; //导入方法依赖的package包/类
@Override
public void startInternal() throws LifecycleException {
  executorService = ExecutorServiceUtil.newExecutorService();
  if (filename == null) {
  	String tomcatBaseProperty = OptionHelper
        .getSystemProperty("catalina.base");

    filename = tomcatBaseProperty + File.separatorChar + DEFAULT_CONFIG_FILE;
    
  	File baseConfigFile = new File(filename);
  	if (!baseConfigFile.exists()) {
  	
      String tomcatHomeProperty = OptionHelper
          .getSystemProperty("catalina.home");

      filename = tomcatHomeProperty + File.separatorChar
          + DEFAULT_CONFIG_FILE;
    }
    
    getStatusManager().add(
        new InfoStatus("filename property not set. Assuming [" + filename
            + "]", this));
  }
  File configFile = new File(filename);

  if (configFile.exists()) {
    try {
      JoranConfigurator jc = new JoranConfigurator();
      jc.setContext(this);
      jc.doConfigure(filename);
    } catch (JoranException e) {
      // TODO can we do better than printing a stack trace on syserr?
      e.printStackTrace();
    }
  } else {
    getStatusManager().add(
        new WarnStatus("[" + filename + "] does not exist", this));
  }

  if (!quiet) {
    StatusPrinter.print(getStatusManager());
  }

  started = true;
  setState(LifecycleState.STARTING);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:47,代码来源:LogbackValve.java


注:本文中的ch.qos.logback.core.joran.spi.JoranException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。