Java Doc for Log.java in  » Installer » IzPack » com » izforge » izpack » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Installer » IzPack » com.izforge.izpack.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.izforge.izpack.util.Log

Log
public class Log implements LogError,LogWarning,LogMessage(Code)
This class handles informing the user about unusual events during the installation process and therefore about the possibility that the installation may not have succeeded at all or may have succeeded only partially. Because the logger represents a single resource it is implemented as singleton.

Usage

To add a message to the install log call one of the addMessage() methods, using the appropriate message index. If the message contains placeholders for variables, provide a String array that supplies the necessary variable text. Calling addMessage() will add an informative message to the log. These may be used to indicate actions taken by the installer throughout the progression of the install. Calling addWarning() will not only add the requested warning message to the log but also cause the user to be alerted about the fact that the install might not have succeeded completely. addError() goes one step further, by alerting the user that the installation has failed.

Adding Messages

Messages are divided into three categories:
  1. informative/general messages
  2. warning messages
  3. error messages
To add a message, define the text resource in the language packs. Then add a new constant for the message, along with a brief description of the purpose of the message. If the message contains place holders for variable text add an ordered list to the description, that lists all variables in proper order, so that other programmers have no difficulty to form a correct call for the message. The constants are defined in the individual interfaces LogMessage, LogWarning and LogError.

To derive a correct integer value for the message index add a new value to either MESSAGE_BASE, WARNING_BASE or ERROR_BASE, depending on the message category. Next, increment the MAX_ constant for the message category, to ensure that the add... methods actually allow the message to be added. The key for the text resource must be named either log.message_, log.warning_ or log.error_ in accordance with the chosen index base. In addition, the key must be appended by the message index (without the base, since this implementation will automatically subtract the base). Variable place holders must conform to the specification for java.text.MessageFormat.

Debug Messages

The output of debug messages is controlled through system properties. These properties may be set using the -D command line option. Please note, that the -D option is a command line switch for the VM, not for IzPack. In order for this to work, these options must be listed on the command line before IzPack!

Turning Debug On

In order to receive debug output, it is necessary to turn this feature on explicitely. This is done with the command line otprion:
 -DIzPack.debug=on
 

Selecting Debug Channels

Setting the list of specific debug channels to trace is accomplished with the following command line option:
 -DIzPack.debug.channel=<channelA,channelB,...>
 
The parameter is a comma separated list of one or more channel identifiers.

Dumping a List of Debug Channels

 -DIzPack.debug.dumpList=on
 
To turn debug messages on
version:
   0.0.1 / 11/20/06
author:
   Elmar Grom




Method Summary
public  voidaddCustomError(String template, String[] detail, Throwable exception)
     This method records an error message, using a custom text template.
public  voidaddCustomMessage(String template, String[] detail)
     This method records a general installation message, using a custom text template.
public  voidaddCustomWarning(String template, String[] detail, Throwable exception)
     This method records a warning message, using a custom text template.
public  voidaddDebugMessage(String template, String[] detail, String channel, Throwable exception)
     This method provides a channel for debugging messages in IzPack development.
public  voidaddError(int message, String[] detail, Throwable exception)
     This method records an error message to the list of messages
Parameters:
  message - the numeric identifier of the message to add, as defined incom.izforge.izpack.util.LogError LogError
Parameters:
  detail - a string array of variable fields that should be inserted into the messagetext.
public  voidaddMessage(int message, String[] detail)
    
public  voidaddWarning(int message, String[] detail, Throwable exception)
     This method records a warning message to the list of messages
Parameters:
  message - the numeric identifier of the message to add, as defined incom.izforge.izpack.util.LogWarning LogWarning
Parameters:
  detail - a string array of variable fields that should be inserted into the messagetext.
public  voiddumpRecordedChannels()
    
public  booleanerrorsRecorded()
     Reports if any errors have been recorded.
public static  LoggetInstance()
    
public  voidinformUser()
     Displays a dialog that informs the user about the fact that one or more unusual events have occurred during installation.
public  booleanmessagesRecorded()
     Reports if any messages have been recorded.
public  booleanwarningsRecorded()
     Reports if any warnings have been recorded.
public  voidwriteReport()
     Presents the user with a dialog to select a file and location for the installation report and writes a report contianing all messages to the user selected file.
public  voidwriteReport(String file)
     Writes a report contianing all messages to the indicated file.



Method Detail
addCustomError
public void addCustomError(String template, String[] detail, Throwable exception)(Code)
This method records an error message, using a custom text template. It allows cusom code to insert message text that is not defined in IzPack. IzPack internal code should use the parallel version based on the message index.
Parameters:
  template - the basic template for the message
Parameters:
  detail - a string array of variable fields that should be inserted into the messagetext. Each array element will be inserted into the text template, replacing a marker.
