Java Code Examples for org.apache.log4j.helpers.LogLog#warn()

The following examples show how to use org.apache.log4j.helpers.LogLog#warn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileWatchdog.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected
 void checkAndConfigure() {
   boolean fileExists;
   try {
     fileExists = file.exists();
   } catch(SecurityException  e) {
     LogLog.warn("Was not allowed to read check file existance, file:["+
	  filename+"].");
     interrupted = true; // there is no point in continuing
     return;
   }

   if(fileExists) {
     long l = file.lastModified(); // this can also throw a SecurityException
     if(l > lastModif) {           // however, if we reached this point this
lastModif = l;              // is very unlikely.
doOnChange();
warnedAlready = false;
     }
   } else {
     if(!warnedAlready) {
LogLog.debug("["+filename+"] does not exist.");
warnedAlready = true;
     }
   }
 }
 
Example 2
Source File: DailyMaxRollingFileAppender.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
void printPeriodicity(int type) {
   switch(type) {
   case 0:
      LogLog.debug("Appender [[+name+]] to be rolled every minute.");
      break;
   case 1:
      LogLog.debug("Appender [" + this.name + "] to be rolled on top of every hour.");
      break;
   case 2:
      LogLog.debug("Appender [" + this.name + "] to be rolled at midday and midnight.");
      break;
   case 3:
      LogLog.debug("Appender [" + this.name + "] to be rolled at midnight.");
      break;
   case 4:
      LogLog.debug("Appender [" + this.name + "] to be rolled at start of week.");
      break;
   case 5:
      LogLog.debug("Appender [" + this.name + "] to be rolled at start of every month.");
      break;
   default:
      LogLog.warn("Unknown periodicity for appender [[+name+]].");
   }

}
 
Example 3
Source File: MiscUtil.java    From ranger with Apache License 2.0 6 votes vote down vote up
public static void createParents(File file) {
	if (file != null) {
		String parentName = file.getParent();

		if (parentName != null) {
			File parentDir = new File(parentName);

			if (!parentDir.exists()) {
				if (!parentDir.mkdirs()) {
					LogLog.warn("createParents(): failed to create "
							+ parentDir.getAbsolutePath());
				}
			}
		}
	}
}
 
Example 4
Source File: DailyMaxRollingFileAppender.java    From sailfish-core with Apache License 2.0 6 votes vote down vote up
void printPeriodicity(int type) {
    switch (type) {
        case TOP_OF_MINUTE:
            LogLog.debug("Appender [" + name + "] to be rolled every minute.");
            break;
        case TOP_OF_HOUR:
            LogLog.debug("Appender [" + name + "] to be rolled on top of every hour.");
            break;
        case HALF_DAY:
            LogLog.debug("Appender [" + name + "] to be rolled at midday and midnight.");
            break;
        case TOP_OF_DAY:
            LogLog.debug("Appender [" + name + "] to be rolled at midnight.");
            break;
        case TOP_OF_WEEK:
            LogLog.debug("Appender [" + name + "] to be rolled at start of week.");
            break;
        case TOP_OF_MONTH:
            LogLog.debug("Appender [" + name + "] to be rolled at start of every month.");
            break;
        default:
            LogLog.warn("Unknown periodicity for appender [" + name + "].");
    }
}
 
Example 5
Source File: LoggingEvent.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private
 void readLevel(ObjectInputStream ois)
                     throws java.io.IOException, ClassNotFoundException {

   int p = ois.readInt();
   try {
     String className = (String) ois.readObject();
     if(className == null) {
level = Level.toLevel(p);
     } else {
Method m = (Method) methodCache.get(className);
if(m == null) {
  Class clazz = Loader.loadClass(className);
  // Note that we use Class.getDeclaredMethod instead of
  // Class.getMethod. This assumes that the Level subclass
  // implements the toLevel(int) method which is a
  // requirement. Actually, it does not make sense for Level
  // subclasses NOT to implement this method. Also note that
  // only Level can be subclassed and not Priority.
  m = clazz.getDeclaredMethod(TO_LEVEL, TO_LEVEL_PARAMS);
  methodCache.put(className, m);
}
PARAM_ARRAY[0] = new Integer(p);
level = (Level) m.invoke(null,  PARAM_ARRAY);
     }
   } catch(Exception e) {
LogLog.warn("Level deserialization failed, reverting to default.", e);
level = Level.toLevel(p);
   }
 }
 
