~ubuntu-branches/ubuntu/karmic/libvirt/karmic-proposed

« back to all changes in this revision

Viewing changes to docs/logging.html

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2009-02-11 01:01:42 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090211010142-8zrm7z1u6ryfhkiq
Tags: 0.6.0-1ubuntu1
* Merge with Debian experimental. Remaining changes:
  - debian/control:
    + Don't build-depend on QEmu.
    + Add "XS-Debian-" prefix to Debian's Vcs headers.
    + Bump bridge-utils, dnsmasq-base, netcat-openbsd, and iptables
      to Depends of libvirt-bin.
    + s/interract/interact/g
    + Add versioned Conflicts/Replaces to libvirt0 for libvirt0-dbg,
      since we used to ship them as such.
  - Rename libvirt group to libvirtd.
  - 0005-delayed_iff_up_bridge.patch: Don't try to bring up the bridge
    before at least one interface has been added to it.
  - dont_clobber_existing_bridges.patch: Assign the name of the virtual
    bridge dynamically to avoid interfering with existing bridges.
  - better_default_uri_virsh.patch: Default to qemu:///system if the
    user has write access to the libvirt socket, otherwise
    qemu:///session.
  - We call libxen-dev libxen3-dev, so change all references.
  - Included (but did not enable) opennebula patch (since it's not in
    main yet).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="ISO-8859-1"?>
 
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
3
<html xmlns="http://www.w3.org/1999/xhtml">
 
4
<!--
 
5
        This file is autogenerated from logging.html.in
 
6
        Do not edit this file. Changes will be lost.
 
7
      -->
 
8
  <head>
 
9
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
 
10
    <link rel="stylesheet" type="text/css" href="main.css" />
 
11
    <link rel="SHORTCUT ICON" href="32favicon.png" />
 
12
    <title>libvirt: Logging in the library and the daemon</title>
 
13
    <meta name="description" content="libvirt, virtualization, virtualization API" />
 
14
  </head>
 
15
  <body>
 
16
    <div id="header">
 
17
      <div id="headerLogo"></div>
 
18
      <div id="headerSearch">
 
19
        <form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><div>
 
20
            <input id="query" name="query" type="text" size="12" value="" />
 
21
            <input id="submit" name="submit" type="submit" value="Search" />
 
22
          </div></form>
 
23
      </div>
 
24
    </div>
 
25
    <div id="body">
 
26
      <div id="menu">
 
27
        <ul class="l0"><li>
 
28
            <div>
 
29
              <a title="Front page of the libvirt website" class="inactive" href="index.html">Home</a>
 
30
            </div>
 
31
          </li><li>
 
32
            <div>
 
33
              <a title="Details of new features and bugs fixed in each release" class="inactive" href="news.html">News</a>
 
34
            </div>
 
35
          </li><li>
 
36
            <div>
 
37
              <a title="Get the latest source releases, binary builds and get access to the source repository" class="inactive" href="downloads.html">Downloads</a>
 
38
            </div>
 
39
          </li><li>
 
40
            <div>
 
41
              <a title="Information for users, administrators and developers" class="active" href="docs.html">Documentation</a>
 
42
              <ul class="l1"><li>
 
43
                  <div>
 
44
                    <a title="Information about deploying and using libvirt" class="active" href="deployment.html">Deployment</a>
 
45
                    <ul class="l2"><li>
 
46
                        <div>
 
47
                          <a title="The URI formats used for connecting to libvirt" class="inactive" href="uri.html">URI format</a>
 
48
                        </div>
 
49
                      </li><li>
 
50
                        <div>
 
51
                          <a title="Enable remote access over TCP" class="inactive" href="remote.html">Remote access</a>
 
52
                        </div>
 
53
                      </li><li>
 
54
                        <div>
 
55
                          <a title="Configure authentication for the libvirt daemon" class="inactive" href="auth.html">Authentication</a>
 
56
                        </div>
 
57
                      </li><li>
 
58
                        <div>
 
59
                          <a title="Access the libvirt daemon from a native Windows client" class="inactive" href="windows.html">Windows port</a>
 
60
                        </div>
 
