I was reading in a log file like this that had no milliseconds:
[code=unix]
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 601650761 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 606887631 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 154517966 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 69220249 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 575941474 block size
[/code]
and I was outputting it to an excel file like this:
[code=excel]
Class Key Date Start Time End Time Length(ms) Block Size Class BC (TS) Product Class Key Class Type Outlier Host First Tick Open. Rot. Open. (ms) Class Thread #
606887631 Thu Dec 10 02:01:40 02:01:40 1 1 Unidentified perfgl15 20
533476053 Thu Dec 10 02:01:40 02:01:40 1 1 Unidentified perfgl15 28
530369105 Thu Dec 10 02:01:40 02:01:40 1 1 ARB BC20(1) ARB 530369105 3 perfgl15 24
69208240 Thu Dec 10 02:01:40 02:01:40 1 1 BLSW BC20(2) BLSW 69208240 3 perfgl15 1
575941474 Thu Dec 10 02:01:40 02:01:40 1 1 CBOU BC20(3) CBOU 575941474 3 perfgl15. 24
601650761 Thu Dec 10 02:01:40 02:01:40 1 1 DNY BC20(4) DNY 601650761 3 perfgl15. 28
[/code]
I was going thru the log file, using spaces as new fields and when i got to the time, i was reading in the time using the ':' as a deliminator and reading in the hrs, min and seconds as ints creating a Calendar variable after putting the individual fields into the GregorianCalend ar constructor like this:
[code=java]
if (input.startsWi th("QuoteBlockT iming")) {
boolean sessionSet = false;
StringTokenizer ST = new StringTokenizer (input, " \t");
while (ST.hasMoreToke ns()) {
String thisToke = ST.nextToken();
if (thisToke.equal sIgnoreCase("ms :")) {
returner.setM_d uration(new Integer(ST.next Token()).intVal ue());
ST.nextToken();
ST.nextToken();
String strMonth = ST.nextToken();
int intMonth = convertMonth(st rMonth);
Integer intMonthDay = new Integer(ST.next Token());
String strTime = ST.nextToken();
StringTokenizer ST2 = new StringTokenizer (strTime, ":");
Integer intHour = new Integer(ST2.nex tToken());
Integer intMinute = new Integer(ST2.nex tToken());
Integer intSecond = new Integer(ST2.nex tToken());
ST.nextToken();
Integer intYear = new Integer(ST.next Token());
Calendar cal = new GregorianCalend ar(intYear.intV alue(),intMonth ,
intMonthDay.int Value(),intHour .intValue(),int Minute.intValue (),
intSecond.intVa lue());
returner.setM_d ate(cal.getTime ());
[/code]
NOW, with milliseconds in the log file that looks like this:
[code=unix]
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.364 CST 2009 170.137.15.155 Class key = 601650761 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.364 CST 2009 170.137.15.155 Class key = 606887631 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.364 CST 2009 170.137.15.155 Class key = 154517966 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.366 CST 2009 170.137.15.155 Class key = 69220249 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.366 CST 2009 170.137.15.155 Class key = 575941474 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.367 CST 2009 170.137.15.155 Class key = 154517966 block size
[/code]
I need to put the milliseconds in the excel file also.
I was thinking about changing the line:
Integer intSecond = new Integer(ST2.nex tToken()); INTO
Double intSecond = new Double(ST2.nextToken( ));
but the GregorianCalend ar doesnt have a constructor that has a double argument that it accepts.
I was also thinking about using SimpleDateForma t but i was unsure of how to use that.
I really only need the hours:minutes:s econds.millisec onds in any kind of format
Please help.
Thanks
[code=unix]
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 601650761 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 606887631 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 154517966 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 69220249 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40 CST 2009 170.137.15.155 Class key = 575941474 block size
[/code]
and I was outputting it to an excel file like this:
[code=excel]
Class Key Date Start Time End Time Length(ms) Block Size Class BC (TS) Product Class Key Class Type Outlier Host First Tick Open. Rot. Open. (ms) Class Thread #
606887631 Thu Dec 10 02:01:40 02:01:40 1 1 Unidentified perfgl15 20
533476053 Thu Dec 10 02:01:40 02:01:40 1 1 Unidentified perfgl15 28
530369105 Thu Dec 10 02:01:40 02:01:40 1 1 ARB BC20(1) ARB 530369105 3 perfgl15 24
69208240 Thu Dec 10 02:01:40 02:01:40 1 1 BLSW BC20(2) BLSW 69208240 3 perfgl15 1
575941474 Thu Dec 10 02:01:40 02:01:40 1 1 CBOU BC20(3) CBOU 575941474 3 perfgl15. 24
601650761 Thu Dec 10 02:01:40 02:01:40 1 1 DNY BC20(4) DNY 601650761 3 perfgl15. 28
[/code]
I was going thru the log file, using spaces as new fields and when i got to the time, i was reading in the time using the ':' as a deliminator and reading in the hrs, min and seconds as ints creating a Calendar variable after putting the individual fields into the GregorianCalend ar constructor like this:
[code=java]
if (input.startsWi th("QuoteBlockT iming")) {
boolean sessionSet = false;
StringTokenizer ST = new StringTokenizer (input, " \t");
while (ST.hasMoreToke ns()) {
String thisToke = ST.nextToken();
if (thisToke.equal sIgnoreCase("ms :")) {
returner.setM_d uration(new Integer(ST.next Token()).intVal ue());
ST.nextToken();
ST.nextToken();
String strMonth = ST.nextToken();
int intMonth = convertMonth(st rMonth);
Integer intMonthDay = new Integer(ST.next Token());
String strTime = ST.nextToken();
StringTokenizer ST2 = new StringTokenizer (strTime, ":");
Integer intHour = new Integer(ST2.nex tToken());
Integer intMinute = new Integer(ST2.nex tToken());
Integer intSecond = new Integer(ST2.nex tToken());
ST.nextToken();
Integer intYear = new Integer(ST.next Token());
Calendar cal = new GregorianCalend ar(intYear.intV alue(),intMonth ,
intMonthDay.int Value(),intHour .intValue(),int Minute.intValue (),
intSecond.intVa lue());
returner.setM_d ate(cal.getTime ());
[/code]
NOW, with milliseconds in the log file that looks like this:
[code=unix]
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.364 CST 2009 170.137.15.155 Class key = 601650761 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.364 CST 2009 170.137.15.155 Class key = 606887631 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.364 CST 2009 170.137.15.155 Class key = 154517966 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.366 CST 2009 170.137.15.155 Class key = 69220249 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.366 CST 2009 170.137.15.155 Class key = 575941474 block size
QuoteBlockTimin g exceeded 1 ms: 1 --- Thu Dec 10 02:01:40.367 CST 2009 170.137.15.155 Class key = 154517966 block size
[/code]
I need to put the milliseconds in the excel file also.
I was thinking about changing the line:
Integer intSecond = new Integer(ST2.nex tToken()); INTO
Double intSecond = new Double(ST2.nextToken( ));
but the GregorianCalend ar doesnt have a constructor that has a double argument that it accepts.
I was also thinking about using SimpleDateForma t but i was unsure of how to use that.
I really only need the hours:minutes:s econds.millisec onds in any kind of format
Please help.
Thanks
Comment