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


Java SyslogServer.getThreadedInstance方法代码示例

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


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

示例1: startServerThread

import org.productivity.java.syslog4j.server.SyslogServer; //导入方法依赖的package包/类
protected void startServerThread(String protocol) {
	this.server = SyslogServer.getInstance(protocol);
	
	AbstractNetSyslogServerConfig config = (AbstractNetSyslogServerConfig) this.server.getConfig();
	config.setPort(TEST_PORT);
	config.addEventHandler(this.recorderEventHandler);

	this.server = SyslogServer.getThreadedInstance(protocol);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:10,代码来源:AbstractLog4jSyslog4jTest.java

示例2: setup

import org.productivity.java.syslog4j.server.SyslogServer; //导入方法依赖的package包/类
/**
 * Starts Syslog server and configures syslog handler in the AS.
 *
 */
@Override
public void setup(ManagementClient managementClient) throws Exception {
    // clear created server instances (TCP/UDP)
    SyslogServer.shutdown();

    // start and set syslog server

    final String host = managementClient.getMgmtAddress();
    SyslogServerConfigIF config = getSyslogConfig();
    config.setUseStructuredData(true);
    config.setHost(host);
    config.setPort(SYSLOG_PORT);
    config.addEventHandler(new BlockedSyslogServerEventHandler());
    final String syslogProtocol = getSyslogProtocol();
    server = SyslogServer.createInstance(syslogProtocol, config);
    // start syslog server
    SyslogServer.getThreadedInstance(syslogProtocol);

    // Add the normal syslog handler
    addSyslogHandler(managementClient, AUDIT_SYSLOG_HANDLER_ADDR, host, null, null);

    // Add the syslog handler we will switch to
    addSyslogHandler(managementClient, AUDIT_SYSLOG_HANDLER_ADDR2, host, "TestApp", Facility.LINE_PRINTER);

    // Reference the first audit logger for now
    ModelNode op = Util.createAddOperation(AUDIT_LOG_LOGGER_SYSLOG_HANDLER_ADDR);
    CoreUtils.applyUpdate(op, managementClient.getControllerClient());

    op = Util.getWriteAttributeOperation(AUDIT_LOG_LOGGER_ADDR, LOG_READ_ONLY, false);
    CoreUtils.applyUpdate(op, managementClient.getControllerClient());

}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:37,代码来源:AuditLogToSyslogSetup.java

示例3: setup

import org.productivity.java.syslog4j.server.SyslogServer; //导入方法依赖的package包/类
@Override
public void setup(final ManagementClient managementClient) throws Exception {
    LOGGER.info("starting syslog server on port " + PORT);

    // clear created server instances (TCP/UDP)
    SyslogServer.shutdown();
    // create a new UDP instance
    final String host = CoreUtils.stripSquareBrackets(managementClient.getMgmtAddress());
    final UDPSyslogServerConfig config = new UDPSyslogServerConfig();
    config.setPort(PORT);
    config.setHost(host);
    config.setUseStructuredData(true);
    config.addEventHandler(new BlockedSyslogServerEventHandler());
    SyslogServer.createInstance(UDP, config);
    // start syslog server
    SyslogServer.getThreadedInstance(SyslogConstants.UDP);

    final CompositeOperationBuilder builder = CompositeOperationBuilder.create();

    // create syslog-profile
    builder.addStep(Operations.createAddOperation(SYSLOG_PROFILE_ADDR));

    ModelNode op = Operations.createAddOperation(SYSLOG_HANDLER_ADDR);
    op.get("level").set("TRACE");
    op.get("port").set(PORT);
    op.get("server-address").set(host);
    op.get("enabled").set("true");
    builder.addStep(op);

    op = Operations.createAddOperation(SYSLOG_PROFILE_ROOT_LOGGER_ADDR);
    op.get("level").set("TRACE");
    op.get("handlers").add("SYSLOG");
    builder.addStep(op);

    executeOperation(builder.build());

    LOGGER.info("syslog server setup complete");
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:39,代码来源:SyslogHandlerTestCase.java

示例4: createAndStartSyslogInstance

import org.productivity.java.syslog4j.server.SyslogServer; //导入方法依赖的package包/类
private static SyslogServerIF createAndStartSyslogInstance(SyslogServerConfigIF config, String host, int port, String protocol) {
    config.setUseStructuredData(true);
    config.setHost(host);
    config.setPort(port);
    config.addEventHandler(new BlockedAllProtocolsSyslogServerEventHandler(protocol));
    SyslogServerIF syslogServer = SyslogServer.createInstance(protocol, config);
    SyslogServer.getThreadedInstance(protocol);
    return syslogServer;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:10,代码来源:AbstractSyslogReconnectionTestCase.java

示例5: run

import org.productivity.java.syslog4j.server.SyslogServer; //导入方法依赖的package包/类
public void run() {
	SyslogUtility.sleep(this.pause);
	
	SyslogServer.getThreadedInstance(this.protocol);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:6,代码来源:BackLogTCPNetSyslog4jTest.java

示例6: testSendReceive

import org.productivity.java.syslog4j.server.SyslogServer; //导入方法依赖的package包/类
public void testSendReceive(String protocol, boolean useSyslogClass) {
	SyslogServer.getInstance(protocol).getConfig().setPort(1514);
	SyslogServerIF syslogServer = SyslogServer.getThreadedInstance(protocol);
	
	SyslogUtility.sleep(100);
	
	CaptureHandler captureHandler = new CaptureHandler();
	syslogServer.getConfig().addEventHandler(captureHandler);
	
	String message = "test message";
	
	try {
		if (useSyslogClass) {
			Syslog.main(new String[] { "-p", "1514", protocol, message });
			
		} else {
			SyslogMain.main(new String[] { "-p", "1514", protocol, message }, false);
		}
		
	} catch (Exception e) {
		//
	}
	
	SyslogUtility.sleep(250);
	
	assertTrue(captureHandler.capturedEvent.getMessage().endsWith(message));
	
	syslogServer.shutdown();

	SyslogUtility.sleep(100);
}
 
开发者ID:syslog4j,项目名称:syslog4j,代码行数:32,代码来源:CommandLineNetSyslog4jTest.java


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