APISonar


org.apache.log4j.Logger.log

> org > apache > log4j > Logger > log
org APIs apache APIs log4j APIs Logger APIs log APIs

Example 1
private Logger              log;

	public void warn(String s) {
        log.log(callerFQCN, Level.WARN, s, null);
        warnCount++;
    }
Example 2
private Logger log;

  public void stop(String msg) {
    if (log.isEnabledFor(level)) {
      long t2 = System.currentTimeMillis();
      String duration = String.format("%.3f secs", (t2 - t1) / 1000.0);
      msg = msg.replace("%DURATION%", duration);
      log.log(level, "tid=" + Thread.currentThread().getId() + " oid=" + opid + "  " + msg);
    }
  }
Example 3
private static final Logger LOGGER = Logger.getLogger(GlobalConsole.class);

    public String println(int level, CharSequence charSequence) {
        String log = String.format(Locale.getDefault(), "%s/%s: %s",
                DATE_FORMAT.format(new Date()), getLevelChar(level), charSequence.toString());
        LOGGER.log(toLog4jLevel(level), log);
        android.util.Log.d(LOG_tAG, log);
        super.println(level, log);
        return log;
    }
Example 4
private Logger logger;

	public void log(int level, String application, String message) {
		logger.log(toLevel(level), merge(application, message));

	}
Example 5
public void record(Logger logger, Level p, String msg, Object... params) {
        if (logger.isEnabledFor(p)) {
            StringBuilder buf = new StringBuilder();
            toString(buf, msg, params);
            String entry = buf.toString();
            log(entry);
            logger.log(p, entry);
        } else {
            log(msg, params);
        }
    }
Example 6
private static final Logger log = Logger.getLogger(FileSystemMonitor.class);

  protected void logAsync(final Level level, final String msg, final Exception e) {
    Runnable r = new Runnable() {
      @Override
      public void run() {
        log.log(level, msg, e);
      }
    };
    
    new Thread(r).start();
  }
Example 7
private static final Logger LOG = Logger.getLogger(SqlIntegrationTestData.class);

    private void testDateTime() {

        LOG.log(Level.INFO, "Test: testDateTime()");
        LOG.log(Level.INFO, "sqlDataClass.getDateTime() as String:" + sqlDataClass.getDateTime());
        LOG.log(Level.INFO, "dateTime.toString() as String:" + Data.dateTime);

        LOG.log(Level.INFO, "sqlDataClass.getDateTime().getTime() as Long:" + sqlDataClass.getDateTime().millisSinceEpoch());
        LOG.log(Level.INFO, "dateTime.getTime() as Long:" + Data.dateTime.millisSinceEpoch());

        if (!Data.dateTime.equals(sqlDataClass.getDateTime())) {
            fail("DateTime " + Data.dateTime.toString() + " is not equal to " + sqlDataClass.getDateTime().toString());
        }
    }
Example 8
private Logger fixture;

  private void sendAndAssertFail() throws IOException {
    int level = 20000;
    String msg = "This is log message number" + String.valueOf(level);
    fixture.log(Level.toLevel(level), msg);

    Transaction transaction = ch.getTransaction();
    transaction.begin();
    Event event = ch.take();
    Assert.assertNull(event);

    transaction.commit();
    transaction.close();

  }
Example 9
private final static void enQueueLog(final Logger logger, final Level level, final String message, final Throwable thrown) {
        if (logRunnerThread == null || !logRunnerThread.isAlive()) {
            logger.log(level, message, thrown);
        } else {
            try {
                logQueue.put(new logEntry(logger, level, message, thrown));
            } catch (InterruptedException e) {
                logger.log(level, message, thrown);
            }
        }
    }
Example 10
public static final Logger s_logger = Logger.getLogger(DownloadListener.class.getName());

	public void log(String message, Level level) {
		if (template != null){
			s_logger.log(level, message + ", template=" + template.getName() + " at host " + sserver.getName());
		}else {
			s_logger.log(level, message + ", volume=" + volume.getName() + " at host " + sserver.getName());
		}
	}
Example 11
private Logger fixture;

  private void send(int numberOfMsgs) throws EventDeliveryException {
    for (int count = 0; count < numberOfMsgs; count++) {
      int level = count % 5;
      String msg = "This is log message number" + String.valueOf(count);
      fixture.log(Level.toLevel(level), msg);
    }
  }
