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


Java RootLogger类代码示例

本文整理汇总了Java中org.apache.log4j.spi.RootLogger的典型用法代码示例。如果您正苦于以下问题:Java RootLogger类的具体用法?Java RootLogger怎么用?Java RootLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testHierarchy1

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
public
void testHierarchy1() {
  Hierarchy h = new Hierarchy(new RootLogger((Level) Level.ERROR));
  Logger a0 = h.getLogger("a");
  assertEquals("a", a0.getName());
  assertNull(a0.getLevel());
  assertSame(Level.ERROR, a0.getEffectiveLevel());

  Logger a1 = h.getLogger("a");
  assertSame(a0, a1);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:12,代码来源:LoggerTestCase.java

示例2: configureHierarchy

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
LoggerRepository configureHierarchy(InetAddress inetAddress) {
   cat.info("Locating configuration file for "+inetAddress);
   // We assume that the toSting method of InetAddress returns is in
   // the format hostname/d1.d2.d3.d4 e.g. torino/192.168.1.1
   String s = inetAddress.toString();
   int i = s.indexOf("/");
   if(i == -1) {
     cat.warn("Could not parse the inetAddress ["+inetAddress+
       "]. Using default hierarchy.");
     return genericHierarchy();
   } else {
     String key = s.substring(0, i);

     File configFile = new File(dir, key+CONFIG_FILE_EXT);
     if(configFile.exists()) {
Hierarchy h = new Hierarchy(new RootLogger(Level.DEBUG));
hierarchyMap.put(inetAddress, h);

new PropertyConfigurator().doConfigure(configFile.getAbsolutePath(), h);

return h;
     } else {
cat.warn("Could not find config file ["+configFile+"].");
return genericHierarchy();
     }
   }
 }
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:28,代码来源:SocketServer.java

示例3: setUp

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
@Before
public void setUp() {
  RootLogger.getRootLogger().setLevel( Level.OFF );
  SimpleDateFormat format = new SimpleDateFormat( SAMPLE_DATE_MASK );
  //add custom seconds
  int seconds = 123456;
  sampleJavaDate = new Date( seconds );
  sampleSqlDate = new java.sql.Date( seconds );
  sampleSqlTimeStamp = new Timestamp( seconds );
  sampleStringDate = format.format( sampleJavaDate );
  expectedDate = format.format( sampleJavaDate );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:13,代码来源:DataFormatterTest.java

示例4: init

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
public static synchronized void init(ServletContext servletContext)
        throws ServletException {
    if (!initialized) // set the global RepositorySelector
    {
        defaultRepository = LoggerFactory.getLoggerRepository();
        RepositorySelector theSelector = new AppRespositorySelector();
        LogManager.setRepositorySelector(theSelector, guard);
        initialized = true;
    }

    Hierarchy hierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
    loadLog4JConfig(servletContext, hierarchy);
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    repositories.put(loader, hierarchy);
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:16,代码来源:AppRespositorySelector.java

示例5: setUp

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
    RootLogger.getRootLogger().addAppender(appenderForTest);
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:5,代码来源:LoggingRulesTest.java

示例6: tearDown

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
@AfterClass
public static void tearDown() throws Exception {
    assertThat("Expect ending message", appenderForTest.getMessage(), is("Successful termination of 'testLogging'!"));
    RootLogger.getRootLogger().removeAppender(appenderForTest);
}
 
开发者ID:e-Spirit,项目名称:FSTestTools,代码行数:6,代码来源:LoggingRulesTest.java

示例7: NoWarningHierarchy

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
public NoWarningHierarchy() {
    super(new RootLogger(Level.ALL));
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:4,代码来源:LoggingEventProcessor.java

示例8: setUpBeforeClass

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
	BasicConfigurator.configure();
	RootLogger.getRootLogger().setLevel(DEBUG);
}
 
开发者ID:didfet,项目名称:rrdclient,代码行数:6,代码来源:FetchCommandTest.java

示例9: CommuneLogger

import org.apache.log4j.spi.RootLogger; //导入依赖的package包/类
public CommuneLogger(Class<?> clazz) {
	logger = RootLogger.getLogger(clazz);
}
 
开发者ID:OurGrid,项目名称:commune,代码行数:4,代码来源:CommuneLogger.java


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