Parameters:
  exception - the exception associated with the event or null if there wasnone.
See Also:   java.text.MessageFormat.format(java.lang.Stringjava.lang.Object[])



addCustomMessage
public void addCustomMessage(String template, String[] detail)(Code)
This method records a general installation message, using a custom text template. It allows cusom code to insert message text that is not defined in IzPack. IzPack internal code should use the parallel version based on the message index.
Parameters:
  template - the basic template of the message
Parameters:
  detail - a string array of variable fields that should be inserted into the messagetext. Each array element will be inserted into the text template, replacing a marker.
See Also:   java.text.MessageFormat.format(java.lang.Stringjava.lang.Object[])



addCustomWarning
public void addCustomWarning(String template, String[] detail, Throwable exception)(Code)
This method records a warning message, using a custom text template. It allows cusom code to insert message text that is not defined in IzPack. IzPack internal code should use the parallel version based on the message index.
Parameters:
  template - the basic template for the message
Parameters:
  detail - a string array of variable fields that should be inserted into the messagetext. Each array element will be inserted into the text template, replacing a marker.
Parameters:
  exception - the exception associated with the event or null if there wasnone.
See Also:   java.text.MessageFormat.format(java.lang.Stringjava.lang.Object[])



addDebugMessage
public void addDebugMessage(String template, String[] detail, String channel, Throwable exception)(Code)
This method provides a channel for debugging messages in IzPack development. Note that debug messages are used solely for this purpose. Adding debug messages does not trigger user notification. If the user should be notified about a specific situation, please also call the appropriate (message, warning, error) method. Debug messages are not localized, please use English only.

In order to prevent flooding developers with messages that are generally of no interest, each message may be associated with a specific channel. A message is associated with a channel simply by providing a channel identifier as call parameter. There is no need for registering channels beforehand. If null or an empty string is used as channel identifier the message will be output, regardless of the channel filter applied. Please use this option sparingly, just for really impotant messages of general interest.

To receive output for select channels, start IzPack with the command line option -DIzPack.debug.channel=, followed by a comma separated list of channel identifiers.
Parameters:
  template - the basic template for the message
Parameters:
  detail - a string array of variable fields that should be inserted into the messagetext. Each array element will be inserted into the text template, replacing a marker.
Parameters:
  channel - the debug channel the message is associated with.
Parameters:
  exception - the exception associated with the event or null if there wasnone.




addError
public void addError(int message, String[] detail, Throwable exception)(Code)
This method records an error message to the list of messages
Parameters:
  message - the numeric identifier of the message to add, as defined incom.izforge.izpack.util.LogError LogError
Parameters:
  detail - a string array of variable fields that should be inserted into the messagetext. Each array element will be inserted into the text template, replacing a marker.
Parameters:
  exception - the exception associated with the event or null if there wasnone.
See Also:   java.text.MessageFormat.format(java.lang.Stringjava.lang.Object[])



addMessage
public void addMessage(int message, String[] detail)(Code)
This method records general installation message
Parameters:
  message - the numeric identifier of the message to add, as defined incom.izforge.izpack.util.LogMessage LogMessage
Parameters:
  detail - a string array of variable fields that should be inserted into the message text



addWarning
public void addWarning(int message, String[] detail, Throwable exception)(Code)
This method records a warning message to the list of messages
Parameters:
  message - the numeric identifier of the message to add, as defined incom.izforge.izpack.util.LogWarning LogWarning
Parameters:
  detail - a string array of variable fields that should be inserted into the messagetext. Each array element will be inserted into the text template, replacing a marker.
Parameters:
  exception - the exception associated with the event or null if there wasnone.
See Also:   java.text.MessageFormat.format(java.lang.Stringjava.lang.Object[])



dumpRecordedChannels
public void dumpRecordedChannels()(Code)
Dumps the list of debug channels to stdout that have recorded messages



errorsRecorded
public boolean errorsRecorded()(Code)
Reports if any errors have been recorded. true if any errors have been recorded



getInstance
public static Log getInstance()(Code)
Returns the only instance of Log the only instance of Log



informUser
public void informUser()(Code)
Displays a dialog that informs the user about the fact that one or more unusual events have occurred during installation. If nothing has been recorded, this method returns immediately.



messagesRecorded
public boolean messagesRecorded()(Code)
Reports if any messages have been recorded. true if any messages have been recorded



warningsRecorded
public boolean warningsRecorded()(Code)
Reports if any warnings have been recorded. true if any warnings have been recorded



writeReport
public void writeReport()(Code)
Presents the user with a dialog to select a file and location for the installation report and writes a report contianing all messages to the user selected file.



writeReport
public void writeReport(String file)(Code)
Writes a report contianing all messages to the indicated file.
Parameters:
  file - the fully qualifies name of the file to write to.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.