61
                      </li><li>
 
62
                        <div>
 
63
                          <span class="active">Logging</span>
 
64
                        </div>
 
65
                      </li></ul>
 
66
                  </div>
 
67
                </li><li>
 
68
                  <div>
 
69
                    <a title="Overview of the logical subsystems in the libvirt API" class="inactive" href="intro.html">Architecture</a>
 
70
                  </div>
 
71
                </li><li>
 
72
                  <div>
 
73
                    <a title="Description of the XML formats used in libvirt" class="inactive" href="format.html">XML format</a>
 
74
                  </div>
 
75
                </li><li>
 
76
                  <div>
 
77
                    <a title="Hypervisor specific driver information" class="inactive" href="drivers.html">Drivers</a>
 
78
                  </div>
 
79
                </li><li>
 
80
                  <div>
 
81
                    <a title="Reference manual for the C public API" class="inactive" href="html/index.html">API reference</a>
 
82
                  </div>
 
83
                </li><li>
 
84
                  <div>
 
85
                    <a title="Bindings of the libvirt API for other languages" class="inactive" href="bindings.html">Language bindings</a>
 
86
                  </div>
 
87
                </li></ul>
 
88
            </div>
 
89
          </li><li>
 
90
            <div>
 
91
              <a title="User contributed content" class="inactive" href="http://wiki.libvirt.org">Wiki</a>
 
92
            </div>
 
93
          </li><li>
 
94
            <div>
 
95
              <a title="Frequently asked questions" class="inactive" href="FAQ.html">FAQ</a>
 
96
            </div>
 
97
          </li><li>
 
98
            <div>
 
99
              <a title="How and where to report bugs and request features" class="inactive" href="bugs.html">Bug reports</a>
 
100
            </div>
 
101
          </li><li>
 
102
            <div>
 
103
              <a title="How to contact the developers via email and IRC" class="inactive" href="contact.html">Contact</a>
 
104
            </div>
 
105
          </li><li>
 
106
            <div>
 
107
              <a title="Miscellaneous links of interest related to libvirt" class="inactive" href="relatedlinks.html">Related Links</a>
 
108
            </div>
 
109
          </li><li>
 
110
            <div>
 
111
              <a title="Overview of all content on the website" class="inactive" href="sitemap.html">Sitemap</a>
 
112
            </div>
 
113
          </li></ul>
 
114
      </div>
 
115
      <div id="content">
 
116
        <h1>Logging in the library and the daemon</h1>
 
117
        <p>Libvirt includes logging facilities starting from version 0.6.0,
 
118
       this complements the <a href="errors.html">error handling</a>
 
119
       mechanism and APIs to allow tracing though the execution of the
 
120
       library as well as in the libvirtd daemon.</p>
 
121
        <p>The logging functionalities in libvirt are based on 3 key concepts,
 
122
       similar to the one present in other generic logging facilities like
 
123
       log4j:</p>
 
124
        <ul><li>log messages: they are information generated at runtime by
 
125
          the libvirt code, it includes a priority level (DEBUG = 1,
 
126
          INFO = 2, WARNING = 3, ERROR = 4), a category, function name and
 
127
          line number, indicating where it originated from, and finally
 
128
          a formatted message, in addition the library adds a timestamp
 
129
          at the begining of the message</li><li>log filters: it's a set of patter and priorities allowing to acept
 
130
          or reject a log message, if the message category matches a filter,
 
131
          the message priority is compared to the filter priority, if lower
 
132
          the message is discarded, if higher the message is output. If
 
133
          no filter matches, then a general priority level is applied to
 
134
          all remaining messages. This allows to capture for example all
 
135
          debug messages for the QEmu driver, but otherwise only allow
 
136
          errors to show up from other parts</li><li>log outputs: once a message has gone though filtering a set of
 
137
          output defines where to send the message, they can also filter
 
138
          based on the priority, for example it may be useful to output
 
139
          all messages to a debugging file but only allow errors to be
 
140
          logged though syslog.</li></ul>
 
141
        <p>The library configuration of logging is though 3 environment variables
 
