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


Java LoggingEventVO.build方法代码示例

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


在下文中一共展示了LoggingEventVO.build方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例8: 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


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