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