org.apache.log4j.Logger#debug ( )源码实例Demo

下面列出了org.apache.log4j.Logger#debug ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spacewalk   文件: ScapDownloadAction.java
@Override
protected StreamInfo getStreamInfo(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    Logger log = Logger.getLogger(ScapDownloadAction.class);
    RequestContext context = new RequestContext(request);
    User user = context.getCurrentUser();
    Long sid = context.getRequiredParam("sid");
    Server server = SystemManager.lookupByIdAndUser(sid, user);
    Long xid = context.getRequiredParam("xid");
    XccdfTestResult testResult = ScapFactory.lookupTestResultByIdAndSid(xid,
            server.getId());
    String filename = context.getRequiredParamAsString("name");
    ScapResultFile file = new ScapResultFile(testResult, filename);

    log.debug("Serving " + file);
    if (!file.getHTML()) {
        response.setHeader("Content-Disposition", "attachment; filename=" + filename);
    }
    return file;
}
 
源代码2 项目: serianalyzer   文件: SerianalyzerState.java
/**
 * @param method
 */
public void trackKnown ( MethodReference method ) {
    MethodReference cmp = method.comparable();

    Logger cl = Verbose.getPerMethodLogger(cmp);
    if ( cl.isDebugEnabled() ) {
        cl.debug(String.format("Handled call to %s", cmp)); //$NON-NLS-1$
    }

    Set<MethodReference> set = this.known.get(cmp);

    if ( set == null ) {
        set = new HashSet<>();
        this.known.put(cmp, set);
    }
    set.add(method);
}
 
源代码3 项目: uyuni   文件: ScapDownloadAction.java
@Override
protected StreamInfo getStreamInfo(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    Logger log = Logger.getLogger(ScapDownloadAction.class);
    RequestContext context = new RequestContext(request);
    User user = context.getCurrentUser();
    Long sid = context.getRequiredParam("sid");
    Server server = SystemManager.lookupByIdAndUser(sid, user);
    Long xid = context.getRequiredParam("xid");
    XccdfTestResult testResult = ScapFactory.lookupTestResultByIdAndSid(xid,
            server.getId());
    String filename = context.getRequiredParamAsString("name");
    ScapResultFile file = new ScapResultFile(testResult, filename);

    log.debug("Serving " + file);
    if (!file.getHTML()) {
        response.setHeader("Content-Disposition", "attachment; filename=" + filename);
    }
    return file;
}
 
源代码4 项目: datawave   文件: AbstractTableConfigHelper.java
/**
 * Set the locality group configuration for a table if necessary. If the specified configuration is not already included in the current group configuration,
 * then the new locality groups are merged with the current set and the locality groups are reset for the table.
 * 
 * @param tableName
 * @param newLocalityGroups
 * @param tops
 * @param log
 * @throws AccumuloException
 * @throws TableNotFoundException
 * @throws AccumuloSecurityException
 */
protected void setLocalityGroupConfigurationIfNecessary(String tableName, Map<String,Set<Text>> newLocalityGroups, TableOperations tops, Logger log)
                throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
    if (areLocalityGroupsConfigured(tableName, newLocalityGroups, tops)) {
        log.debug("Verified the following locality groups are configured for " + tableName + ": " + newLocalityGroups);
        return;
    }
    
    log.info("Creating the locality groups for " + tableName + ": " + newLocalityGroups);
    Map<String,Set<Text>> localityGroups = tops.getLocalityGroups(tableName);
    for (Map.Entry<String,Set<Text>> entry : newLocalityGroups.entrySet()) {
        Set<Text> families = localityGroups.get(entry.getKey());
        if (families == null) {
            families = new HashSet<>();
            localityGroups.put(entry.getKey(), families);
        }
        families.addAll(entry.getValue());
    }
    tops.setLocalityGroups(tableName, localityGroups);
    log.info("Reset the locality groups for " + tableName + " to " + localityGroups);
}
 
源代码5 项目: micro-integrator   文件: WebsocketLogUtil.java
/**
 * Print the headers associated with the initial Http Request.
 * The header details will be printed in the following format.
 * <p>
 * " >> Headers [channelContextId] [header name] : [header value]"
 *
 * @param log {@link Logger} object of the relevant class
 * @param msg {@link FullHttpRequest} response from the backend
 * @param ctx {@link ChannelHandlerContext} context
 */
