public void setSourceLineNumber(final int sourceLineNumber) { resolved = true; super.setSourceLineNumber(sourceLineNumber); }
private void resolve() { resolved = true; final String sourceMethodName = orig.getSourceMethodName(); final String sourceClassName = orig.getSourceClassName(); super.setSourceMethodName(sourceMethodName); super.setSourceClassName(sourceClassName); final StackTraceElement[] st = new Throwable().getStackTrace(); for (StackTraceElement element : st) { if (element.getClassName().equals(sourceClassName) && element.getMethodName().equals(sourceMethodName)) { super.setSourceLineNumber(element.getLineNumber()); super.setSourceFileName(element.getFileName()); return; } } }
logRecord.setSourceMethodName(element.getMethodName()); logRecord.setSourceFileName(element.getFileName()); logRecord.setSourceLineNumber(element.getLineNumber()); if (JBOSS_MODULES) { calculateModule(logRecord, clazz);
void setUnknownCaller() { setSourceClassName(null); setSourceMethodName(null); setSourceLineNumber(-1); setSourceFileName(null); setSourceModuleName(null); setSourceModuleVersion(null); }
logRecord.setSourceFileName(info.getFileName()); try { logRecord.setSourceLineNumber(Integer.parseInt(info.getLineNumber(), 10)); } catch (NumberFormatException ignored) { logRecord.setSourceLineNumber(-1);
/** * Get a log record for a log4j event. If the event wraps a log record, that record is returned; otherwise * a new record is built up from the event. * * @param event the event * @return the log record */ public static ExtLogRecord getLogRecordFor(LoggingEvent event) { final ExtLogRecord rec = (ExtLogRecord)event.getProperties().get("org.jboss.logmanager.record"); if (rec != null) { return rec; } final ExtLogRecord newRecord = new ExtLogRecord(LevelMapping.getLevelFor(event.getLevel()), (String) event.getMessage(), event.getFQNOfLoggerClass()); newRecord.setLoggerName(event.getLoggerName()); newRecord.setMillis(event.getTimeStamp()); newRecord.setThreadName(event.getThreadName()); newRecord.setThrown(event.getThrowableInformation().getThrowable()); newRecord.setNdc(event.getNDC()); if (event.locationInformationExists()) { final LocationInfo locationInfo = event.getLocationInformation(); newRecord.setSourceClassName(locationInfo.getClassName()); newRecord.setSourceFileName(locationInfo.getFileName()); newRecord.setSourceLineNumber(Integer.parseInt(locationInfo.getLineNumber())); newRecord.setSourceMethodName(locationInfo.getMethodName()); } return newRecord; } }