Bug 5228 - Update logging to use Best practice guidelines
: Update logging to use Best practice guidelines
Status: RESOLVED FIXED
: Java WS Core
Campaign
: unspecified
: PC Windows XP
: P3 normal
: 4.1.2
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2007-04-19 07:49 by
Modified: 2007-09-10 18:15 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2007-04-19 07:49:17
Campaign: Java container Log Updates

Campaign Leader: Jennifer Schopf

People: Java container Developer TBD, Jen Schopf

Projects: CEDPS

Technologies: Java WS-Core

Objective:
Extend and clarify Java container logs according to CEDPS best practices guide.
This is a CEDPS deliverable.


Benefits:
Within CEDPS, a best practices for Logging guideline has been written
http://cedps.net/wiki/index.php/LoggingBestPractices
The goal of this work has been to define a uniform format and minimum set of
data that middleware logs contain in order to make the use of those logs for
troubleshooting and fault detection more straightforward, and will allow
performance analysis, security auditing, and incident tracing.


Implementation details/tasks:
1)    Fix timestamp formatting
2)    Verify start/end for each event
3)    Make sure event names match recommended event names, when possible
4)    Make sure error numbers include description of error


Deliverables:
Augmented code, to be part of 4.1.2
Documentation

Resources:
Developer: 1.5(?) days of coding
Developer: 0.5 days of testing, documentation
Jen/LBNL folks (Brian Tierney, Dan Gunter): couple hours of
explaining/coordinating
------- Comment #1 From 2007-05-03 09:03:53 -------
Timestamp format change has been committed to CoG log4j uitlity.
------- Comment #2 From 2007-05-03 09:59:49 -------
(In reply to comment #1)
> Timestamp format change has been committed to CoG log4j uitlity.

Can you be more specific?  What file (or files) have changed?  Thanks.
------- Comment #3 From 2007-05-03 10:07:40 -------
Changed:  src/org/globus/util/log4j/DatePatternConverter.java

Timestamp format is now set to YYYY-MM-DDTHH:MM:SS.SSSSSSZ (or) Z can be
replaced by +/-GMT. Example: 2007-05-01T16:34:47.292151-05:00

This has been committed only to CoG repository and not yet in Java WS Core. So
you should not see any changes in trunk GT components. If you use
org.globus.util.log4j.PatternLayout from JGlobus in some project for logging,
you will see the new timestamp format in your logs.
------- Comment #4 From 2007-05-04 15:59:41 -------
Created a branch: bug_5228_branch_1 for Java WS Components. Committed CoG jar
with new time format and a utility to format logging information as required by
the recommendation. 

http://viewcvs.globus.org/viewcvs.cgi/wsrf/java/core/source/src/org/globus/wsrf/utils/log4j/LogObject.java?revision=1.1.2.2&view=markup&pathrev=bug_5228_branch_1

Use the LogObject with appropriate parameters. Sample usage:

http://viewcvs.globus.org/viewcvs.cgi/wsrf/java/core/source/src/org/globus/wsrf/container/ServiceContainer.java?r1=1.70&r2=1.70.8.1&pathrev=bug_5228_branch_1


http://viewcvs.globus.org/viewcvs.cgi/wsrf/java/core/source/src/org/globus/wsrf/impl/security/authorization/AuthorizationHandler.java?revision=1.31.4.1&view=markup&pathrev=bug_5228_branch_1

Currently the formatting does not print line number, classname and method
information. this is required for developer level logs. But by default log4j
does not allow for per level pattern and this will require extending the
parser.
Also, core log statments need to be added. 

This work will take more than 1.5 days. Depending on whether the parser needs
to be extended it will be week's worth of work.
------- Comment #5 From 2007-05-16 19:47:08 -------
Added logging for all operation provider methods. 
------- Comment #6 From 2007-05-23 08:52:15 -------
Changed "date" to "ts".
------- Comment #7 From 2007-06-08 14:36:03 -------
Spruced up logging and sent out sample logs for comments. Based on feedback
following are required:

- ShutdownService and other core services need to provide logging
- Authn events need service name information
- Secure conversation requires start and end events

Also, separate tests for the LogObject classes need to be added
------- Comment #8 From 2007-08-29 12:50:15 -------
Added global id for use in logging. For every invocation that is made, a random
number is generated and stored as a MessageContext property.
(ServiceContainer.GLOBAL_LOG_ID). THe LogObject utility will automatically
append this to every logging statements, unless overridden by constructor.

Tests have been added for the utility code.

For now, the pattern class is not been extended. A sample converter with
classname/line number has been included and by default commented out.
------- Comment #9 From 2007-09-05 21:26:58 -------
To be compliant with CEDPs logging requirements and maintain the current
logging useful to developers, a separate logger for the system administrator
level logging was suggested. (Thanks to Martin Feller)

Such a support has been added in core. A class,
org.globus.wsrf.utils.log4j.SystemAdminLogFactory, has been added which has a
getLog() method. This will return a logger that appends "sysLogger" to the
name. 

private static Log logger =
           LogFactory.getLog(CounterService.class.getName());

private static Log sysLogger =
        SystemAdminLogFactory.getLog(CounterService.class.getName());

The usual logging with stack traces will remain as it is using the logger
object there. The sysLogger can be used for CEDPs compliant logging and the
LogObject utility should help there.

For example:

catch(RemoteException e)
        {
            sysLogger.error(new LogObject("org.samples.counter.create.end",
                                      "-1"));
            logger.error("Error creating counter", e);
            throw e;
        }

Any logging done using the system administrator logging will be written to
containerLog file in $GLOBUS_LOCATION. All other logging will remain as it is.
------- Comment #10 From 2007-09-10 18:15:46 -------
Ironed out issues with container logging and code has been merged with trunk.
Notes and sample log: http://www-unix.mcs.anl.gov/~ranantha/cedpsLogging/