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


Java NullAppender类代码示例

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


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

示例1: setupLogger

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
public static void setupLogger(Config config) throws IOException {

        Layout layout = new PatternLayout("%d{" + DATE_FORMAT + "} %5p: %m%n");

        Appender appender = new DailyRollingFileAppender(
                layout, config.getString("logger.file"), "'.'yyyyMMdd");

        LogManager.resetConfiguration();
        LogManager.getRootLogger().addAppender(new NullAppender());

        logger = Logger.getLogger(LOGGER_NAME);
        logger.addAppender(appender);
        logger.setLevel(Level.toLevel(config.getString("logger.level"), Level.ALL));

        // Workaround for "Bug 745866 - (EDG-45) Possible netty logging config problem"
        InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory() {
            @Override
            public InternalLogger newInstance(String string) {
                return new NettyInternalLogger();
            }
        });

        Log.logSystemInfo();
        Log.info("Version: " + getAppVersion());
    }
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:26,代码来源:Log.java

示例2: setupLogging

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
/**
 * Sets up the verbose and debug mode depending on mvn logging level, and
 * sets up hyperjaxb logging.
 */
protected void setupLogging() {
	super.setupLogging();

	final Logger rootLogger = LogManager.getRootLogger();
	rootLogger.addAppender(new NullAppender());
	final Logger logger = LogManager.getLogger("org.jvnet.hyperjaxb3");

	final Log log = getLog();
	logger.addAppender(new Appender(getLog(), new PatternLayout(
			"%m%n        %c%n")));

	if (this.getDebug()) {
		log.debug("Logger level set to [debug].");
		logger.setLevel(Level.DEBUG);
	} else if (this.getVerbose())
		logger.setLevel(Level.INFO);
	else if (log.isWarnEnabled())
		logger.setLevel(Level.WARN);
	else
		logger.setLevel(Level.ERROR);
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:26,代码来源:Hyperjaxb3Mojo.java

示例3: beforeClass

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
/***/
@BeforeClass
public static void beforeClass() {
	if (!DEBUG) {
		getRootLogger().removeAllAppenders();
		getRootLogger().addAppender(new NullAppender());
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:MockTest.java

示例4: setUp

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
	LOGGER.removeAllAppenders();
	LOGGER.addAppender(new NullAppender());
	index = new SearchResultIndex(PATH, INDEX, 10);
    SearchResult result = readFile("exampleSearchResult.json");
    index.offer(result);
    index.flush();
}
 
开发者ID:searsia,项目名称:searsiaserver,代码行数:10,代码来源:TestSearchResultIndex.java

示例5: setUp

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
    LOGGER.removeAllAppenders();
    LOGGER.addAppender(new NullAppender());
	engines = new ResourceIndex(PATH, INDEX);
	Resource engine = searsia();
	engines.putMother(engine);
}
 
开发者ID:searsia,项目名称:searsiaserver,代码行数:9,代码来源:TestResourceIndex.java

示例6: DataSourceHandler

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
/**
 * Constructor used for MySQL
 * 
 * @param host
 * @param port
 * @param database
 * @param username
 * @param password
 * @throws SQLException 
 */
public DataSourceHandler(final String host, final String port, final String database, final String username, final String password) throws SQLException{
	// Check database's informations and init connection
	this.host = Preconditions.checkNotNull(host);
	this.port = Preconditions.checkNotNull(port);
	this.database = Preconditions.checkNotNull(database);
	this.username = Preconditions.checkNotNull(username);
	this.password = Preconditions.checkNotNull(password);

	BAT.getInstance().getLogger().config("Initialization of HikariCP in progress ...");
	BasicConfigurator.configure(new NullAppender());
	ds = new HikariDataSource();
	ds.setJdbcUrl("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database + 
			"?useLegacyDatetimeCode=false&serverTimezone=" + TimeZone.getDefault().getID());
	ds.setUsername(this.username);
	ds.setPassword(this.password);
	ds.addDataSourceProperty("cachePrepStmts", "true");
	ds.setMaximumPoolSize(8);
	try {
		final Connection conn = ds.getConnection();
	    int intOffset = Calendar.getInstance().getTimeZone().getOffset(Calendar.getInstance().getTimeInMillis()) / 1000;
	    String offset = String.format("%02d:%02d", Math.abs(intOffset / 3600), Math.abs((intOffset / 60) % 60));
	    offset = (intOffset >= 0 ? "+" : "-") + offset;
		conn.createStatement().executeQuery("SET time_zone='" + offset + "';");
		conn.close();
		BAT.getInstance().getLogger().config("BoneCP is loaded !");
	} catch (final SQLException e) {
		BAT.getInstance().getLogger().severe("BAT encounters a problem during the initialization of the database connection."
				+ " Please check your logins and database configuration.");
		if(e.getCause() instanceof CommunicationsException){
		    BAT.getInstance().getLogger().severe(e.getCause().getMessage());
		}
		if(BAT.getInstance().getConfiguration().isDebugMode()){
		    BAT.getInstance().getLogger().log(Level.SEVERE, e.getMessage(), e);
		}
		throw e;
	}
	sqlite = false;
}
 
开发者ID:alphartdev,项目名称:BungeeAdminTools,代码行数:49,代码来源:DataSourceHandler.java

示例7: init

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
/**
 * Disables all loggers.
 */
@BeforeClass
public static void init() {

	// remove all of them
	Logger.getRootLogger().removeAllAppenders();
	Logger.getRootLogger().addAppender(new NullAppender());

	final File modelLocation = new File("_data/",
			"tidaDbMinuteLoadingPerformance");
	assertTrue(Files.deleteDir(modelLocation));
}
 
开发者ID:pmeisen,项目名称:dis-timeintervaldataanalyzer,代码行数:15,代码来源:TestLoadingPerformance.java

示例8: instrumentLoggingForTesting

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
@Before
public void instrumentLoggingForTesting() {
  loggingEvents.clear();
  appender = new NullAppender() {
    @Override
    public void doAppend(LoggingEvent event) {
      loggingEvents.add(event);
    }
  };
  Logger.getLogger(Appmon4jDumper.class).addAppender(appender);
}
 
开发者ID:ImmobilienScout24,项目名称:appmon4j,代码行数:12,代码来源:Appmon4jDumperTest.java

示例9: main

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
/**
 * Main method
 *
 * @param args Program arguments
 */
public static void main(String[] args) {
    org.apache.log4j.BasicConfigurator.configure(new NullAppender());
    java.util.logging.Logger.getLogger("org.hibernate").setLevel(OFF);
    Application.launch(args);
}
 
开发者ID:floric,项目名称:HTWK_Visu,代码行数:11,代码来源:App.java

示例10: configureLogger

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
@BeforeClass
public static void configureLogger() throws Exception {
    BasicConfigurator.configure(new NullAppender());
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:5,代码来源:ClientJobStateTest.java

示例11: configureLog4J

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
@BeforeClass
public static void configureLog4J() {
    BasicConfigurator.configure(new NullAppender());
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:5,代码来源:DataSpaceNodeConfigurationAgentTest.java

示例12: configurePrimaryLoggerToSwallowLogs

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
/**
 * Simply configure the primary log4j Loggers to send all output to the bit bucket.
 */
public static void configurePrimaryLoggerToSwallowLogs() {
  org.apache.log4j.BasicConfigurator.configure(new NullAppender());
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:7,代码来源:HaxeDebugLogger.java

示例13: setLoggerDefaultOptions

import org.apache.log4j.varia.NullAppender; //导入依赖的package包/类
private void setLoggerDefaultOptions()
{
    org.apache.log4j.Logger root = org.apache.log4j.Logger.getRootLogger();
    root.addAppender(new NullAppender());
    root.setLevel(Level.INFO);
}
 
开发者ID:ustream,项目名称:yolo,代码行数:7,代码来源:Yolo.java


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