本文整理汇总了Java中org.productivity.java.syslog4j.impl.unix.socket.UnixSocketSyslogConfig类的典型用法代码示例。如果您正苦于以下问题:Java UnixSocketSyslogConfig类的具体用法?Java UnixSocketSyslogConfig怎么用?Java UnixSocketSyslogConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnixSocketSyslogConfig类属于org.productivity.java.syslog4j.impl.unix.socket包,在下文中一共展示了UnixSocketSyslogConfig类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.productivity.java.syslog4j.impl.unix.socket.UnixSocketSyslogConfig; //导入依赖的package包/类
/**
* initialize() sets up the default TCP and UDP Syslog protocols, as
* well as UNIX_SYSLOG and UNIX_SOCKET (if running on a Unix-based system).
*/
public synchronized static final void initialize() {
createInstance(UDP,new UDPNetSyslogConfig());
createInstance(TCP,new TCPNetSyslogConfig());
if (OSDetectUtility.isUnix()
&& SyslogUtility.isClassExists(JNA_NATIVE_CLASS)
&& !Boolean.getBoolean(DISABLE_UNIX_PROPERTY)) {
createInstance(UNIX_SYSLOG,new UnixSyslogConfig());
createInstance(UNIX_SOCKET,new UnixSocketSyslogConfig());
}
}
示例2: JsonServerSyslog
import org.productivity.java.syslog4j.impl.unix.socket.UnixSocketSyslogConfig; //导入依赖的package包/类
public JsonServerSyslog(String serviceName, String configFileParam, int defultLogLevel) {
this.serviceName = serviceName;
logLevel = defultLogLevel;
UnixSocketSyslogConfig cfg = new UnixSocketSyslogConfig();
if (System.getProperty("os.name").toLowerCase().startsWith("mac"))
cfg.setPath("/var/run/syslog");
cfg.setFacility(SyslogConstants.FACILITY_LOCAL1);
cfg.removeAllMessageModifiers();
cfg.setIdent(null);
log = new UnixSocketSyslog();
log.initialize(SyslogConstants.UNIX_SOCKET, cfg);
this.config = new Config(configFileParam, serviceName);
}
示例3: testUnixSyslog
import org.productivity.java.syslog4j.impl.unix.socket.UnixSocketSyslogConfig; //导入依赖的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);
}