5.6 Centralised Logging During Debugging
JeeWiz, by default, generates a centralised log file when detailed debugging generation level is used.
There are two benefits of the centralised log file.
First, there is a coordinated single file, that gives a cross-PU view of the complete application.
Second, it is more convenient to find all the appropriate logs
This is intended for early-stage debugging: when detailed debugging is enabled,
you automatically get logs of all method call entry/exits, method parameters and so on.
This is not used for less verbose logging levels; in that case, the normal
Java JDK4-style logging is used.
(And centralised logging definitely should not be used for production as it will be a very large overhead.
5.6.1 How to Enable Centralised Logging
|
To enable the detailed debugging level, in Eclipse
- use Window Preferences / GigaSystemBuilder
- GigaSystemBuilder main selection item, Generate-Time Settings sub-menu
- Choose "Detailed Debug" from the "Generate Log Level" option.
If you run Ant manually, specify "-Dpass=-DgenerateLogLevel=9".
You can use 'pass2', 'pass3' etc. as an alternative if you are passing multiple options into Ant.
There is another gate to the centralised log file being generated, which is the "useGsbLoggerService" flag.
This is defined to be true in the template-area file resources/giga-spaces/control/system.properties.
If you want to disable this feature permanently, define a Custom Template Directory
in the Window Preferences / GigaSystemBuilder, create a system.properties file in that directory,
and enter the line "useGsbLoggerService=${booleanFalse}".
5.6.2 Location and Contents
|
Out of the box, the log file is located in the main project directory -
as a peer of the '.osm' model.
It will have a name like log_YYYYMMDD_hhmmss.txt, e.g. C:\log_20090222_204603.txt on Windows.
The timestamp implied by the name of the file is the time of creation on the Utility PU.
This means that you automatically have an audit trail of different runs of the application.
The log is created by a specially generated service on the Utility PU, the GsbLoggerService.
It is reached from each PU using the GsbLoggerClient. This is for information only: you do not have to program this.
You can change both the location of the directory and the file name, using two different techniques.
5.6.3 Wrinkles
|
The centralised logging does not start immediately: each PU has to go through its internal initialisation
and then locate the various services.
In a detailed logging environment, where you are probably initialising services and event handlers of your own design,
the 'pre-centralised' logging information is important.
So, until the most basic initialisation is done, GigaSystemBuilder logs to System.out.
This does not go to the Java 4 logger: it goes straight to the console of the PU's Java VM.
Another wrinkle is that, if anything happens to the connection to the centralised logger service,
then the client retries once and, if that fails, switches to back - permanently - to using System.out for all logging.
- does not happen immediately
- reverts to system-out logging
- format of the line
- is ordering guaranteed - utilityPU is done locally and so may happen quicker than
It's slow than normal, file-based logging, so shouldn't be used for production, but useful during initial debugging
Not getting centralised logging from the Client
- why is that
|