本文整理了Java中org.opennms.core.logging.Logging.putPrefix()
方法的一些代码示例,展示了Logging.putPrefix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logging.putPrefix()
方法的具体详情如下:
包路径:org.opennms.core.logging.Logging
类名称:Logging
方法名:putPrefix
暂无
代码示例来源:origin: OpenNMS/opennms
/**
* The constructor for the RTCManager
*/
public RTCManager() {
super("rtc");
Logging.putPrefix("rtc");
}
代码示例来源:origin: OpenNMS/opennms
private void setLogPrefix() {
Logging.putPrefix(LOG4J_CATEGORY);
}
代码示例来源:origin: OpenNMS/opennms
private void setLogPrefix() {
Logging.putPrefix(LOG4J_CATEGORY);
}
代码示例来源:origin: OpenNMS/opennms
@Override
protected ConnectionPool createConnectionPool(Connection connection) {
// The threads that request and use connections from this pool
// are related to the IPC modules, so we set the prefix accordingly
Logging.putPrefix("ipc");
return super.createConnectionPool(connection);
}
代码示例来源:origin: OpenNMS/opennms
@Override
public void run() {
Logging.putPrefix("icmp");
try {
processPackets(callback);
} catch (Throwable t) {
LOG.error("Unexpected exception on Thread {}!", this, t);
}
}
};
代码示例来源:origin: org.opennms.features.activemq/org.opennms.features.activemq.pool
@Override
protected ConnectionPool createConnectionPool(Connection connection) {
// The threads that request and use connections from this pool
// are related to the IPC modules, so we set the prefix accordingly
Logging.putPrefix("ipc");
return super.createConnectionPool(connection);
}
代码示例来源:origin: org.opennms/opennms-icmp-jni6
@Override
public void run() {
Logging.putPrefix("icmp");
try {
processPackets(callback);
} catch (Throwable t) {
LOG.error("Unexpected exception on Thread {}!", this, t);
}
}
};
代码示例来源:origin: OpenNMS/opennms
@Override
public void run() {
Logging.putPrefix("icmp");
try {
processPackets(callback);
} catch (Throwable t) {
LOG.error("Unexpected exception on Thread {}!", this, t);
}
}
};
代码示例来源:origin: OpenNMS/opennms
public static <T> T withPrefix(final String prefix, final Callable<T> callable) throws Exception {
final Map<String, String> mdc = Logging.getCopyOfContextMap();
try {
Logging.putPrefix(prefix);
return callable.call();
} finally {
Logging.setContextMap(mdc);
}
}
代码示例来源:origin: OpenNMS/opennms
public static void withPrefix(final String prefix, final Runnable runnable) {
final Map<String, String> mdc = Logging.getCopyOfContextMap();
try {
Logging.putPrefix(prefix);
runnable.run();
} finally {
Logging.setContextMap(mdc);
}
}
代码示例来源:origin: OpenNMS/opennms
public static MDCCloseable withPrefixCloseable(final String prefix) {
final Map<String, String> mdc = Logging.getCopyOfContextMap();
Logging.putPrefix(prefix);
return new MDCCloseable(mdc);
}
代码示例来源:origin: OpenNMS/opennms
@Override
public void run() {
// Set the prefix for this thread
Logging.putPrefix(Syslogd.LOG4J_CATEGORY);
// Create an asynchronous dispatcher
final SyslogSinkModule syslogSinkModule = new SyslogSinkModule(m_config, m_distPollerDao);
m_dispatcher = m_messageDispatcherFactory.createAsyncDispatcher(syslogSinkModule);
}
代码示例来源:origin: OpenNMS/opennms
public EngineAdapter(final CorrelationEngine engine) {
m_engine = engine;
m_name = m_engine.getClass().getSimpleName() + '-' + m_engine.getName() ;
Map<String,String> mdc = Logging.getCopyOfContextMap();
Logging.putPrefix(m_name);
registerEventListeners();
Logging.setContextMap(mdc);
}
代码示例来源:origin: org.opennms/opennms-correlator
public EngineAdapter(final CorrelationEngine engine) {
m_engine = engine;
m_name = m_engine.getClass().getSimpleName() + '-' + m_engine.getName() ;
Map<String,String> mdc = Logging.getCopyOfContextMap();
Logging.putPrefix(m_name);
registerEventListeners();
Logging.setContextMap(mdc);
}
代码示例来源:origin: OpenNMS/opennms
/**
* Process the event depending on the UEI and update date
*/
@Override
public void run() {
final Map<String,String> mdc = Logging.getCopyOfContextMap();
try {
Logging.putPrefix("rtc");
processEvent();
} catch (Throwable t) {
LOG.warn("Unexpected exception processing event", t);
Logging.setContextMap(mdc);
}
}
}
代码示例来源:origin: org.opennms/opennms-correlator
/**
* Initialization.
*
* Retrieves the Spring context for the correlator.
*/
@Override
public void init() {
Map<String,String> mdc = Logging.getCopyOfContextMap();
Logging.putPrefix("correlator");
m_correlator = BeanUtils.getBean("correlatorContext", "correlator", org.opennms.netmgt.correlation.Correlator.class);
Logging.setContextMap(mdc);
}
代码示例来源:origin: OpenNMS/opennms
/**
* Initialization.
*
* Retrieves the Spring context for the correlator.
*/
@Override
public void init() {
Map<String,String> mdc = Logging.getCopyOfContextMap();
Logging.putPrefix("correlator");
m_correlator = BeanUtils.getBean("correlatorContext", "correlator", org.opennms.netmgt.correlation.Correlator.class);
Logging.setContextMap(mdc);
}
代码示例来源:origin: OpenNMS/opennms
@Override
public CollectorResponseDTO get() {
Logging.putPrefix("collectd");
final CollectionAgent agent = request.getAgent();
final Map<String, Object> parameters = request.getParameters(collector);
return new CollectorResponseDTO(collector.collect(agent, parameters));
}
}, executor);
代码示例来源:origin: org.opennms.features.collection/org.opennms.features.collection.client-rpc
@Override
public CollectorResponseDTO get() {
Logging.putPrefix("collectd");
final CollectionAgent agent = request.getAgent();
final Map<String, Object> parameters = request.getParameters(collector);
return new CollectorResponseDTO(collector.collect(agent, parameters));
}
}, executor);
代码示例来源:origin: OpenNMS/opennms
@Override
public void run() {
Logging.putPrefix("icmp");
try {
final int pingerId = getPingerId();
while (!isFinished()) {
final NativeDatagramPacket datagram = new NativeDatagramPacket(65535);
getPingSocket().receive(datagram);
final long received = System.nanoTime();
final ICMPPacket icmpPacket = new ICMPPacket(getIPPayload(datagram));
final V4PingReply echoReply = icmpPacket.getType() == Type.EchoReply ? new V4PingReply(icmpPacket, received) : null;
if (echoReply != null && echoReply.getIdentifier() == pingerId && echoReply.isValid()) {
notifyPingListeners(datagram.getAddress(), echoReply);
}
}
} catch(final Throwable e) {
setThrowable(e);
LOG.debug("Error caught while processing ping packets: {}", e.getMessage(), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!