public static void printHeaders(Logger log, FullHttpRequest msg, ChannelHandlerContext ctx) {
    //the direction is always inbound.
    String logStatement = getDirectionString(true) + "Headers " + resolveContextId(ctx) + " ";
    if (msg.headers() == null || msg.headers().isEmpty()) {
        log.debug(logStatement + "empty");
    } else {
        for (Map.Entry<String, String> entry : msg.headers().entries()) {
            log.debug(logStatement + entry.getKey() + ":" + entry.getValue());
        }
    }
}
 
源代码6 项目: lutece-core   文件: AppLogService.java
/**
 * Log a message object with the DEBUG level. It is logged in application.log
 *
 * @param strLogger
 *            The Logger name
 * @param objToLog
 *            the message object to log
 */
public static void debug( String strLogger, Object objToLog )
{
    Logger logger = Logger.getLogger( strLogger );

    if ( logger.isDebugEnabled( ) )
    {
        logger.debug( objToLog );
    }
}
 
源代码7 项目: swift-t   文件: LoopUnroller.java
@Override
public void optimize(Logger logger, Program prog) {
  for (Function f: prog.functions()) {
    logger.debug("looking to unroll loops in " + f.id());
    if (unrollLoops(logger, prog, f, f.mainBlock())) {
      // Unrolling can introduce duplicate vars
      UniqueVarNames.makeVarNamesUnique(f, prog.allGlobals());
      FlattenNested.flattenNestedBlocks(f.mainBlock());
    }
  }
}
 
源代码8 项目: spacewalk   文件: TaskHelper.java
/**
 * Sends mail and logs the mail message if debug logging is enabled
 * @param mail - message to be sent
 * @param logger - logger assigned to the caller
 */
public static void sendMail(Mail mail, Logger logger) {
    if (logger != null && logger.isDebugEnabled()) {
        logger.debug("Sending mail message:\n" + mail.toString());
    }
    mail.send();
}
 
源代码9 项目: openemm   文件: BIRTDataSet.java
/**
 * Method to update multiple data entries at once.<br />
 * Logs the statement and parameter in debug-level, executes update and logs error.<br />
 * Watch out: Oracle returns value -2 (= Statement.SUCCESS_NO_INFO) per line for success with no "lines touched" info<br />
 * 
 * @param childClassLogger
 * @param statement
 * @param values
 * @return
 * @throws Exception
 */
public int[] batchupdateEmbedded(Logger childClassLogger, String statement, List<Object[]> values) throws Exception {
	try {
		logSqlStatement(childClassLogger, "EMBEDDED: " + statement, "BatchUpdateParameterList(Size: " + values.size() + ")");
		int[] touchedLines = getEmbeddedJdbcTemplate().batchUpdate(statement, values);
		if (childClassLogger.isDebugEnabled()) {
			childClassLogger.debug("lines changed by update: " + Arrays.toString(touchedLines));
		}
		return touchedLines;
	} catch (RuntimeException e) {
		logSqlError(e, childClassLogger, "EMBEDDED: " + statement, "BatchUpdateParameterList(Size: " + values.size() + ")");
		throw e;
	}
}
 
源代码10 项目: swift-k   文件: Loader.java
public static void debugText(String name, String source) {
    Logger textLogger = Logger.getLogger("swift.textfiles");
    if (textLogger.isDebugEnabled()) {
        textLogger.debug("BEGIN " + name + ":\n" + source + "\n");
        textLogger.debug("END " + name + ":");
    }
}
 
源代码11 项目: cacheonix-core   文件: LevelMatchFilterTestCase.java
void common(String msg) {
  Logger logger = Logger.getLogger("test");
  logger.trace(msg);
  logger.debug(msg);
  logger.info(msg);
  logger.warn(msg);
  logger.error(msg);
  logger.fatal(msg);
}
 
源代码12 项目: Knowage-Server   文件: DataMiningPythonExecutor.java
@Override
public DataMiningResult executeScript(Logger logger, DataMiningResult result, HashMap params, DataMiningCommand command, Output output,
		IEngUserProfile userProfile, Boolean rerun, String documentLabel) throws Exception {

	// evaluates script code
	scriptExecutor.evalScript(command, rerun);
	logger.debug("Evaluated script");
	// create output
	UserProfile profile = (UserProfile) userProfile;
	result = outputExecutor.evalOutput(output, scriptExecutor, documentLabel, (String) profile.getUserId());
	logger.debug("Got result");
	return result;

}
 
