當前位置: 首頁>>代碼示例>>Java>>正文


Java LoggingEventVO類代碼示例

本文整理匯總了Java中ch.qos.logback.classic.spi.LoggingEventVO的典型用法代碼示例。如果您正苦於以下問題:Java LoggingEventVO類的具體用法?Java LoggingEventVO怎麽用?Java LoggingEventVO使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LoggingEventVO類屬於ch.qos.logback.classic.spi包,在下文中一共展示了LoggingEventVO類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUp

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
  LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
  
  appender = new MockAppender();
  appender.start();
 
  logger = lc.getLogger(getClass());
  logger.addAppender(appender);

  event = new LoggingEvent(logger.getName(), logger, 
      Level.DEBUG, "test message", null, new Object[0]);
  
  LoggingEventVO eventVO = LoggingEventVO.build(event);
  
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  ObjectOutputStream oos = new ObjectOutputStream(bos);
  oos.writeObject(eventVO);
  oos.close();
 
  ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
  client = new RemoteAppenderStreamClient("some client ID", bis);
  client.setLoggerContext(lc);
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:25,代碼來源:RemoteAppenderStreamClientTest.java

示例2: testDispatchEventForEnabledLevel

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
@Test
public void testDispatchEventForEnabledLevel() throws Exception {
  receiver.setRemoteHost(InetAddress.getLocalHost().getHostName());
  receiver.setPort(6000);
  receiver.start();
  assertTrue(receiver.awaitConnectorCreated(DELAY));
  Socket socket = serverSocket.accept();

  ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
  
  logger.setLevel(Level.DEBUG);
  ILoggingEvent event = new LoggingEvent(logger.getName(), logger, 
      Level.DEBUG, "test message", null, new Object[0]);

  LoggingEventVO eventVO = LoggingEventVO.build(event);
  oos.writeObject(eventVO);
  oos.flush();

  ILoggingEvent rcvdEvent = appender.awaitAppend(DELAY);
  assertNotNull(rcvdEvent);
  assertEquals(event.getLoggerName(), rcvdEvent.getLoggerName());
  assertEquals(event.getLevel(), rcvdEvent.getLevel());
  assertEquals(event.getMessage(), rcvdEvent.getMessage());
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:25,代碼來源:SocketReceiverTest.java

示例3: testNoDispatchEventForDisabledLevel

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
@Test
public void testNoDispatchEventForDisabledLevel() throws Exception {
  receiver.setRemoteHost(InetAddress.getLocalHost().getHostName());
  receiver.setPort(6000);
  receiver.start();
  assertTrue(receiver.awaitConnectorCreated(DELAY));
  Socket socket = serverSocket.accept();

  ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
  
  logger.setLevel(Level.INFO);
  ILoggingEvent event = new LoggingEvent(logger.getName(), logger, 
      Level.DEBUG, "test message", null, new Object[0]);

  LoggingEventVO eventVO = LoggingEventVO.build(event);
  oos.writeObject(eventVO);
  oos.flush();

  assertNull(appender.awaitAppend(DELAY));
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:21,代碼來源:SocketReceiverTest.java

示例4: transform

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
public Serializable transform(ILoggingEvent event) {
  if(event == null) {
    return null;
  }
  if (event instanceof LoggingEvent) {
    return LoggingEventVO.build(event);
  } else if (event instanceof LoggingEventVO) {
    return (LoggingEventVO)  event;
  } else {
    throw new IllegalArgumentException("Unsupported type "+event.getClass().getName());
  }
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:13,代碼來源:LoggingEventPreSerializationTransformer.java

示例5: testLogEventFromClient

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
@Test
public void testLogEventFromClient() throws Exception {
  ILoggingEvent event = new LoggingEvent(logger.getName(), logger, 
      Level.DEBUG, "test message", null, new Object[0]);
  Socket socket = new Socket(InetAddress.getLocalHost(), 
      serverSocket.getLocalPort());
  
  try {      
    LoggingEventVO eventVO = LoggingEventVO.build(event);
    
    ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
    for (int i = 0; i < EVENT_COUNT; i++) {
      oos.writeObject(eventVO);
    }

    oos.writeObject(eventVO);
    oos.flush();
  }
  finally {
    socket.close();
  }
  
  ILoggingEvent rcvdEvent = appender.awaitAppend(SHUTDOWN_DELAY);
  assertNotNull(rcvdEvent);
  assertEquals(event.getLoggerName(), rcvdEvent.getLoggerName());
  assertEquals(event.getLevel(), rcvdEvent.getLevel());
  assertEquals(event.getMessage(), rcvdEvent.getMessage());
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:29,代碼來源:ServerSocketReceiverFunctionalTest.java

示例6: transform

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
public Serializable transform(ILoggingEvent event) {
    if (event == null) {
        return null;
    }

    if (event instanceof LoggingEvent) {
        return LoggingEventVO.build(new LoggingEventWithLoggerNameInMessage(event));
    } else if (event instanceof LoggingEventVO) {
        return (LoggingEventVO) event;
    } else {
        throw new IllegalArgumentException("Unsupported type " + event.getClass().getName());
    }
}
 
開發者ID:rpuch,項目名稱:logging-extensions,代碼行數:14,代碼來源:LoggerNameInMessageTransformer.java

示例7: publishRetry

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
/**
 * Publishes the logging event to RemoteLogger using cashed proxy. Retries once on failure using {@link #publishNoRetry(java.util.List)}.
 *
 * @param vos the logging events to publish
 */
private void publishRetry(List<LoggingEventVO> vos) {
    try {
        remoteLogger.publish(vos);
    } catch (RemoteException e) {
        log.debug("Could not publish logging event, retrying", e);
        publishNoRetry(vos);
    }
}
 
開發者ID:mwsobol,項目名稱:SORCER,代碼行數:14,代碼來源:RemoteLoggerClient.java

示例8: publishNoRetry

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
/**
 * Gets a new RemoteLogger proxy and if it's available, publishes the logging event to it.
 *
 * @param vos the logging events to publish
 */
private void publishNoRetry(List<LoggingEventVO> vos) {
    Object o = Accessor.get().getService(null, RemoteLogger.class);
    remoteLogger = (RemoteLogger)o;
    if (remoteLogger != null)
        try {
            remoteLogger.publish(vos);
        } catch (RemoteException e) {
            log.debug("Could not publish logging event", e);
            remoteLogger = null;
        }
}
 
開發者ID:mwsobol,項目名稱:SORCER,代碼行數:17,代碼來源:RemoteLoggerClient.java

示例9: vo

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
private static List<LoggingEventVO> vo(List<ILoggingEvent> loggingEvents) {
    List<LoggingEventVO> result = new ArrayList<LoggingEventVO>();
    for (ILoggingEvent event : loggingEvents)
        if (event instanceof LoggingEventVO)
            result.add((LoggingEventVO) event);
        else
            result.add(LoggingEventVO.build(event));
    return result;
}
 
開發者ID:mwsobol,項目名稱:SORCER,代碼行數:10,代碼來源:RemoteLoggerClient.java

示例10: build

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
public Object build(int i) {
  TrivialLoggingEventBuilder loggingEventBuilder = new TrivialLoggingEventBuilder();
  LoggingEvent event = (LoggingEvent) loggingEventBuilder.build(i);

  return LoggingEventVO.build(event);
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:7,代碼來源:TrivialLoggingEventVOBuilder.java

示例11: buildLoggingEventVO

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
private LoggingEventVO buildLoggingEventVO(ILoggingEvent originalEventObject) {
    final ILoggingEvent adjustedEvent = sendLoggerNameInMessage
            ? new LoggingEventWithLoggerNameInMessage(originalEventObject)
            : originalEventObject;
    return LoggingEventVO.build(adjustedEvent);
}
 
開發者ID:rpuch,項目名稱:logging-extensions,代碼行數:7,代碼來源:UDPLogbackAppender.java

示例12: publish

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
public void publish(List<LoggingEventVO> loggingEvents) {
    for (LoggingEventVO vo : loggingEvents)
        publish(vo);
}
 
開發者ID:mwsobol,項目名稱:SORCER,代碼行數:5,代碼來源:RemoteLoggerManager.java

示例13: publish

import ch.qos.logback.classic.spi.LoggingEventVO; //導入依賴的package包/類
public void publish(List<LoggingEventVO> record) throws RemoteException; 
開發者ID:mwsobol,項目名稱:SORCER,代碼行數:2,代碼來源:RemoteLogger.java


注:本文中的ch.qos.logback.classic.spi.LoggingEventVO類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。