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


Java LogLog.warn方法代码示例

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


在下文中一共展示了LogLog.warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: append

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
@Override
protected void append(LoggingEvent event)
{
    if (closed)
    {
        throw new IllegalStateException("appender is closed");
    }

    if (! ready)
    {
        initialize();
    }

    try
    {
        internalAppend(new LogMessage(event, getLayout()));
    }
    catch (Exception ex)
    {
        LogLog.warn("unable to append event", ex);
    }
}
 
开发者ID:kdgregory,项目名称:log4j-aws-appenders,代码行数:23,代码来源:AbstractAppender.java

示例2: internalAppend

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
private void internalAppend(LogMessage message)
{
    if (message == null)
        return;

    if (isMessageTooLarge(message))
    {
        LogLog.warn("attempted to append a message > AWS batch size; ignored");
        return;
    }

    rotateIfNeeded(System.currentTimeMillis());

    synchronized (messageQueueLock)
    {
        if (writer == null)
        {
            LogLog.warn("appender not properly configured: writer is null");
        }
        else
        {
            writer.addMessage(message);
            lastRotationCount++;
        }
    }
}
 
开发者ID:kdgregory,项目名称:log4j-aws-appenders,代码行数:27,代码来源:AbstractAppender.java

示例3: retrieveAWSAccountId

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
 *  Retrieves the current AWS account ID, using reflection so that we don't
 *  have a hard reference to the STS SDK JAR (ie, if you don't want account
 *  IDs you don't need the JAR).
 *  <p>
 *  Returns null if unable to determine the account ID for any reason.
 */
public static String retrieveAWSAccountId()
{
    try
    {
        Class<?> stsClientKlass = Class.forName("com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient");
        Class<?> requestKlass = Class.forName("com.amazonaws.services.securitytoken.model.GetCallerIdentityRequest");
        Class<?> responseKlass = Class.forName("com.amazonaws.services.securitytoken.model.GetCallerIdentityResult");
        Object stsClient = stsClientKlass.newInstance();
        Object request = requestKlass.newInstance();
        Method requestMethod = stsClientKlass.getMethod("getCallerIdentity", requestKlass);
        Object response = requestMethod.invoke(stsClient, request);
        Method getAccountMethod = responseKlass.getMethod("getAccount");
        return (String)getAccountMethod.invoke(response);
    }
    catch (Exception ex)
    {
        LogLog.warn("substitutions: unable to retrieve AWS account ID");
        return null;
    }
}
 
开发者ID:kdgregory,项目名称:log4j-aws-appenders,代码行数:28,代码来源:Utils.java

示例4: calculateRollOverTime

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
private void calculateRollOverTime()
{
	Calendar c = Calendar.getInstance();
	datedDir = new File(directory, DIRECTORY_NAME.format(c.getTime()));
	boolean madeDirs = datedDir.mkdirs();
	if( !(madeDirs || datedDir.exists()) )
	{
		LogLog.warn("Could not create/confirm directory " + datedDir.getAbsolutePath());
	}
	c.add(5, 1);
	c.set(10, 0);
	c.set(12, 0);
	c.set(13, 0);
	c.set(9, 0);
	nextRollTime = c.getTimeInMillis();
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:DailySizeRollingAppender.java

示例5: printPeriodicity

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
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+]].");
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:25,代码来源:DailyMaxRollingFileAppender.java

示例6: checkEntryConditions

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
   This method determines if there is a sense in attempting to append.

   <p>It checks whether there is a set output target and also if
   there is a set layout. If these checks fail, then the boolean
   value <code>false</code> is returned. */
protected
boolean checkEntryConditions() {
  if(this.closed) {
    LogLog.warn("Not allowed to write to a closed appender.");
    return false;
  }

  if(this.qw == null) {
    errorHandler.error("No output stream or file set for the appender named ["+
	name+"].");
    return false;
  }

  if(this.layout == null) {
    errorHandler.error("No layout set for the appender named ["+ name+"].");
    return false;
  }
  return true;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:26,代码来源:WriterAppender.java

示例7: formatMessage

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
private String formatMessage(String returnMessage, String key, String value) {
	if (value == null) {
		LogLog.warn("Setting NULL value for " + key);
		value = NULL;
	} 

	if (urlEncode) {
		try {
			value = URLEncoder.encode(value, encoding);
		} catch (UnsupportedEncodingException e) {
			LogLog.warn(e.toString());

		}
	}
	returnMessage = returnMessage.replaceAll("%"+key,value);
	return returnMessage;
}
 
开发者ID:seb0uil,项目名称:log4j-http-appender,代码行数:18,代码来源:HttpLayout.java

示例8: Integer

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
   Set a property on this PropertySetter's Object. If successful, this
   method will invoke a setter method on the underlying Object. The
   setter is the one for the specified property name and the value is
   determined partly from the setter argument type and partly from the
   value specified in the call to this method.
   
   <p>If the setter expects a String no conversion is necessary.
   If it expects an int, then an attempt is made to convert 'value'
   to an int using new Integer(value). If the setter expects a boolean,
   the conversion is by new Boolean(value).
   
   @param name    name of the property
   @param value   String value of the property
 */
public
void setProperty(String name, String value) {
  if (value == null) return;
  
  name = Introspector.decapitalize(name);
  PropertyDescriptor prop = getPropertyDescriptor(name);
  
  //LogLog.debug("---------Key: "+name+", type="+prop.getPropertyType());

  if (prop == null) {
    LogLog.warn("No such property [" + name + "] in "+
  obj.getClass().getName()+"." );
  } else {
    try {
      setProperty(prop, name, value);
    } catch (PropertySetterException ex) {
      LogLog.warn("Failed to set property [" + name +
                  "] to value \"" + value + "\". ", ex.rootCause);
    }
  }
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:37,代码来源:PropertySetter.java

示例9: printPeriodicity

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
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+"].");
    }
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:30,代码来源:OpenraspDailyRollingFileAppender.java

