Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LoggingEvent


  public void onMessage(Message message) {
    try {
      if(message instanceof  ObjectMessage) {
        // get the logging event and post it to the repository
        ObjectMessage objectMessage = (ObjectMessage) message;
        LoggingEvent event = (LoggingEvent) objectMessage.getObject();
       
        // store the known remote info in an event property
        event.setProperty("log4j.remoteSourceInfo", remoteInfo);
        event.setProperty("log4j.jmsProviderUrl", providerUrl);
       
        doPost(event);
      } else {
        getLogger().warn("Received message is of type "+message.getJMSType()
        +", was expecting ObjectMessage.");
View Full Code Here


    baseString_ = name;
  }

  private LoggingEvent createEvent(
    Level level, Logger logger, String msg, Throwable t) {
    LoggingEvent e = new LoggingEvent(
        logger.getClass().getName(), logger, level, msg, t);
    e.setProperty(Constants.APPLICATION_KEY, getName());
    e.setProperty(Constants.HOSTNAME_KEY, "localhost");

    return e;
  }
View Full Code Here

    public Worker(Socket server) {
      this.server = server;
    }
   
    public void run() {
      LoggingEvent event;

      try {
        ois = new ObjectInputStream(
                           new BufferedInputStream(server.getInputStream()));
        if (ois != null) {
View Full Code Here

     * @param index
     *            the index to check at
     */
    private void assertLoggedMessage(String message, List events, int index)
    {
        LoggingEvent e = (LoggingEvent) events.get(index);

        assertEquals("Message", message, e.getMessage());
    }
View Full Code Here

    {
        int count = events.size();

        for (int i = 0; i < count; i++)
        {
            LoggingEvent e = (LoggingEvent) events.get(i);

            String eventMessage = String.valueOf(e.getMessage());

            if (eventMessage.indexOf(message) >= 0)
                return;
        }
View Full Code Here

        int count = events.size();

        for (int i = 0; i < count; i++)
        {
            LoggingEvent e = (LoggingEvent) events.get(i);

            String eventMessage = e.getMessage().toString();

            if (compiled == null)
                compiled = _compiler.compile(pattern);

            if (_matcher.contains(eventMessage, compiled))
View Full Code Here

     * @param index
     *            the index to check at
     */
    private void assertLoggedMessage(String message, List events, int index)
    {
        LoggingEvent e = (LoggingEvent) events.get(index);

        assertEquals("Message", message, e.getMessage());
    }
View Full Code Here

    {
        int count = events.size();

        for (int i = 0; i < count; i++)
        {
            LoggingEvent e = (LoggingEvent) events.get(i);

            String eventMessage = String.valueOf(e.getMessage());

            if (eventMessage.indexOf(message) >= 0)
                return;
        }
View Full Code Here

        int count = events.size();

        for (int i = 0; i < count; i++)
        {
            LoggingEvent e = (LoggingEvent) events.get(i);

            String eventMessage = e.getMessage().toString();

            if (compiled == null)
                compiled = _compiler.compile(pattern);

            if (_matcher.contains(eventMessage, compiled))
View Full Code Here

            } else {
                level = org.apache.log4j.Level.INFO;
            }
            String message = logRecord.getMessage();
            Throwable throwable = logRecord.getThrown();
            logger.callAppenders(new LoggingEvent(name, logger, level, message, throwable));
        }
View Full Code Here

TOP

Related Classes of org.apache.log4j.spi.LoggingEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.