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