源代码13 项目: swift-k   文件: Loader.java
/**
      Enter the text content of given files into the log
      @param name A token printed in the log
      @param file The text file to copy into the log
      @throws IOException 
    */
   public static void debugText(String name, File file) {
   	Logger textLogger = Logger.getLogger("swift.textfiles");
   	try {
   		if (textLogger.isDebugEnabled()) {
   			String text = TextFileLoader.loadFromFile(file);
   			textLogger.debug("BEGIN " + name + ":\n" + text + "\n");
   			textLogger.debug("END " + name + ":");
   		}
   	}
   	catch (IOException e) { 
   		logger.warn("Could not open: " + file);
   	}
}
 
源代码14 项目: Knowage-Server   文件: DataMiningRExecutor.java
@Override
public DataMiningResult setExecEnvironment(Logger logger, DataMiningResult result, HashMap params, DataMiningCommand command, IEngUserProfile userProfile,
		Boolean rerun, String documentLabel) throws Exception {

	logger.debug("IN");
	setupEnvonment(userProfile);
	logger.debug("Set up environment");
	// datasets preparation
	String error = datasetsExecutor.evalDatasetsNeeded(params);
	if (error.length() > 0) {
		result = new DataMiningResult();
		result.setError(error);
		return result;
	}
	logger.debug("Loaded datasets");

	// Files input preparation
	error = fileExecutor.evalFilesNeeded(params);
	if (error.length() > 0) {
		result = new DataMiningResult();
		result.setError(error);
		return result;
	}

	return result;

}
 
源代码15 项目: zxl   文件: LogUtil.java
public static void debug(Logger logger, String message, Exception exception) {
	if (logger.isDebugEnabled()) {
		if (exception != null) {
			logger.debug(message, exception);
		} else {
			logger.debug(message);
		}
	}
}
 
源代码16 项目: oneops   文件: Util.java
/**
 * Log map double.
 *
 * @param name the name
 * @param h the h
 * @param logger the logger
 */
public static void logMapDouble(String name, Map<String, Double> h, Logger logger) {
	StringBuilder sber = new StringBuilder("{");
	for (String k : h.keySet()) {
		sber.append(k).append(":").append(h.get(k)).append(",");
	}
	sber.append("}");
	logger.debug(name + " : " + sber);

}
 
源代码17 项目: sldeditor   文件: FilterManager.java
/** Initialise. */
private void initialise() {
    List<FilterConfigInterface> filterConfigList = getFilterConfigList();

    List<FilterName> filterNameList = new ArrayList<>();

    for (FilterConfigInterface filterConfig : filterConfigList) {
        filterNameList.add(filterConfig.getFilterConfiguration());
        String key = filterConfig.getFilterConfiguration().getFilterName();
        filterMap.put(key, filterConfig);
        filterTypeMap.put(filterConfig.getFilterClass(), filterConfig);
    }

    List<Class<?>> classList = new ArrayList<>();

    Logger logger = Logger.getLogger(getClass());

    for (FilterName function : filterNameList) {
        logger.debug(function.getFilterName());

        functionNameMap.put(function.getFilterName(), function);

        for (FilterNameParameter parameter : function.getParameterList()) {
            if (!classList.contains(parameter.getDataType())) {
                classList.add(parameter.getDataType());
            }
            logger.debug("\t" + parameter.getName() + "\t" + parameter.getDataType().getName());
        }

        if (!classList.contains(function.getReturnType())) {
            classList.add(function.getReturnType());
        }
        logger.debug("\tRet : " + function.getReturnType().getName());
    }

    logger.debug("\nClasses");
    for (Class<?> className : classList) {
        logger.debug(className.getName());
    }

    // CHECKSTYLE:OFF
    Class<?>[] allowedNumberTypes = {
        Number.class, Double.class, Float.class, Integer.class, Long.class
    };
    Class<?>[] allowedDoubleTypes = {
        Number.class, Double.class, Float.class, Integer.class, Long.class
    };
    Class<?>[] allowedFloatTypes = {
        Number.class, Double.class, Float.class, Integer.class, Long.class
    };
    Class<?>[] allowedIntegerTypes = {
        Number.class, Double.class, Float.class, Integer.class, Long.class
    };
    Class<?>[] allowedLongTypes = {
        Number.class, Double.class, Float.class, Integer.class, Long.class
    };
    Class<?>[] allowedBooleanTypes = {Boolean.class};
    Class<?>[] allowedStringTypes = {String.class};
    Class<?>[] allowedGeometryTypes = {
        Geometry.class, LineString.class, Point.class, MultiPoint.class, LinearRing.class
    };
    Class<?>[] allowedDateTypes = {Date.class};
    Class<?>[] allowedClassifierTypes = {RangedClassifier.class, Classifier.class};
    Class<?>[] allowedUnitTypes = {Unit.class};
    Class<?>[] allowedComparableTypes = {
        Number.class,
        Double.class,
        Float.class,
        Integer.class,
        Long.class,
        Date.class,
        String.class,
        Boolean.class
    };
    // CHECKSTYLE:ON

    populateAllowedTypes(Number.class, allowedNumberTypes);
    populateAllowedTypes(Double.class, allowedDoubleTypes);
    populateAllowedTypes(Float.class, allowedFloatTypes);
    populateAllowedTypes(Integer.class, allowedIntegerTypes);
    populateAllowedTypes(Long.class, allowedLongTypes);
    populateAllowedTypes(Boolean.class, allowedBooleanTypes);
    populateAllowedTypes(String.class, allowedStringTypes);
    populateAllowedTypes(Geometry.class, allowedGeometryTypes);
    populateAllowedTypes(org.opengis.geometry.Geometry.class, allowedGeometryTypes);
    populateAllowedTypes(Date.class, allowedDateTypes);
    populateAllowedTypes(Classifier.class, allowedClassifierTypes);
    populateAllowedTypes(Unit.class, allowedUnitTypes);
    populateAllowedTypes(Comparable.class, allowedComparableTypes);
}
 
