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


Java SyslogIF.info方法代码示例

本文整理汇总了Java中org.productivity.java.syslog4j.SyslogIF.info方法的典型用法代码示例。如果您正苦于以下问题:Java SyslogIF.info方法的具体用法?Java SyslogIF.info怎么用?Java SyslogIF.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.productivity.java.syslog4j.SyslogIF的用法示例。


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

示例1: testPCISyslogMessage

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testPCISyslogMessage() {
	// PREPARE
	
	List events = new ArrayList();
	String message = null;
	
	String protocol = getClientProtocol();
	SyslogIF syslog = getSyslog(protocol);
	
	message = new PCISyslogMessage("a","b",new Date(),"c","d","e").createMessage();
	syslog.info("[TEST] " + message);
	events.add("[TEST] " + message);

	// VERIFY
	
	SyslogUtility.sleep(pause);
	syslog.flush();
	verifySendReceive(events,false,false);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:20,代码来源:UDPPCISyslogMessageTest.java

示例2: testTruncate

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testTruncate() {
	setMessageLength(10);
	
	SyslogIF syslog = Syslog.getInstance("split");
	syslog.getConfig().setTruncateMessage(true);
	
	syslog.info("T");
	syslog.info("Test 1234");
	syslog.info("Test 12345");
	syslog.info("Test 654321");
	syslog.info("Test 12345 For now is the time for all good men to come to the aid of their country");
	
	assertSyslog(syslog,new String[] {"T", "Test 1234", "Test 12345", "Test 65432", "Test 12345" } );
	
	syslog.flush();
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:17,代码来源:SplitSyslogTest.java

示例3: testHTMLEntityEscapeMessageModifier

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testHTMLEntityEscapeMessageModifier() {
	SyslogMessageModifierIF messageModifier = new HTMLEntityEscapeSyslogMessageModifier();

	String nullHtml = messageModifier.modify(null,0,0,null);
	assertNull(nullHtml);
	
	String emptyHtml = messageModifier.modify(null,0,0,"");
	assertEquals("",emptyHtml);

	// PREPARE
	
	List events = new ArrayList();
	String message = null;
	
	String protocol = getClientProtocol();
	SyslogIF syslog = getSyslog(protocol);
	syslog.getConfig().removeAllMessageModifiers();		

	syslog.getConfig().addMessageModifier(HTMLEntityEscapeSyslogMessageModifier.createDefault());
	
	// SEND HTML

	message = "[TEST] <html>&\"test\"&'" + "\t" + "</html>" + (char) 255;
	syslog.info(message);
	events.add("[TEST] &lt;html&gt;&amp;&quot;test&quot;&amp;&#39;&#9;&lt;/html&gt;&#255;");

	// VERIFY
	
	SyslogUtility.sleep(pause);
	syslog.flush();
	verifySendReceive(events,false,false);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:33,代码来源:SyslogMessageModifierTest.java

示例4: _testMaxActiveSockets

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
protected int _testMaxActiveSockets(TCPNetSyslogServerConfigIF serverConfig) {
	Counter c = new Counter();
	
	serverConfig.setMaxActiveSockets(2);
	serverConfig.addEventHandler(c);
	
	SyslogServer.createThreadedInstance("tcp_maxactivesockets",serverConfig);
	
	TCPNetSyslogConfigIF config = new TCPNetSyslogConfig();
	config.setPort(8888);
		
	SyslogIF syslog1 = Syslog.createInstance("tcp_maxactivesockets1",config);
	syslog1.info("test1");
	syslog1.flush();
	SyslogUtility.sleep(200);
	
	SyslogIF syslog2 = Syslog.createInstance("tcp_maxactivesockets2",config);
	syslog2.info("test2");
	syslog2.flush();
	SyslogUtility.sleep(200);
	
	SyslogIF syslog3 = Syslog.createInstance("tcp_maxactivesockets3",config);
	syslog3.info("test3");
	syslog3.flush();
	SyslogUtility.sleep(200);

	syslog1.shutdown();
	SyslogUtility.sleep(200);

	Syslog.destroyInstance("tcp_maxactivesockets1");
	Syslog.destroyInstance("tcp_maxactivesockets2");
	Syslog.destroyInstance("tcp_maxactivesockets3");
	
	SyslogServer.destroyInstance("tcp_maxactivesockets");
	
	return c.counter;
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:38,代码来源:MaxActiveSocketsTest.java

示例5: testFreshConnectionInterval

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testFreshConnectionInterval() {
	TCPNetSyslogServerConfigIF serverConfig = new TCPNetSyslogServerConfig();
	serverConfig.setPort(8888);
	
	SocketCounter counter = new SocketCounter();
	serverConfig.addEventHandler(counter);
	
	SyslogServerIF server = SyslogServer.createThreadedInstance("tcp_8888",serverConfig);

	SyslogUtility.sleep(100);

	TCPNetSyslogConfigIF config = new TCPNetSyslogConfig();
	config.setPort(8888);
	config.setFreshConnectionInterval(300);
	
	SyslogIF syslog = Syslog.createInstance("tcp_8888",config);

	for(int i=0; i<10; i++) {
		syslog.info("message " + i);
		SyslogUtility.sleep(100);
	}
	
	SyslogUtility.sleep(100);
	
	SyslogServer.destroyInstance(server);
	Syslog.destroyInstance(syslog);

	SyslogUtility.sleep(100);

	assertEquals("OpenCounter",3,counter.openCounter);
	assertEquals("EventCounter",10,counter.eventCounter);
	assertEquals("CloseCounter",3,counter.closeCounter);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:34,代码来源:FreshConnectionIntervalTest.java

示例6: sendMessage

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
static public void sendMessage(SyslogIF syslog, int priority,String message, 
		boolean addTimestamp, String pattern,
		boolean addHostName) {
	
	String messageString =message;
	
	// Do we need to add hostname?
	if(addHostName) {
		messageString= Const.getHostname() + " " +messageString;
	}
	
	// Do we need to add timestamp
	if(addTimestamp) {
		SimpleDateFormat dateFormat = new SimpleDateFormat (pattern);
		dateFormat.setTimeZone(TimeZone.getDefault());
		messageString = dateFormat.format( Calendar.getInstance().getTime() ) + " : " + messageString;
	}

	// send message
	switch(priority) {
		case SyslogConstants.LEVEL_EMERGENCY  : syslog.emergency(messageString); break;
		case SyslogConstants.LEVEL_ALERT : syslog.alert(messageString); break;
		case SyslogConstants.LEVEL_CRITICAL : syslog.critical(messageString); break;
		case SyslogConstants.LEVEL_ERROR : syslog.error(messageString); break;
		case SyslogConstants.LEVEL_WARN : syslog.warn(messageString); break;
		case SyslogConstants.LEVEL_NOTICE : syslog.notice(messageString); break;
		case SyslogConstants.LEVEL_INFO : syslog.info(messageString); break;
		case SyslogConstants.LEVEL_DEBUG : syslog.debug(messageString); break;
		default: break;
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:32,代码来源:SyslogDefs.java

示例7: testSequential

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testSequential() {
	// PREPARE
	
	List events = new ArrayList();
	String message = null;
	
	String protocol = getClientProtocol();
	SyslogIF syslog = getSyslog(protocol);
	syslog.getConfig().removeAllMessageModifiers();
	
	// SET UP

	SequentialSyslogMessageModifier sequentialModifier = SequentialSyslogMessageModifier.createDefault();
	syslog.getConfig().addMessageModifier(sequentialModifier);
	assertEquals(sequentialModifier.getConfig().getFirstNumber(),SequentialSyslogMessageModifierConfig.createDefault().getFirstNumber());
	
	// ZERO

	message = "[TEST] Sequence Test";
	syslog.info(message);
	events.add(message + " #0000");

	// ONE

	message = "[TEST] Sequence Test";
	syslog.info(message);
	events.add(message + " #0001");

	// NINE THOUSAND NINE HUNDRED NIGHTY EIGHT
	
	sequentialModifier.setNextSequence(SyslogConstants.LEVEL_INFO,9998);
	
	message = "[TEST] Sequence Test";
	syslog.info(message);
	events.add(message + " #9998");

	// NINE THOUSAND NINE HUNDRED NIGHTY NINE
	
	message = "[TEST] Sequence Test";
	syslog.info(message);
	events.add(message + " #9999");

	// ZERO
	
	message = "[TEST] Sequence Test";
	syslog.info(message);
	events.add(message + " #0000");

	// VERIFY
	
	SyslogUtility.sleep(pause);
	syslog.flush();
	verifySendReceive(events,false,false);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:55,代码来源:SyslogMessageModifierTest.java

示例8: testChecksum

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testChecksum() {
	try {
		new ChecksumSyslogMessageModifier(null);
		fail("Should not allow an empty config into a modifier");
		
	} catch (SyslogRuntimeException sre) {
		assertTrue(true);
	}
	
	// PREPARE
	
	List events = new ArrayList();
	String message = null;
	
	String protocol = getClientProtocol();
	SyslogIF syslog = getSyslog(protocol);
	syslog.getConfig().removeAllMessageModifiers();
	
	// CRC32 SET UP

	syslog.getConfig().addMessageModifier(ChecksumSyslogMessageModifier.createCRC32());

	// CRC32
	
	message = "[TEST] This Line Will Have a CRC32 Checksum";
	syslog.info(message);
	events.add(message + " {F8E7A4E4}");

	// ADLER32 SET UP
	
	syslog.getConfig().removeAllMessageModifiers();
	ChecksumSyslogMessageModifier adler32Modifier = ChecksumSyslogMessageModifier.createADLER32();
	syslog.getConfig().addMessageModifier(adler32Modifier);

	// ADLER32
	
	message = "[TEST] This Line Will Have an ADLER32 Checksum";
	syslog.info(message);
	events.add(message + " {5AD70EE4}");

	// ADLER32 SET UP with LOWER FIRST
	
	syslog.getConfig().insertMessageModifier(0,StringCaseSyslogMessageModifier.LOWER);

	// ADLER32 with LOWER FIRST
	
	message = "[TEST] This Line Will Have an ADLER32 Checksum";
	syslog.info(message);
	events.add(message.toLowerCase() + " {8A1710A4}");

	// ADLER32
	
	adler32Modifier.getConfig().setChecksum(new Adler32());
	message = "[TEST] This Line Will Have an ADLER32 Checksum 2";
	syslog.info(message);
	events.add(message.toLowerCase() + " {ABD110F6}");

	// VERIFY
	
	SyslogUtility.sleep(pause);
	syslog.flush();
	verifySendReceive(events,false,false);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:64,代码来源:SyslogMessageModifierTest.java

示例9: testContinousChecksum

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testContinousChecksum() {
	try {
		new ChecksumSyslogMessageModifier(null);
		fail("Should not allow an empty config into a modifier");
		
	} catch (SyslogRuntimeException sre) {
		assertTrue(true);
	}
	
	// PREPARE
	
	List events = new ArrayList();
	String message = null;
	
	String protocol = getClientProtocol();
	SyslogIF syslog = getSyslog(protocol);
	syslog.getConfig().removeAllMessageModifiers();
	
	// CRC32 SET UP

	ChecksumSyslogMessageModifierConfig config = ChecksumSyslogMessageModifierConfig.createCRC32();
	assertFalse(config.isContinuous());
	config.setContinuous(true);
	assertTrue(config.isContinuous());
	
	ChecksumSyslogMessageModifier modifier = new ChecksumSyslogMessageModifier(config);
	syslog.getConfig().addMessageModifier(modifier);

	// CRC32 Message #1
	
	message = "[TEST] This Line Will Have a CRC32 Checksum 1";
	syslog.info(message);
	events.add(message + " {6E2A9F99}");

	// CRC32 Message #2
	
	message = "[TEST] This Line Will Have a CRC32 Checksum 2";
	syslog.info(message);
	events.add(message + " {7E736783}");

	// VERIFY
	
	SyslogUtility.sleep(pause);
	syslog.flush();
	verifySendReceive(events,false,false);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:47,代码来源:SyslogMessageModifierTest.java

示例10: testMac

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testMac() {
	// PREPARE
	
	List events = new ArrayList();
	String message = null;
	
	String protocol = getClientProtocol();
	SyslogIF syslog = getSyslog(protocol);
	syslog.getConfig().removeAllMessageModifiers();
	
	// HmacSHA1 SET UP
	
	String base64Key = "fb7Jl0VGnzY5ehJCabcf7bSZ5Vk=";
	SyslogMessageModifierIF messageModifier = MacSyslogMessageModifier.createHmacSHA1(base64Key);
	syslog.getConfig().addMessageModifier(messageModifier);

	// HmacSHA1
	
	message = "[TEST] This Line Will Have an HmacSHA1 Hash";
	syslog.info(message);
	events.add(message + " {6CIz39WE8wgxwpsqPievrtDWaXM=}");

	// HmacSHA256 SET UP
	
	base64Key = "+v2mHoOx6QGLqYFa/Tx0J7BkXSK4HEVMtGHtG66vQ54=";
	syslog.getConfig().removeAllMessageModifiers();
	messageModifier = MacSyslogMessageModifier.createHmacSHA256(base64Key);
	syslog.getConfig().addMessageModifier(messageModifier);

	// HmacSHA256
	
	message = "[TEST] This Line Will Have an HmacSHA256 Hash";
	syslog.info(message);
	events.add(message + " {sEpaXO6fvnO7szaJSjcqoIVl0C180/oWSP0rs6RFfB8=}");

	// HmacSHA512 SET UP
	
	base64Key = "w5sn5tOHpk/jBTWAQ4doTlSbtE1GQZC2RCe2/ayTy67zscXFEdlT/Zwsm5GFrjOwxlZITrAaq+s2KFCNpBTDig==";
	syslog.getConfig().removeAllMessageModifiers();
	messageModifier = MacSyslogMessageModifier.createHmacSHA512(base64Key);
	syslog.getConfig().addMessageModifier(messageModifier);

	// HmacSHA512
	
	message = "[TEST] This Line Will Have an HmacSHA512 Hash";
	syslog.info(message);
	events.add(message + " {Ddx+6JegzcifzT5H82BISGeGQ9FCA5biW51qItH9y95tJvFnFv+0+Tx/Kv0HAms2jv6iq08tlL7IFI1gMUWBtA==}");

	// HmacMD5 SET UP
	
	syslog.getConfig().removeAllMessageModifiers();

	base64Key = "fb7Jl0VGnzY5ehJCdeff7bSZ5Vk=";
	messageModifier = MacSyslogMessageModifier.createHmacMD5(base64Key);
	syslog.getConfig().addMessageModifier(messageModifier);

	// HmacMD5
	
	message = "[TEST] This Line Will Have an HmacMD5 Hash";
	syslog.info(message);
	events.add(message + " {Z+BBv07/AlQ55a6d88OuGg==}");

	// VERIFY
	
	SyslogUtility.sleep(pause);
	syslog.flush();
	verifySendReceive(events,false,false);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:69,代码来源:SyslogMessageModifierTest.java

示例11: testMacWithKeys

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testMacWithKeys() {
	// PREPARE
	
	List events = new ArrayList();
	String message = null;
	
	String protocol = getClientProtocol();
	SyslogIF syslog = getSyslog(protocol);
	syslog.getConfig().removeAllMessageModifiers();
	
	// HmacSHA1 SET UP
	
	Key key = createKey("fb7Jl0VGnzY5ehJCabcf7bSZ5Vk=","SHA1");
	SyslogMessageModifierIF messageModifier = MacSyslogMessageModifier.createHmacSHA1(key);
	syslog.getConfig().addMessageModifier(messageModifier);

	// HmacSHA1
	
	message = "[TEST] This Line Will Have an HmacSHA1 Hash";
	syslog.info(message);
	events.add(message + " {6CIz39WE8wgxwpsqPievrtDWaXM=}");

	// HmacSHA256 SET UP
	
	key = createKey("+v2mHoOx6QGLqYFa/Tx0J7BkXSK4HEVMtGHtG66vQ54=","SHA256");
	syslog.getConfig().removeAllMessageModifiers();
	messageModifier = MacSyslogMessageModifier.createHmacSHA256(key);
	syslog.getConfig().addMessageModifier(messageModifier);

	// HmacSHA256
	
	message = "[TEST] This Line Will Have an HmacSHA256 Hash";
	syslog.info(message);
	events.add(message + " {sEpaXO6fvnO7szaJSjcqoIVl0C180/oWSP0rs6RFfB8=}");

	// HmacSHA512 SET UP
	
	key = createKey("w5sn5tOHpk/jBTWAQ4doTlSbtE1GQZC2RCe2/ayTy67zscXFEdlT/Zwsm5GFrjOwxlZITrAaq+s2KFCNpBTDig==","SHA512");
	syslog.getConfig().removeAllMessageModifiers();
	messageModifier = MacSyslogMessageModifier.createHmacSHA512(key);
	syslog.getConfig().addMessageModifier(messageModifier);

	// HmacSHA512
	
	message = "[TEST] This Line Will Have an HmacSHA512 Hash";
	syslog.info(message);
	events.add(message + " {Ddx+6JegzcifzT5H82BISGeGQ9FCA5biW51qItH9y95tJvFnFv+0+Tx/Kv0HAms2jv6iq08tlL7IFI1gMUWBtA==}");

	// HmacMD5 SET UP
	
	syslog.getConfig().removeAllMessageModifiers();

	key = createKey("fb7Jl0VGnzY5ehJCdeff7bSZ5Vk=","MD5");
	messageModifier = MacSyslogMessageModifier.createHmacMD5(key);
	syslog.getConfig().addMessageModifier(messageModifier);

	// HmacMD5
	
	message = "[TEST] This Line Will Have an HmacMD5 Hash";
	syslog.info(message);
	events.add(message + " {Z+BBv07/AlQ55a6d88OuGg==}");

	// VERIFY
	
	SyslogUtility.sleep(pause);
	syslog.flush();
	verifySendReceive(events,false,false);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:69,代码来源:SyslogMessageModifierTest.java

示例12: testMultipleSyslog

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testMultipleSyslog() {
	FakeSyslogConfig config1 = new FakeSyslogConfig();
	FakeSyslog fake1 = (FakeSyslog) Syslog.createInstance("fake1", config1);

	FakeSyslogConfig config2 = new FakeSyslogConfig();
	FakeSyslog fake2 = (FakeSyslog) Syslog.createInstance("fake2", config2);

	MultipleSyslogConfig config = new MultipleSyslogConfig();
	config.addProtocol("fake1");
	config.addProtocol("fake2");
	
	SyslogIF syslog = Syslog.createInstance("multiple",config);
	
	assertEquals(0,fake1.total);
	assertEquals(0,fake2.total);
	
	syslog.debug("test");
	assertEquals(1,fake1.total);
	assertEquals(1,fake2.total);

	syslog.debug(new FakeSyslogMessage());
	assertEquals(1 + 2,fake1.total);
	assertEquals(1 + 2,fake2.total);

	syslog.info("test");
	assertEquals(1 + 2 + 4,fake1.total);
	assertEquals(1 + 2 + 4,fake2.total);
	
	syslog.info(new FakeSyslogMessage());
	assertEquals(1 + 2 + 4 + 8,fake1.total);
	assertEquals(1 + 2 + 4 + 8,fake2.total);
	
	syslog.notice("test");
	assertEquals(1 + 2 + 4 + 8 + 16,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16,fake2.total);
	
	syslog.notice(new FakeSyslogMessage());
	assertEquals(1 + 2 + 4 + 8 + 16 + 32,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32,fake2.total);

	syslog.warn("test");
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64,fake2.total);
	
	syslog.warn(new FakeSyslogMessage());
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128,fake2.total);

	syslog.error("test");
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256,fake2.total);
	
	syslog.error(new FakeSyslogMessage());
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512,fake2.total);

	syslog.critical("test");
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024,fake2.total);
	
	syslog.critical(new FakeSyslogMessage());
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048,fake2.total);

	syslog.alert("test");
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 + 4096,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 + 4096,fake2.total);
	
	syslog.alert(new FakeSyslogMessage());
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 + 4096 + 8192,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 + 4096 + 8192,fake2.total);

	syslog.emergency("test");
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 + 4096 + 8192 + 16384,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 + 4096 + 8192 + 16384,fake2.total);
	
	syslog.emergency(new FakeSyslogMessage());
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 + 4096 + 8192 + 16384 + 32768,fake1.total);
	assertEquals(1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 + 256 + 512 + 1024 + 2048 + 4096 + 8192 + 16384 + 32768,fake2.total);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:81,代码来源:MultipleSyslogCreateTest.java

示例13: testUnixSyslog

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testUnixSyslog() {
	if (Boolean.getBoolean(SyslogConstants.DISABLE_UNIX_PROPERTY)) {
		assertTrue(true);
		return;
	}

	SyslogIF syslog = Syslog.getInstance(SyslogConstants.UNIX_SOCKET);
	
	UnixSocketSyslogConfig config = (UnixSocketSyslogConfig) syslog.getConfig();
	
	config.setPath("/tmp/syslog4j.sock");
	config.setType(UnixSocketSyslogConfig.SOCK_STREAM);
	
	syslog.info(this.getClass().getName() + ": unix_socket " + System.currentTimeMillis());
	
	syslog.flush();
	
	SyslogUtility.sleep(1000);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:20,代码来源:UnixSocketSyslogTest.java

示例14: _testSendReceive

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void _testSendReceive(boolean sortEvents, boolean sortRecordedEvents){
	List events = new ArrayList();
	
	String protocol = getClientProtocol();
	
	SyslogIF syslog = getSyslog(protocol);
	
	for(int i=0; i<getMessageCount(); i++) {
		String message = "[TEST] " + i + " / " + System.currentTimeMillis();
		
		syslog.info(message);
		events.add(message);
	}
	
	SyslogUtility.sleep(200);
	
	syslog.flush();
	
	verifySendReceive(events,sortEvents,sortRecordedEvents);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:21,代码来源:AbstractNetSyslog4jTest.java

示例15: testTimeout

import org.productivity.java.syslog4j.SyslogIF; //导入方法依赖的package包/类
public void testTimeout() {
	TCPNetSyslogServerConfigIF serverConfig = new TCPNetSyslogServerConfig();
	serverConfig.setTimeout(150);
	serverConfig.setPort(7777);
	serverConfig.addEventHandler(new TimeoutHandler());

	TCPNetSyslogConfigIF clientConfig = new TCPNetSyslogConfig();
	clientConfig.setPort(7777);
	clientConfig.setThreaded(false);

	SyslogServer.createThreadedInstance("tcp_to",serverConfig);
	SyslogUtility.sleep(250);
	
	SyslogIF syslog = Syslog.createInstance("tcp_to",clientConfig);
	SyslogUtility.sleep(250);
	
	int mark = 0;
	
	for(int i=1; i<=10; i++) {
		if (i > 5) {
			mark--;
			
		} else {
			mark++;
		}
		
		int timeout = 35 * mark + 25;
		
		syslog.info("Test " + i + " (" + timeout + "ms) Should Timeout: " + (timeout > serverConfig.getTimeout() ? "yes" : "no"));
		SyslogUtility.sleep(timeout);
	}
	
	syslog.flush();
	SyslogUtility.sleep(200);
	
	SyslogServer.destroyInstance("tcp_to");
	
	SyslogUtility.sleep(200);
	
	Syslog.destroyInstance("tcp_to");
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:42,代码来源:TCPNetSyslog4jTest.java


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