[rfc][icedtea-web] refactored logging

Jiri Vanek jvanek at redhat.com
Mon Sep 23 08:40:26 PDT 2013

ok. Lifecycle II :)

Although I used hg mv and  --git , during development I screwed it somewhere so renaming is not 
visible in patches :(

So main changes are:
old classes were moved:
AppletLog.java got moved to ../utils/logging/FileLog.java
Log.java got moved to /utils/logging/LogConfig.java

The names are now much more corresponding with old behaviour. The new behaviour is same,  but the 
code was rewritten to be cleaner, work faster.. and .. well to work at all :) /me cursing asu :(

The new ItwLogger which was so discussed  was renamed to logging/OutputController.java. As it is 
better description of its pusposses.

Also important changes have appeared in OutputController:
The messages are not logged directly, but are queued, and separate thread is consuming those 
messages to individual enabled loggers. Please double check my synchronisation:(
By default file logger is off, std.streams is on, and system one is on (but system one is just dummy 
class). This change is already presented in ITW settings+messages+defaults (se DebuggingPaneL.java)
And logging can be on/off. Default is off. (see todo in LogConfig about DeploymentProperties loading)

The api is now log(string), log(exception), log(level, string), log(level, exception),
The no-level variants are logged only when debug is on.

Level is
         MESSAGE_ALL, // - stdout/log in all cases
         MESSAGE_DEBUG, // - stdout/log in verbose/debug mode
         WARNING_ALL, // - stdout+stderr/log in all cases (default for
         WARNING_DEBUG, // - stdou+stde/logrr in verbose/debug mode
         ERROR_ALL, // - stderr/log in all cases (default for
         ERROR_DEBUG, // - stderr/log in verbose/debug mode
         //ERROR_DEBUG is default for Throwable
         //MESSAGE_VERBOSE is defautrl  for String

Copy pasted  from class. Ugh. I think I left the comment here unintentionally.

Another important change is

JNLPruntime.exit(int) instead of System.exit(int). My intentions are two:
  - I would like to flush the logs by more natural way then ShutdownHook
  - in future I would liek to get rid of System.exit call here, and rather inherit exception and 
throw it, so ABRT will be able to detect it.

Also One think I had in mind was to have various default levels for various loggers.
Right now it is just debug on/of  shared for all loggers. What do you think?

Thank you for your deep review,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refactoredLoggingII-git-adaptedTests.diff
Type: text/x-patch
Size: 16430 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20130923/da6e4953/refactoredLoggingII-git-adaptedTests-0001.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refactoredLoggingII-git-newClasses.diff
Type: text/x-patch
Size: 36645 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20130923/da6e4953/refactoredLoggingII-git-newClasses-0001.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refactoredLoggingII-git-refactoring.diff
Type: text/x-patch
Size: 232924 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20130923/da6e4953/refactoredLoggingII-git-refactoring-0001.diff 

More information about the distro-pkg-dev mailing list