Example 6
Source File: WriterAppender.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
    Set the {@link ErrorHandler} for this WriterAppender and also the
    underlying {@link QuietWriter} if any. */
 public synchronized void setErrorHandler(ErrorHandler eh) {
   if(eh == null) {
     LogLog.warn("You have tried to set a null error-handler.");
   } else {
     this.errorHandler = eh;
     if(this.qw != null) {
this.qw.setErrorHandler(eh);
     }
   }
 }
 
Example 7
Source File: DOMConfigurator.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
   * Delegates unrecognized content to created instance if
   * it supports UnrecognizedElementParser.
   * @since 1.2.15
   * @param instance instance, may be null.
   * @param element element, may not be null.
   * @param props properties
   * @throws IOException thrown if configuration of owner object
   * should be abandoned.
   */
private static void parseUnrecognizedElement(final Object instance,
                                      final Element element,
                                      final Properties props) throws Exception {
    boolean recognized = false;
    if (instance instanceof UnrecognizedElementHandler) {
        recognized = ((UnrecognizedElementHandler) instance).parseUnrecognizedElement(
                element, props);
    }
    if (!recognized) {
        LogLog.warn("Unrecognized element " + element.getNodeName());
    }
}
 
Example 8
Source File: HeisenbergServer.java    From heisenberg with Apache License 2.0 5 votes vote down vote up
public void beforeStart(String dateFormat) {
    String home = System.getProperty("hsb.home");
    if (home == null) {
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        LogLog.warn(sdf.format(new Date()) + " [hsb.home] is not set.");
    } else {
        Log4jInitializer.configureAndWatch(home + "/conf/log4j.xml", LOG_WATCH_DELAY);
    }
}
 
Example 9
Source File: Log4jAppender.java    From kite with Apache License 2.0 5 votes vote down vote up
protected void populateAvroHeaders(Map<String, String> hdrs, Schema schema,
    Object message) {
  if (avroSchemaUrl != null) {
    hdrs.put(Log4jAvroHeaders.AVRO_SCHEMA_URL.toString(), avroSchemaUrl);
    return;
  }
  LogLog.warn("The Dataset is using a schema literal rather than a URL and " +
      "will be attached to every message. See http://tinyurl.com/lkfuhnm");
  hdrs.put(Log4jAvroHeaders.AVRO_SCHEMA_LITERAL.toString(), schema.toString());
}
 
Example 10
Source File: MiscUtil.java    From ranger with Apache License 2.0 5 votes vote down vote up
private static void initLocalHost() {
	if ( logger.isDebugEnabled() ) {
		logger.debug("==> MiscUtil.initLocalHost()");
	}

	try {
		local_hostname = InetAddress.getLocalHost().getHostName();
	} catch (Throwable excp) {
		LogLog.warn("getHostname()", excp);
	}
	if ( logger.isDebugEnabled() ) {
		logger.debug("<== MiscUtil.initLocalHost()");
	}
}
 
Example 11
Source File: DailyMaxRollingFileAppender.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
void printPeriodicity(int type)
{
  switch(type) {
  case TOP_OF_MINUTE:
    LogLog.debug("Appender [[+name+]] to be rolled every minute.");
    break;
  case TOP_OF_HOUR:
    LogLog.debug("Appender ["+name
                 +"] to be rolled on top of every hour.");
    break;
  case HALF_DAY:
    LogLog.debug("Appender ["+name
                 +"] to be rolled at midday and midnight.");
    break;
  case TOP_OF_DAY:
    LogLog.debug("Appender ["+name
                 +"] to be rolled at midnight.");
    break;
  case TOP_OF_WEEK:
    LogLog.debug("Appender ["+name
                 +"] to be rolled at start of week.");
    break;
  case TOP_OF_MONTH:
    LogLog.debug("Appender ["+name
                 +"] to be rolled at start of every month.");
    break;
  default:
    LogLog.warn("Unknown periodicity for appender [[+name+]].");
  }
}
 