Example 12
public static void setStatusAndLog(
      TaskAttemptContext context, Logger logger, Level level,
      String message) {
    try {
      setStatus(context, message);
    } catch (IOException e) {
      throw new IllegalStateException("setStatusAndLog: Got IOException", e);
    }
    if (logger.isEnabledFor(level)) {
      logger.log(level, message);
    }
  }
Example 13
private Logger fixture;

  public void testTimeout() throws Throwable {
    String propertiesFile = "flume-loadbalancinglog4jtest.properties";

    ch = new TestLog4jAppender.SlowMemoryChannel(2000);
    configureChannel();
    slowDown = true;
    startSources(propertiesFile, false, getFreePorts(3));
    int level = 20000;
    String msg = "This is log message number" + String.valueOf(level);
    try {
      fixture.log(Level.toLevel(level), msg);
    } catch (FlumeException ex) {
      throw ex.getCause();
    }
  }
Example 14
private static void logThreadGroup(int level, Throwable t, String msg, String module, 
            String callingClass) {
        String threadGroupId = currentThreadGroupId();
        if (hasActiveThreadLogger(threadGroupId)) {
            Logger grplogger = getLogger(threadGroupId + "." + module);
            if (SYS_DEBUG != null) {
                grplogger.setLevel(Level.DEBUG);
            }
            grplogger.log(callingClass, levelObjs[level], msg, t);
        }
    }
Example 15
private Logger pentahoLogger;

  public void eventAdded(KettleLoggingEvent event) {
    switch(event.getLevel()) {
      case ERROR:
        pentahoLogger.log(Level.ERROR, event.getMessage());
        break;
      case DEBUG:
      case ROWLEVEL:
        pentahoLogger.log(Level.DEBUG, event.getMessage());
        break;
      default:
        pentahoLogger.log(Level.INFO, event.getMessage());
        break;
    }
  }
Example 16
private static final Logger logger = Logger.getLogger(Filter.class);

  public boolean logConfgs(Priority level) {
    if (!super.logConfgs(level)) {
      return false;
    }
    logger.log(level, "input=" + input.getShortDescription());
    return true;
  }
Example 17
protected static void handlePackages() throws Exception {
		LogPackage pkg = packageQueue.take();
		if (pkg == null) {
			return;
		}
		// System.out.println(Thread.currentThread().getId()+": [LOGUTIL] process " + pkg);
		Logger logger = getLogger(pkg.loggerKey);
		if (!logger.isEnabledFor(pkg.level)) {
			return;
		}
		Object message = assemblerMessage(pkg);
		logger.log(pkg.level, message);
	}
Example 18
private static final Logger logger = Logger.getLogger(LoggingEventEmitter.class);

    public boolean emit(SystemMetric event) {
        try {
            if (event == null) {
                return false;
            }

            logger.log(logLevel, event.toString());
            return true;
        } catch (Exception e) {
            logger.error("Failed to emit event!",e);
        }
        return false;
    }
Example 19
private static final Logger MSG_VIEW_LOG = LogManager.getLogger(MSG_VIEW_TOKEN);

  public static void logMsgView(@NotNull Level level, String msg, @NotNull Class<?> sender, @Nullable Throwable throwable, @Nullable Project project) {
    MessageObject msgObject = new MessageObject(msg, null, sender.toString(), project);
    MSG_VIEW_LOG.log(level, msgObject, throwable);
  }
Example 20
final transient Logger logger;

    public void warn(String format, Object argA, Object argB) {
        if (logger.isEnabledFor(Level.WARN)) {
            FormattingTuple ft = MessageFormatter.format(format, argA, argB);
            logger.log(FQCN, Level.WARN, ft.getMessage(), ft.getThrowable());
        }
    }
Example 21
public void testSimple() {
    BasicConfigurator.configure(new NTEventLogAppender());
    Logger logger = Logger.getLogger("org.apache.log4j.nt.NTEventLogAppenderTest");
    int i  = 0;
    logger.debug( "Message " + i++);
    logger.info( "Message " + i++);
    logger.warn( "Message " + i++);
    logger.error( "Message " + i++);
    logger.log(Level.FATAL, "Message " + i++);
    logger.debug("Message " + i++,  new Exception("Just testing."));
  }