use of com.cosylab.logging.engine.log.LogEntry in project ACS by ACS-Community.
the class CacheUtils method fromCacheString.
/**
* Build a log out of its string representation
*
* @param str The string representing a log
* @return The log
*/
public static synchronized ILogEntry fromCacheString(String str) throws LogEngineException {
String[] strs = str.split(SEPARATOR);
long millis = 0;
try {
synchronized (dateFormat) {
millis = dateFormat.parse(strs[0]).getTime();
}
} catch (ParseException e) {
System.err.println("Error parsing the date: " + strs[0]);
throw new LogEngineException(e);
}
Integer entrytype = new Integer(strs[1]);
String srcObject = null;
if (strs.length > 2) {
srcObject = strs[2];
}
String fileNM = null;
if (strs.length > 3) {
fileNM = strs[3];
}
Integer line = null;
if (strs.length > 4 && strs[4].length() != 0) {
line = new Integer(strs[4]);
}
String routine = null;
if (strs.length > 5) {
routine = strs[5];
}
String host = null;
if (strs.length > 6) {
host = strs[6];
}
String process = null;
if (strs.length > 7) {
process = strs[7];
}
String context = null;
if (strs.length > 8) {
context = strs[8];
}
String thread = null;
if (strs.length > 9) {
thread = strs[9];
}
String logid = null;
if (strs.length > 10) {
logid = strs[10];
}
Integer priority = null;
if (strs.length > 11 && strs[11].length() > 0) {
priority = new Integer(strs[11]);
}
String uri = null;
if (strs.length > 12) {
uri = strs[12];
}
String stackid = null;
if (strs.length > 13) {
stackid = strs[13];
}
Integer stacklevel = null;
if (strs.length > 14 && strs[14].length() > 0) {
Integer.parseInt(strs[14]);
}
String logmessage = null;
if (strs.length > 15) {
logmessage = strs[15];
}
String audience = null;
if (strs.length > 16) {
audience = strs[16];
}
String array = null;
if (strs.length > 17) {
array = strs[17];
}
String antenna = null;
if (strs.length > 18) {
antenna = strs[18];
}
Vector<ILogEntry.AdditionalData> addDatas = null;
if (strs.length > LogField.values().length) {
addDatas = new Vector<ILogEntry.AdditionalData>();
for (int t = LogField.values().length; t < strs.length; t += 2) {
addDatas.add(new AdditionalData(strs[t], strs[t + 1]));
}
}
return new LogEntry(millis, entrytype, fileNM, line, routine, host, process, context, thread, logid, priority, uri, stackid, stacklevel, logmessage, srcObject, audience, array, antenna, addDatas);
}
use of com.cosylab.logging.engine.log.LogEntry in project ACS by ACS-Community.
the class FiltersVectorTest method setUp.
@Override
protected void setUp() throws Exception {
filters = new FiltersVector();
assertNotNull(filters);
log1 = new LogEntry(df.parseIsoTimestamp("2013-08-04T15:10:10.512").getTime(), LogTypeHelper.fromAcsCoreLevel(AcsLogLevelDefinition.INFO).ordinal(), "File.java", 100, "File#routine()", "alma.hq.eso.org", "javaProcess", "context", "java thread", "log id", 5, "URI", "stack id", 12, "A message for a log", "source object", "Audience", "array name", "antenna name", null);
log2 = new LogEntry(df.parseIsoTimestamp("2013-08-01T15:10:10.512").getTime(), LogTypeHelper.fromAcsCoreLevel(AcsLogLevelDefinition.TRACE).ordinal(), "File.java", 95, "File#routine()", "alma.hq.eso.org", "javaProcess", "context", "java thread", "log id", 5, "URI", "stack id", 12, "A message for log2", "source object", "Audience", "array name", "antenna name", null);
log3 = new LogEntry(df.parseIsoTimestamp("2013-08-10T15:10:10.512").getTime(), LogTypeHelper.fromAcsCoreLevel(AcsLogLevelDefinition.WARNING).ordinal(), "File.java", 130, "File#routine()", "alma.hq.eso.org", "javaProcess", "context", "java thread", "log id", 5, "URI", "stack id", 15, "A message for log2", "source object", "Audience", "array name", "antenna name", null);
super.setUp();
}
use of com.cosylab.logging.engine.log.LogEntry in project ACS by ACS-Community.
the class FilterTest method setUp.
@Override
protected void setUp() throws Exception {
log1 = new LogEntry(df.parseIsoTimestamp("2013-08-04T15:10:10.512").getTime(), LogTypeHelper.fromAcsCoreLevel(AcsLogLevelDefinition.INFO).ordinal(), "File.java", 100, "File#routine()", "alma.hq.eso.org", "javaProcess", "context", "java thread", "log id", 5, "URI", "stack id", 12, "A message for a log", "source object", "Audience", "array name", "antenna name", null);
log2 = new LogEntry(df.parseIsoTimestamp("2013-08-01T15:10:10.512").getTime(), LogTypeHelper.fromAcsCoreLevel(AcsLogLevelDefinition.TRACE).ordinal(), "File.java", 95, "File#routine()", "alma.hq.eso.org", "javaProcess", "context", "java thread", "log id", 5, "URI", "stack id", 12, "A message for a log", "source object", "Audience", "array name", "antenna name", null);
log3 = new LogEntry(df.parseIsoTimestamp("2013-08-10T15:10:10.512").getTime(), LogTypeHelper.fromAcsCoreLevel(AcsLogLevelDefinition.WARNING).ordinal(), "File.java", 130, "File#routine()", "alma.hq.eso.org", "javaProcess", "context", "java thread", "log id", 5, "URI", "stack id", 12, "A message for a log", "source object", "Audience", "array name", "antenna name", null);
super.setUp();
}
use of com.cosylab.logging.engine.log.LogEntry in project ACS by ACS-Community.
the class LogFileCache method fromCacheString.
private ILogEntry fromCacheString(String str) {
String[] strs = str.split(SEPARATOR);
Long millis = new Long(strs[0]);
Integer entrytype = new Integer(strs[1]);
String srcObject = null;
if (strs.length > 2) {
srcObject = strs[2];
}
String fileNM = null;
if (strs.length > 3) {
fileNM = strs[3];
}
Integer line = null;
if (strs.length > 4 && strs[4].length() != 0) {
line = new Integer(strs[4]);
}
String routine = null;
if (strs.length > 5) {
routine = strs[5];
}
String host = null;
if (strs.length > 6) {
host = strs[6];
}
String process = null;
if (strs.length > 7) {
process = strs[7];
}
String context = null;
if (strs.length > 8) {
context = strs[8];
}
String thread = null;
if (strs.length > 9) {
thread = strs[9];
}
String logid = null;
if (strs.length > 10) {
logid = strs[10];
}
Integer priority = null;
if (strs.length > 11 && strs[11].length() > 0) {
priority = new Integer(strs[11]);
}
String uri = null;
if (strs.length > 12) {
uri = strs[12];
}
String stackid = null;
if (strs.length > 13) {
stackid = strs[13];
}
Integer stacklevel = null;
if (strs.length > 14 && strs[14].length() > 0) {
stacklevel = Integer.parseInt(strs[14]);
}
String logmessage = null;
if (strs.length > 15) {
logmessage = strs[15];
}
String audience = null;
if (strs.length > 16) {
audience = strs[16];
}
String array = null;
if (strs.length > 17) {
array = strs[17];
}
String antenna = null;
if (strs.length > 18) {
antenna = strs[18];
}
Vector<ILogEntry.AdditionalData> addDatas = null;
if (strs.length > LogField.values().length) {
addDatas = new Vector<ILogEntry.AdditionalData>();
for (int t = LogField.values().length; t < strs.length; t += 2) {
addDatas.add(new AdditionalData(strs[t], strs[t + 1]));
}
}
return new LogEntry(millis, entrytype, fileNM, line, routine, host, process, context, thread, logid, priority, uri, stackid, stacklevel, logmessage, srcObject, audience, array, antenna, addDatas);
}
Aggregations