Package org.apache.log4j.spi

Examples of org.apache.log4j.spi.LoggingEvent


   */
  public void run() {

    // Category cat = Category.getInstance(Dispatcher.class.getName());

    LoggingEvent event;

    while (true) {
      synchronized (bf) {
        if (bf.length() == 0) {
          // Exit loop if interrupted but only if the the buffer is
View Full Code Here


      // If this event is not between the start and end dates, then skip it.
      if (null != dateFilter && !dateFilter.containsLong(ts))
        return null;
      Category c = Logger.getLogger(clazz);
      Level l = Level.toLevel(level);
      LoggingEvent event = new LoggingEvent(clazz, c, ts, l, message, threadName, (ThrowableInformation) null, (String) null, (LocationInfo) null,
          (Map<?,?>) null);
      // Check the log level filter
      if (null != levelFilter && (levelFilter.decide(event) == Filter.DENY)) {
        return null;
      }
View Full Code Here

  public void flushBuffer() {
    //Do the actual logging
    removes.ensureCapacity(buffer.size());
    for (Iterator i = buffer.iterator(); i.hasNext();) {
      try {
        LoggingEvent logEvent = (LoggingEvent)i.next();
      String sql = getLogStatement(logEvent);
      execute(sql);
        removes.add(logEvent);
      }
      catch (SQLException e) {
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

    /* (non-Javadoc)
     * @see org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent)
     */
    protected void append( LoggingEvent event )
    {
        final LoggingEvent logEvent = event;

        // We need to print the message on console asynchronously to avoid UI thread exception
        Display.getDefault().asyncExec( new Runnable()
        {
            public void run()
            {
                LogMessageConsole console = ConsolesHandler.getDefault().getLogMessageConsole( serverId );
                if ( console != null )
                {
                    // Formatting the message with the layout
                    String message = layout.format( logEvent );

                    // Switching dependening on the level
                    Level level = logEvent.getLevel();
                    if ( level == Level.INFO )
                    {
                        console.getInfoConsoleMessageStream().print( message );
                    }
                    else if ( level == Level.DEBUG )
View Full Code Here

    /**
     * Updates the preview label.
     */
    private void updatePreviewLabel()
    {
        LoggingEvent loggingEvent = new LoggingEvent(
            Messages.getString( "ServerLogsPage.CategoryClass" ), Logger.getLogger( "logger" ), Level.INFO, //$NON-NLS-1$ //$NON-NLS-2$
            Messages.getString( "ServerLogsPage.LoggingMessage" ), new Exception( Messages.getString( "ServerLogsPage.AnException" ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
        previewLabel.setText( new PatternLayout( patternText.getText() ).format( loggingEvent ) );
    }
View Full Code Here

        // Avoid high throughput.
        if (!highTroughputAllowed && _highThroughputCount > 0 &&  _highThroughputCount > (highTroughputMaxTime / 1000)) {
            setLoggerSetsLevel(org.apache.log4j.Level.FATAL);
            String warnMessage = "\nWARNING: Log4J High thoughput detected (more than " + getHighThroughput() + " events per second). All log levels set to FATAL.\n";
            LoggingEvent warnEvent = new LoggingEvent(Category.class.getName(), Logger.getRootLogger(), org.apache.log4j.Level.WARN, warnMessage, null);
            memoryAppender.buffer.addLast(warnEvent);
            System.out.println(warnMessage);
            _highThroughputCount = 0;
        }
    }
View Full Code Here

      // If this event is not between the start and end dates, then skip it.
      if (null != dateFilter && !dateFilter.containsLong(ts))
        return null;
      Category c = Logger.getLogger(clazz);
      Level l = Level.toLevel(level);
      LoggingEvent event = new LoggingEvent(clazz, c, ts, l, message, threadName, (ThrowableInformation) null, (String) null, (LocationInfo) null,
          (Map<?,?>) null);
      // Check the log level filter
      if (null != levelFilter && (levelFilter.decide(event) == Filter.DENY)) {
        return null;
      }
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.