源代码18 项目: openemm   文件: DebugLog4JTag.java
@Override
protected final void logMessage(final Logger logger, final String msg, final Throwable t) {
	logger.debug(msg, t);
}
 
源代码19 项目: CloverETL-Engine   文件: TypedProperties.java
public void print(Logger logger, String message) {
       logger.debug(message + " " + this);
}
 
源代码20 项目: serianalyzer   文件: Serianalyzer.java
/**
 * @param method
 * @throws SerianalyzerException
 */
private void doCheckMethod ( MethodReference methodReference ) throws SerianalyzerException {

    Logger cl = Verbose.getPerMethodLogger(methodReference);

    if ( cl.isTraceEnabled() ) {
        cl.trace(String.format("Checking reference %s", methodReference)); //$NON-NLS-1$
    }

    long currentTimeMillis = System.currentTimeMillis();
    if ( currentTimeMillis - this.lastOutput > OUTPUT_EVERY ) {
        log.info("Currently to check " + this.getState().getToCheck().size() + " known " + this.getState().countAllKnown()); //$NON-NLS-1$ //$NON-NLS-2$
        log.info("Sample " + methodReference); //$NON-NLS-1$
        this.lastOutput = currentTimeMillis;
    }

    try ( InputStream data = this.input.getClassData(methodReference.getTypeNameString()) ) {
        if ( data == null ) {
            cl.error("No class data for " + methodReference.getTypeNameString()); //$NON-NLS-1$
            return;
        }

        if ( this.input.getConfig().isWhitelisted(methodReference) ) {
            if ( cl.isDebugEnabled() ) {
                cl.debug("Is whitelisted " + methodReference); //$NON-NLS-1$
            }
            return;
        }

        short flags = this.getIndex().getClassByName(methodReference.getTypeName()).flags();
        if ( !methodReference.isStatic() && ( Modifier.isInterface(flags) || Modifier.isAbstract(flags) ) ) {
            log.debug("Resolved an interface/abstract class in non static call " + methodReference); //$NON-NLS-1$
        }

        ClassReader cr = new ClassReader(data);
        SerianalyzerClassMethodVisitor visitor = new SerianalyzerClassMethodVisitor(this, methodReference, methodReference.getTypeName());
        cr.accept(visitor, 0);

        Set<MethodReference> callers = this.state.getMethodCallers().get(methodReference.comparable());

        if ( !visitor.isFound() ) {
            if ( cl.isTraceEnabled() ) {
                cl.trace("Not found " + methodReference); //$NON-NLS-1$
            }

            boolean found = doCheckInSuperClasses(methodReference, cl, callers);

            if ( !found ) {
                cl.debug("Method not found in superclasses " + methodReference); //$NON-NLS-1$

                found = doCheckInInterfaces(methodReference, cl, callers);

                if ( !found && !methodReference.getTypeNameString().startsWith("java.lang.invoke.") ) { //$NON-NLS-1$
                    MethodReference cmp = methodReference.comparable();
                    if ( this.notFound.add(cmp) ) {
                        cl.warn("Method not found " + methodReference); //$NON-NLS-1$
                    }
                }
            }

        }
    }
    catch ( IOException e ) {
        log.error("Failed to read class " + methodReference.getTypeName()); //$NON-NLS-1$
    }
}