buildframework/helium/doc/src/manual/antlogging.rst
author wbernard
Wed, 23 Dec 2009 19:29:07 +0200
changeset 179 d8ac696cc51f
permissions -rw-r--r--
helium_7.0-r14027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     1
Configuring Logging
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     2
=====================
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     3
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     4
Features:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     5
-----------------
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     6
* Will be initiated by the ANT Listener.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     7
* Logging will starts whenever build starts.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     8
* Helium logging framework offers you to configure the ant logging system for different stages of builds.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     9
* You can log the build process into seperate ant log files for each stage.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    10
* You can configure the log system to log different level of information (ex: debug, vebose, error).
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    11
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    12
The configuration:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    13
-----------------
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    14
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    15
We can configure the stages for which helium should log the build process.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    16
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    17
    * Stages
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    18
       
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    19
       * Stages are like preparation, compilation, postbuild etc.. for which we need to log build process. 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    20
       * Stages will have attributes for start and end targets.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    21
       * Stages will specify from which target we need log the build process and at which target we need to end logging build process.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    22
       
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    23
       .. csv-table:: 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    24
          :header: "Attribute", "Description", "Required"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    25
   
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    26
              "id", "Name of Stage (preparation, compilation)","Yes"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    27
              "starttarget", "Name of target to start logging.","Yes"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    28
              "endtarget", "Name of target to end logging.","Yes"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    29
      
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    30
    * Stagerecord 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    31
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    32
       * Will record/log the build process from start target to end target mentioned in the Stage type.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    33
       * Need provide attributes like output log file, loglevel.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    34
       * Supports passwordfilterset datatype. If we need to filter any passwords from specific stage log files.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    35
       
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    36
       .. csv-table:: 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    37
          :header: "Attribute", "Description", "Required"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    38
   
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    39
              "id", "ID for stage record entry.", "Yes"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    40
              "defaultoutput", "File to record main ant log file" "Yes (should not have stagerefid attribute if stage record has defaultoutput)"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    41
              "stagerefid", "Stage reference ID. Exactly as given in the Stage", "Yes"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    42
              "output", "File to record the build process.", "Yes"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    43
              "loglevel", "Loglevel to record type of information. ex: debug, info, vebose", "No, Default it will be info"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    44
              "append", "To append the logging into existing file.", "No, Default it will be false"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    45
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    46
Example:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    47
-----------------
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    48
.. code-block:: xml
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    49
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    50
        <hlm:stage id="preparation" starttarget="prep" endtarget="prep"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    51
        <hlm:stage id="compilation" starttarget="compile-main" endtarget="compile-main"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    52
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    53
        <hlm:stagerecord id="stage.default" defaultoutput="${build.log.dir}/${build.id}_main.ant.log" loglevel="info" append="true"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    54
        <hlm:stagerecord id="stage.preparation" stagerefid="preparation" output="${build.log.dir}/${build.id}_prep.ant.log" loglevel="info" append="true"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    55
        <hlm:stagerecord id="stage.compilation" stagerefid="compilation" output="${build.log.dir}/${build.id}_compile.ant.log" loglevel="info" append="true"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    56
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    57
logreplace Task (hlm:logreplace)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    58
-----------------
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    59
* LogReplace task will filter out the string from stage logging files.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    60
* If we need to filter out any user passwords and specific word which should n't be logged can passed to stage logging through this task.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    61
* Specified string will be filtered out from all the stages logging files.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    62
* It will not be filtered our by hlm:record task. To filter out the same need to passed to hlm:record task through recorderfilterset or recordfilter.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    63
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    64
Example:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    65
-----------------
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    66
This example will filter out unix password value from all the stage logging files.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    67
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    68
.. code-block:: xml
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    69
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    70
        <hlm:logreplace regexp="${unix.password}"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    71
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    72
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    73
Record Task (hlm:record)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    74
-----------------
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    75
* Behaviour is same ANT record task with some addon features.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    76
* Filerts the logging messages which are passed through the filters to hlm:record task.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    77
* Will stops the logging happening by listener for any stages and resumes to stage logging once hlm:record task  finishes.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    78
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    79
Example:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    80
-----------------
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    81
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    82
Below example
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    83
    * Will sets one recoderfilteset.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    84
    * Will record the given target/tasks into ${build.id}_stagetest.log file by filtering the regexp mentioned in the recorderfilterset and recordfilter.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    85
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    86
.. code-block:: xml
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    87
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    88
        <hlm:recordfilterset id="recordfilter.config">
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    89
            <hlm:recordfilter category="info" regexp="ERROR" />
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    90
        </hlm:recordfilterset>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    91
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    92
        <hlm:record name="${build.log.dir}/${build.id}_stagetest.log" action="start" loglevel="info">
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    93
            <hlm:recordfilterset refid="recordfilter.config"/>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    94
            <hlm:recordfilter category="unix" regexp="${unix.password}" />
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    95
        </hlm:record>
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    96
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    97
        ... Call tasks you would like to record the output  ...
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    98
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    99
        <hlm:record name="${build.log.dir}/${build.id}_stagetest.log" action="stop" append="true" />
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   100
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   101
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   102
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   103
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   104
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   105