Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 83861 Details for
Bug 203622
Apache Error log static parser does not use timezone specified by user in import dialog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Updated patch
patch_new_tptp.txt (text/plain), 7.93 KB, created by
Rohit Shetty
on 2007-11-27 08:47:22 EST
(
hide
)
Description:
Updated patch
Filename:
MIME Type:
Creator:
Rohit Shetty
Created:
2007-11-27 08:47:22 EST
Size:
7.93 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.logging.parsers >Index: src/org/eclipse/hyades/logging/parsers/AbstractErrorLogParser.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.hyades.logging.parsers/src/org/eclipse/hyades/logging/parsers/AbstractErrorLogParser.java,v >retrieving revision 1.12 >diff -u -r1.12 AbstractErrorLogParser.java >--- src/org/eclipse/hyades/logging/parsers/AbstractErrorLogParser.java 13 Jun 2007 04:47:14 -0000 1.12 >+++ src/org/eclipse/hyades/logging/parsers/AbstractErrorLogParser.java 27 Nov 2007 13:21:23 -0000 >@@ -27,6 +27,7 @@ > import java.util.Date; > import java.util.Hashtable; > import java.util.Locale; >+import java.util.TimeZone; > > import org.eclipse.hyades.logging.adapter.AdapterException; > import org.eclipse.hyades.logging.core.Guid; >@@ -43,6 +44,7 @@ > import org.eclipse.hyades.logging.events.cbe.util.EventHelpers; > import org.eclipse.hyades.logging.parsers.util.FilterExitHelper; > >+ > /** > * <code>AbstractErrorLogParser</code> is the abstract superclass for the <code>ApacheErrorLogParser</code>. > * <p> >@@ -115,7 +117,10 @@ > protected String sourceID = null; > > //Private variables: >- >+ /** >+ * Variable to hold the tempTimezone value >+ */ >+ private TimeZone timeZone = null; > /** > * bugzilla 139164 > * Count of records with identical time stamp values. >@@ -150,8 +155,60 @@ > public void setConfiguration(Hashtable table) throws LogParserException { > super.setConfiguration(table); > sensorFilterExitHelper.init(table , filterExitClassInstance) ; >+ String timezone = (String)table.get("timezone"); >+ inittimezone(timezone); > } >- >+ /* >+ * Intialize the timezone value to the system default timezone value >+ */ >+ private void inittimezone(String timezone) >+ { >+ if(timezone == null || timezone.equals("") ||timezone.equals("default")||timezone.equals("Default")) >+ { >+ timeZone = TimeZone.getDefault(); >+ } >+ else >+ { >+ StringBuffer tempTimezone = new StringBuffer(timezone); >+ tempTimezone.insert(3, ':'); >+ timezone = tempTimezone.toString(); >+ timeZone = TimeZone.getTimeZone("GMT"+timezone); >+ } >+ } >+ >+ public String getLogTimezone(Date creationDate) >+ { >+ //Generate the local UTC offset using the parsed date: >+ StringBuffer timezoneStr = new StringBuffer(); >+ Calendar localCalendar = Calendar.getInstance(); >+ localCalendar.setTimeZone(timeZone); >+ localCalendar.setTime(creationDate); >+ int utcOffset = ((localCalendar.get(Calendar.ZONE_OFFSET) + localCalendar.get(Calendar.DST_OFFSET)) / 60000); >+ //Add the sign of the UTC offset: >+ if (utcOffset < 0) >+ timezoneStr.append("-"); >+ else >+ timezoneStr.append("+"); >+ >+ utcOffset = Math.abs(utcOffset); >+ // Time Zone (+/-hh:mm) >+ >+ String numberHours = String.valueOf(utcOffset / 60); >+ >+ if (numberHours.length() == 1) >+ timezoneStr.append("0"); >+ >+ timezoneStr.append(numberHours); >+ timezoneStr.append(":"); >+ >+ String numberMinutes = String.valueOf(utcOffset % 60); >+ >+ if (numberMinutes.length() == 1) >+ timezoneStr.append("0"); >+ timezoneStr.append(numberMinutes); >+ >+ return timezoneStr.toString(); >+ } > /** > * Initialize this parser. > * @throws LogParserException if the parser cannot be initialized. >@@ -542,7 +599,7 @@ > //Parse the access log's time stamp excluding the time zone offset and square brackets (e.g. Thu Jan 16 19:06:54 2002) to a java.util.Date object: > // bugzilla 152372 - use the parser class SimpleDateFormat instance variable SDFparser for parsing the time stamp > Date creationDate = SDFparser.parse(curLine.substring((startIndex + 1), endIndex).trim(), new ParsePosition(0)); >- >+ > //If the access log's time stamp is valid (e.g. non-null java.util.Date object), convert to its XML dateTime format: > if (creationDate != null) { > >@@ -555,37 +612,7 @@ > > //Add the fractional second value (e.g. .000000): > currentTimeStamp.append(ParserConstants.SIX_ZERO); >- >- //Generate the local UTC offset using the parsed date: >- Calendar localCalendar = Calendar.getInstance(); >- localCalendar.setTime(creationDate); >- int utcOffset = ((localCalendar.get(Calendar.ZONE_OFFSET) + localCalendar.get(Calendar.DST_OFFSET)) / 60000); >- >- //Add the sign of the UTC offset: >- if (utcOffset < 0) >- currentTimeStamp.append("-"); >- else >- currentTimeStamp.append("+"); >- >- utcOffset = Math.abs(utcOffset); >- >- // Time Zone (+/-hh:mm) >- >- String numberHours = String.valueOf(utcOffset / 60); >- >- if (numberHours.length() == 1) >- currentTimeStamp.append("0"); >- >- currentTimeStamp.append(numberHours); >- currentTimeStamp.append(":"); >- >- String numberMinutes = String.valueOf(utcOffset % 60); >- >- if (numberMinutes.length() == 1) >- currentTimeStamp.append("0"); >- >- currentTimeStamp.append(numberMinutes); >- >+ currentTimeStamp.append(getLogTimezone(creationDate)); > return true; > } > } >Index: config/Apache/error/v1.3.26/static.adapter >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.hyades.logging.parsers/config/Apache/error/v1.3.26/static.adapter,v >retrieving revision 1.8 >diff -u -r1.8 static.adapter >--- config/Apache/error/v1.3.26/static.adapter 11 Mar 2007 06:35:08 -0000 1.8 >+++ config/Apache/error/v1.3.26/static.adapter 27 Nov 2007 13:21:21 -0000 >@@ -26,6 +26,7 @@ > <pu:Property propertyName="fileName" propertyValue=""/> > <pu:Property propertyName="parserClassName" propertyValue="org.eclipse.hyades.logging.parsers.ApacheErrorLogParser"/> > <pu:Property propertyName="version" propertyValue="default"/> >+ <pu:Property propertyName="timezone" propertyValue=""/> > <sensor:StaticParserSensor directory="" fileName="" parserClassName="org.eclipse.hyades.logging.parsers.ApacheErrorLogParser"/> > </cc:Sensor> > <cc:Outputter description="Static Parser Outputter" uniqueID="AdapterStaticParserOutputterID1" type="LoggingAgentOutputter"> >@@ -33,12 +34,12 @@ > <pu:Property propertyName="waitUntilLoggingTime" propertyValue="15000"/> > <op:LoggingAgentOutputterType agentName="Apache HTTP Server V1.3.20, V1.3.26, V2.0 error log files" waitUntilLoggingTime="15000"/> > </cc:Outputter> >- <cc:Outputter description="CBE File Outputter" uniqueID="ND2DA2480E9C11DB8000DF587DEE0353" disabled="true" type="SingleFileOutputter"> >+ <cc:Outputter description="CBE File Outputter" disabled="true" uniqueID="ND2DA2480E9C11DB8000DF587DEE0353" type="SingleFileOutputter"> > <pu:Property propertyName="directory" propertyValue="."/> > <pu:Property propertyName="fileName" propertyValue="example.out"/> > <op:SingleFileOutputterType directory="." fileName="example.out"/> > </cc:Outputter> >- <cc:Outputter description="CBE Logging Agent Outputter" uniqueID="NEF1E7880E9C11DB8000DF587DEE0353" disabled="true" type="LoggingAgentOutputter"> >+ <cc:Outputter description="CBE Logging Agent Outputter" disabled="true" uniqueID="NEF1E7880E9C11DB8000DF587DEE0353" type="LoggingAgentOutputter"> > <pu:Property propertyName="agentName" propertyValue="Default CBE Logging Agent"/> > <op:LoggingAgentOutputterType agentName="Default CBE Logging Agent"/> > </cc:Outputter>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 203622
:
83391
| 83861