本文整理汇总了Java中org.apache.log4j.Logger.warn方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.warn方法的具体用法?Java Logger.warn怎么用?Java Logger.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.log4j.Logger
的用法示例。
在下文中一共展示了Logger.warn方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.log4j.Logger; //导入方法依赖的package包/类
public static void main(String args[])
{
Logger logger = Logger.getLogger(com.dytech.common.log4j.DailySizeRollingAppender.class);
do
{
logger.info("This is an info statement");
logger.warn("This is a warning");
logger.error("This is an error");
try
{
throw new Exception();
}
catch( Exception ex )
{
logger.fatal("This is fatal", ex);
}
}
while( true );
}
示例2: execute
import org.apache.log4j.Logger; //导入方法依赖的package包/类
@Override
public boolean execute(Context javascriptContext, Scriptable scope) throws EngineException {
if (isEnabled()) {
if (super.execute(javascriptContext, scope)) {
Logger log = engine ? Engine.logEngine : Engine.logContext;
if(level.equals(Level.WARN.toString()) && log.isEnabledFor(Level.WARN))
log.warn(getEvalString(javascriptContext, scope));
else if(level.equals(Level.INFO.toString()) && log.isInfoEnabled())
log.info(getEvalString(javascriptContext, scope));
else if(level.equals(Level.DEBUG.toString()) && log.isDebugEnabled())
log.debug(getEvalString(javascriptContext, scope));
else if(level.equals(Level.TRACE.toString()) && log.isTraceEnabled())
log.trace(getEvalString(javascriptContext, scope));
else if(level.equals(Level.ERROR.toString()) && log.isEnabledFor(Level.ERROR))
log.error(getEvalString(javascriptContext, scope));
return true;
}
}
return false;
}
示例3: main
import org.apache.log4j.Logger; //导入方法依赖的package包/类
public static void main(String args[])
{
Logger logger = Logger.getLogger(DailySizeRollingAppender.class);
do
{
logger.info("This is an info statement");
logger.warn("This is a warning");
logger.error("This is an error");
try
{
throw new Exception();
}
catch( Exception ex )
{
logger.fatal("This is fatal", ex);
}
}
while( true );
}
示例4: logOnServer
import org.apache.log4j.Logger; //导入方法依赖的package包/类
@Override
public String logOnServer(LogRecord record) {
try {
if (iDeobfuscator != null && record.getThrown() != null)
iDeobfuscator.deobfuscateStackTrace(record.getThrown(), getPermutationStrongName());
Logger logger = Logger.getLogger(record.getLoggerName());
if (record.getLevel().intValue() >= Level.SEVERE.intValue()) {
logger.error(record.getMessage(), record.getThrown());
} else if (record.getLevel().intValue() >= Level.WARNING.intValue()) {
logger.warn(record.getMessage(), record.getThrown());
} else if (record.getLevel().intValue() >= Level.INFO.intValue()) {
logger.info(record.getMessage(), record.getThrown());
} else if (record.getLevel().intValue() >= Level.FINE.intValue()) {
logger.debug(record.getMessage(), record.getThrown());
} else {
logger.trace(record.getMessage(), record.getThrown());
}
return null;
} catch (Exception e) {
sLogger.warn("Logging failed, reason: " + e.getMessage(), e);
}
return null;
}
示例5: composeGivenAllelesVariantContextFromRod
import org.apache.log4j.Logger; //导入方法依赖的package包/类
/**
* Composes the given allele variant-context providing information about the rods and reference location.
* @param tracker the meta data tracker.
* @param loc the query location.
* @param snpsOnly whether we only should consider SNP variation.
* @param logger where to output warnings.
* @param allelesBinding the target variation context binding containing the given alleles.
* @return never {@code null}
*/
public static VariantContext composeGivenAllelesVariantContextFromRod(final RefMetaDataTracker tracker,
final GenomeLoc loc,
final boolean snpsOnly,
final Logger logger,
final RodBinding<VariantContext> allelesBinding) {
if ( tracker == null ) throw new IllegalArgumentException("the tracker cannot be null");
if ( loc == null ) throw new IllegalArgumentException("the location cannot be null");
if ( allelesBinding == null ) throw new IllegalArgumentException("the alleles binding cannot be null");
VariantContext vc = null;
// search for usable record
for ( final VariantContext rodVc : tracker.getValues(allelesBinding, loc) ) {
if ( rodVc != null && ! rodVc.isFiltered() && (! snpsOnly || rodVc.isSNP() )) {
if ( vc == null )
vc = rodVc;
else
if (logger != null)
logger.warn("Multiple valid VCF records detected in the alleles input file at site "
+ loc + ", only considering the first record");
}
}
return vc;
}
示例6: stepExecute
import org.apache.log4j.Logger; //导入方法依赖的package包/类
@Override
protected boolean stepExecute(Context javascriptContext, Scriptable scope) throws EngineException {
if (isEnabled()) {
if (super.stepExecute(javascriptContext, scope)) {
Logger log = null;
if(logger.equals(Engine.logEngine.getName()))
log = Engine.logEngine;
else if(logger.equals(Engine.logContext.getName()))
log = Engine.logContext;
else if(logger.equals(Engine.logUser.getName()))
log = Engine.logUser;
else if(logger.equals(Engine.logAudit.getName()))
log = Engine.logAudit;
if(level.equals(Level.WARN.toString()) && log.isEnabledFor(Level.WARN))
log.warn(getEvalString(javascriptContext, scope));
else if(level.equals(Level.INFO.toString()) && log.isInfoEnabled())
log.info(getEvalString(javascriptContext, scope));
else if(level.equals(Level.DEBUG.toString()) && log.isDebugEnabled())
log.debug(getEvalString(javascriptContext, scope));
else if(level.equals(Level.TRACE.toString()) && log.isTraceEnabled())
log.trace(getEvalString(javascriptContext, scope));
else if(level.equals(Level.ERROR.toString()) && log.isEnabledFor(Level.ERROR))
log.error(getEvalString(javascriptContext, scope));
return true;
}
}
return false;
}
示例7: publish
import org.apache.log4j.Logger; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record)
{
Logger logger = Logger.getLogger(record.getLoggerName());
Level level = record.getLevel();
String message = record.getMessage();
try
{
message = MessageFormat.format(record.getMessage(), record.getParameters());
}
catch( IllegalArgumentException ignore )
{
// message will possibly have placeholder format for its
// parameters, such as
// "frog went {0} on a {1} day", "walking", "summer's",
// If format fails, send message in the raw.
}
if( record.getThrown() != null && !Check.isEmpty(record.getThrown().getLocalizedMessage()) )
{
message += '\n' + record.getThrown().getLocalizedMessage();
}
if( Level.SEVERE.equals(level) )
{
logger.fatal(message);
}
else if( Level.INFO.equals(level) )
{
logger.info(message);
}
else if( Level.WARNING.equals(level) )
{
logger.warn(message);
}
else if( Level.FINE.equals(level) || Level.FINER.equals(level) || Level.FINEST.equals(level) )
{
logger.trace(record);
}
}
示例8: warnUser
import org.apache.log4j.Logger; //导入方法依赖的package包/类
public static void warnUser(final Logger logger, final String msg) {
logger.warn(String.format("********************************************************************************"));
logger.warn(String.format("* WARNING:"));
logger.warn(String.format("*"));
prettyPrintWarningMessage(logger, msg);
logger.warn(String.format("********************************************************************************"));
}
示例9: prettyPrintWarningMessage
import org.apache.log4j.Logger; //导入方法依赖的package包/类
/**
* pretty print the warning message supplied
*
* @param logger logger for the message
* @param message the message
*/
private static void prettyPrintWarningMessage(Logger logger, String message) {
StringBuilder builder = new StringBuilder(message);
while (builder.length() > 70) {
int space = builder.lastIndexOf(" ", 70);
if (space <= 0) space = 70;
logger.warn(String.format("* %s", builder.substring(0, space)));
builder.delete(0, space + 1);
}
logger.warn(String.format("* %s", builder));
}
示例10: deadLineMissed
import org.apache.log4j.Logger; //导入方法依赖的package包/类
public void deadLineMissed(final Logger logger,
final DataReader reader,
final RequestedDeadlineMissedStatus requestedDeadlineMissedStatus) {
logger.warn("Missed " + requestedDeadlineMissedStatus.total_count_change + " deadlines. (" + requestedDeadlineMissedStatus.total_count + " total)");
}
示例11: sampleLost
import org.apache.log4j.Logger; //导入方法依赖的package包/类
public void sampleLost(final Logger logger,
final DataReader reader,
final SampleLostStatus sampleLostStatus) {
logger.warn(sampleLostStatus.total_count_change + " samples lost. (" + sampleLostStatus.total_count + " total)");
}
示例12: sampleRejected
import org.apache.log4j.Logger; //导入方法依赖的package包/类
public void sampleRejected(final Logger logger,
final DataReader reader,
final SampleRejectedStatus sampleRejectedStatus) {
logger.warn(sampleRejectedStatus.total_count_change + " samples rejected. (" + sampleRejectedStatus.total_count + " total)");
}
示例13: incompatibleQoS
import org.apache.log4j.Logger; //导入方法依赖的package包/类
public void incompatibleQoS(final Logger logger,
final DataReader reader,
final RequestedIncompatibleQosStatus requestedIncompatibleQosStatus) {
logger.warn(requestedIncompatibleQosStatus.total_count_change + " incompatible statuses. (" + requestedIncompatibleQosStatus.total_count + " total)");
}