示例10: checkEntryConditions

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
protected boolean checkEntryConditions() {
    if (this.closed) {
        LogLog.warn("Not allowed to write to a closed appender.");
        return false;
    } else if (httpClient == null) {
        LogLog.warn("HttpClient need to be initialized.");
        return false;
    } else if ((url == null) || url.trim().isEmpty()) {
        LogLog.warn("url need to be initialized.");
        return false;
    }
    return true;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:14,代码来源:AlarmHttpAppender.java

示例11: populateAvroHeaders

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
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("Cannot find ID for schema. Adding header for schema, " +
      "which may be inefficient. Consider setting up an Avro Schema Cache.");
  hdrs.put(Log4jAvroHeaders.AVRO_SCHEMA_LITERAL.toString(), schema.toString());
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:11,代码来源:Log4jAppender.java

示例12: checkAndSetConfig

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
 * 进行kafka配置设置
 * @param key
 * @param value
 */
public void checkAndSetConfig(String key, String value) {
    if (!KafkaConfig.PRODUCER_CONFIG_KEYS.contains(key)) {
        // 当前kafka版本没有该配置项
        LogLog.warn("in this kafka version don't has this config: " + key);
    }
    this.config.put(key, value);
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:13,代码来源:KafkaAppender.java

示例13: printPeriodicity

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
 * Prints the periodicity.
 * 
 * @param type
 *            the type
 */
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 + "].");
	}
}
 
开发者ID:varra4u,项目名称:utils4j,代码行数:33,代码来源:BackupEnabledDailyRollingFileAppender.java

示例14: doConfigure

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
    Read configuration options from <code>properties</code>.

    See {@link #doConfigure(String, LoggerRepository)} for the expected format.
 */
 public
 void doConfigure(Properties properties, LoggerRepository hierarchy) {
   String value = properties.getProperty(LogLog.DEBUG_KEY);
   if(value == null) {
     value = properties.getProperty("log4j.configDebug");
     if(value != null)
LogLog.warn("[log4j.configDebug] is deprecated. Use [log4j.debug] instead.");
   }

   if(value != null) {
     LogLog.setInternalDebugging(OptionConverter.toBoolean(value, true));
   }

     //
     //   if log4j.reset=true then
     //        reset hierarchy
   String reset = properties.getProperty(RESET_KEY);
   if (reset != null && OptionConverter.toBoolean(reset, false)) {
         hierarchy.resetConfiguration();
   }

   String thresholdStr = OptionConverter.findAndSubst(THRESHOLD_PREFIX,
					       properties);
   if(thresholdStr != null) {
     hierarchy.setThreshold(OptionConverter.toLevel(thresholdStr,
					     (Level) Level.ALL));
     LogLog.debug("Hierarchy threshold set to ["+hierarchy.getThreshold()+"].");
   }

   configureRootCategory(properties, hierarchy);
   configureLoggerFactory(properties);
   parseCatsAndRenderers(properties, hierarchy);

   LogLog.debug("Finished configuring.");
   // We don't want to hold references to appenders preventing their
   // garbage collection.
   registry.clear();
 }
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:44,代码来源:PropertyConfigurator.java

示例15: setErrorHandler

import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/** 
    Set the {@link ErrorHandler} for this Appender.
    @since 0.9.0
*/
public
synchronized
void setErrorHandler(ErrorHandler eh) {
  if(eh == null) {
    // We do not throw exception here since the cause is probably a
    // bad config file.
    LogLog.warn("You have tried to set a null error-handler.");
  } else {
    this.errorHandler = eh;
  }
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:16,代码来源:AppenderSkeleton.java


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