142
    allowing to control the logging behaviour:</p>
 
143
        <ul><li>LIBVIRT_DEBUG: it can take the four following values:
 
144
      <ul><li>1 or "debug": asking the library to log every message emitted,
 
145
            though the filters can be used to avoid filling up the output</li><li>2 or "info": log all non-debugging informations</li><li>3 or "warn": log warnings and errors, that's the default value</li><li>4 or "error": log only error messages</li></ul></li><li>LIBVIRT_LOG_FILTERS: allow to define logging filters</li><li>LIBVIRT_LOG_OUTPUTS: allow to define logging outputs</li></ul>
 
146
        <p>Similary the daemon logging behaviour can be tuned using 3 config
 
147
    variables, stored in the configuration file:
 
148
    </p>
 
149
        <ul><li>log_level: accepts the following values:
 
150
      <ul><li>0: no logging at all</li><li>4: only errors</li><li>3: warnings and errors</li><li>2: informations, warnings and errors</li><li>1: debug and everything</li></ul></li><li>log_filters: allow to define logging filters</li><li>log_outputs: allow to define logging outputs</li></ul>
 
151
        <p>In both case the syntax for filters and outputs is similar.</p>
 
152
        <p>The format for a filter is:</p>
 
153
        <pre>x:name</pre>
 
154
        <p>where <code>name</code> is a match string e.g. <code>remote</code> or
 
155
    <code>qemu</code> and the x is the minimal level where matching messages
 
156
    should be logged:</p>
 
157
        <ul><li>1: DEBUG</li><li>2: INFO</li><li>3: WARNING</li><li>4: ERROR</li></ul>
 
158
        <p>Multiple filter can be defined in a single string, they just need to be
 
159
    separated by spaces, e.g: <code>"3:remote 4:event"</code> to only get
 
160
    warning or errors from the remote layer and only errors from the event
 
161
    layer.</p>
 
162
        <p>
 
163
    </p>
 
164
        <p>The format for an output can be one of those 3 forms:</p>
 
165
        <ul><li><code>x:stderr</code> output goes to stderr</li><li><code>x:syslog:name</code> use syslog for the output and use the
 
166
      given <code>name</code> as the ident</li><li><code>x:file:file_path</code>output to a file, with the given
 
167
      filepath</li></ul>
 
168
        <p>In all cases the x prefix is the minimal level, acting as a filter:</p>
 
169
        <ul><li>0: everything</li><li>1: DEBUG</li><li>2: INFO</li><li>3: WARNING</li><li>4: ERROR</li></ul>
 
170
        <p>Multiple output can be defined , they just need to be separated by
 
171
       spaces, e.g.: <code>"3:syslog:libvirtd 0:file:/tmp/libvirt.log"</code>
 
172
       will log all warnings and errors to syslog under the libvirtd ident
 
173
       but also log everything debugging and informations included in the
 
174
       file <code>/tmp/libvirt.log</code></p>
 
175
        <p>For example setting up the following:</p>
 
176
        <pre>export LIBVIRT_DEBUG=1
 
177
export LIBVIRT_LOG_OUTPUTS="0:file:virsh.log"</pre>
 
178
        <p>and then running virsh will accumulate the logs in the
 
179
    <code>virsh.log</code> file in a way similar to:</p>
 
180
        <pre>14:29:04.771: debug : virInitialize:278 : register drivers
 
181
14:29:04.771: debug : virRegisterDriver:618 : registering Test as driver 0</pre>
 
182
        <p>the messages are timestamped, there is also the level recorded,
 
183
    if debug the name of the function is also printed and then the formatted
 
184
    message. This should be sufficient to at least get a precise idea of
 
185
    what is happening and where things are going wrong, allowing to then
 
186
    put the correct breakpoints when running under a debugger.</p>
 
187
      </div>
 
188
    </div>
 
189
    <div id="footer">
 
190
      <p id="sponsor">
 
191
            Sponsored by:<br /><a href="http://et.redhat.com/"><img src="et.png" alt="Project sponsored by Red Hat Emerging Technology" /></a></p>
 
192
    </div>
 
193
  </body>
 
194
</html>