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