Example 12
Source File: MiscUtil.java    From ranger with Apache License 2.0 5 votes vote down vote up
public static String getFormattedTime(long time, String format) {
	String ret = null;

	try {
		SimpleDateFormat sdf = new SimpleDateFormat(format);

		ret = sdf.format(time);
	} catch (Exception excp) {
		LogLog.warn("SimpleDateFormat.format() failed: " + format, excp);
	}

	return ret;
}
 
Example 13
Source File: Hierarchy.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public
void emitNoAppenderWarning(Category cat) {
  // No appenders in hierarchy, warn user only once.
  if(!this.emittedNoAppenderWarning) {
    LogLog.warn("No appenders could be found for logger (" +
   cat.getName() + ").");
    LogLog.warn("Please initialize the log4j system properly.");
    this.emittedNoAppenderWarning = true;
  }
}
 
Example 14
Source File: RealTimeInitializer.java    From binlake with Apache License 2.0 5 votes vote down vote up
public static void configureAndWatch(long delay) {
    String home = System.getProperty("wave.home");

    if (home == null) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        LogLog.warn(sdf.format(new Date()) + " [wave.home] is not set.");
    } else {
        ConfigWatchDog watchDog = new ConfigWatchDog(home + File.separator + "/conf/realtime.properties");
        watchDog.setName("ConfigWatchDog");
        watchDog.setDelay(delay);
        watchDog.start();
    }
}
 
Example 15
Source File: DailyRollingFileAppender.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
void printPeriodicity(int type) {
  switch(type) {
  case TOP_OF_MINUTE:
    LogLog.debug("Appender ["+name+"] to be rolled every minute.");
    break;
  case TOP_OF_HOUR:
    LogLog.debug("Appender ["+name
   +"] to be rolled on top of every hour.");
    break;
  case HALF_DAY:
    LogLog.debug("Appender ["+name
   +"] to be rolled at midday and midnight.");
    break;
  case TOP_OF_DAY:
    LogLog.debug("Appender ["+name
   +"] to be rolled at midnight.");
    break;
  case TOP_OF_WEEK:
    LogLog.debug("Appender ["+name
   +"] to be rolled at start of week.");
    break;
  case TOP_OF_MONTH:
    LogLog.debug("Appender ["+name
   +"] to be rolled at start of every month.");
    break;
  default:
    LogLog.warn("Unknown periodicity for appender ["+name+"].");
  }
}
 
Example 16
Source File: Syslog4jAppender.java    From syslog4j with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setHeader(boolean header) {
	LogLog.warn("Syslog4jAppender ignores the \"Header\" parameter.");
}
 
Example 17
Source File: Log4jInitializer.java    From binlake with Apache License 2.0 4 votes vote down vote up
@Override
public void doOnChange() {
    new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
    LogLog.warn(new SimpleDateFormat(format).format(new Date()) + " [" + filename + "] load completed.");
}
 
Example 18
Source File: Log4jInitializer.java    From binlake with Apache License 2.0 4 votes vote down vote up
@Override
public void doOnChange() {
    new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
    LogLog.warn(new SimpleDateFormat(format).format(new Date()) + " [" + filename + "] load completed.");
}
 
Example 19
Source File: Syslog4jAppender.java    From syslog4j-graylog2 with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setHeader(boolean header) {
    LogLog.warn("Syslog4jAppender ignores the \"Header\" parameter.");
}
 
Example 20
Source File: DOMConfigurator.java    From cacheonix-core with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Substitutes property value for any references in expression.
 *
 * @param value value from configuration file, may contain
 *              literal text, property references or both
 * @param props properties.
 * @return evaluated expression, may still contain expressions
 *         if unable to expand.
 * @since 1.2.15
 */
public static String subst(final String value, final Properties props) {
    try {
        return OptionConverter.substVars(value, props);
    } catch (IllegalArgumentException e) {
        LogLog.warn("Could not perform variable substitution.", e);
        return value;
    }
}