Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="node350.html" /> | |
13 | <link rel="prev" href="node348.html" /> | |
14 | <link rel="parent" href="node345.html" /> | |
15 | <link rel="next" href="node350.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>6.29.5.4 TimedRotatingFileHandler</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="6.29.5.3 RotatingFileHandler" | |
25 | href="node348.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="6.29.5 Handler Objects" | |
28 | href="node345.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="6.29.5.5 SocketHandler" | |
31 | href="node350.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="node348.html">6.29.5.3 RotatingFileHandler</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="node345.html">6.29.5 Handler Objects</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="node350.html">6.29.5.5 SocketHandler</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H3><A NAME="SECTION0082954000000000000000"> | |
56 | 6.29.5.4 TimedRotatingFileHandler</A> | |
57 | </H3> | |
58 | ||
59 | <P> | |
60 | The <tt class="class">TimedRotatingFileHandler</tt> class supports rotation of disk log files | |
61 | at certain timed intervals. | |
62 | ||
63 | <P> | |
64 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
65 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-2516' xml:id='l2h-2516' class="class">TimedRotatingFileHandler</tt></b>(</nobr></td> | |
66 | <td><var>filename | |
67 | </var><big>[</big><var>,when | |
68 | </var><big>[</big><var>,interval | |
69 | </var><big>[</big><var>,backupCount</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> | |
70 | <dd> | |
71 | ||
72 | <P> | |
73 | Returns a new instance of the <tt class="class">TimedRotatingFileHandler</tt> class. The | |
74 | specified file is opened and used as the stream for logging. On rotating | |
75 | it also sets the filename suffix. Rotating happens based on the product | |
76 | of <var>when</var> and <var>interval</var>. | |
77 | ||
78 | <P> | |
79 | You can use the <var>when</var> to specify the type of <var>interval</var>. The | |
80 | list of possible values is, note that they are not case sensitive: | |
81 | ||
82 | <P> | |
83 | <div class="center"><table class="realtable"> | |
84 | <thead> | |
85 | <tr> | |
86 | <th class="left" >Value</th> | |
87 | <th class="left" >Type of interval</th> | |
88 | </tr> | |
89 | </thead> | |
90 | <tbody> | |
91 | <tr><td class="left" valign="baseline">S</td> | |
92 | <td class="left" >Seconds</td></tr> | |
93 | <tr><td class="left" valign="baseline">M</td> | |
94 | <td class="left" >Minutes</td></tr> | |
95 | <tr><td class="left" valign="baseline">H</td> | |
96 | <td class="left" >Hours</td></tr> | |
97 | <tr><td class="left" valign="baseline">D</td> | |
98 | <td class="left" >Days</td></tr> | |
99 | <tr><td class="left" valign="baseline">W</td> | |
100 | <td class="left" >Week day (0=Monday)</td></tr> | |
101 | <tr><td class="left" valign="baseline">midnight</td> | |
102 | <td class="left" >Roll over at midnight</td></tr></tbody> | |
103 | </table></div> | |
104 | ||
105 | <P> | |
106 | If <var>backupCount</var> is non-zero, the system will save old log files by | |
107 | appending the extensions ".1", ".2" etc., to the filename. For example, | |
108 | with a <var>backupCount</var> of 5 and a base file name of <span class="file">app.log</span>, | |
109 | you would get <span class="file">app.log</span>, <span class="file">app.log.1</span>, <span class="file">app.log.2</span>, up to | |
110 | <span class="file">app.log.5</span>. The file being written to is always <span class="file">app.log</span>. | |
111 | When this file is filled, it is closed and renamed to <span class="file">app.log.1</span>, | |
112 | and if files <span class="file">app.log.1</span>, <span class="file">app.log.2</span>, etc. exist, then they | |
113 | are renamed to <span class="file">app.log.2</span>, <span class="file">app.log.3</span> etc. respectively. | |
114 | </dl> | |
115 | ||
116 | <P> | |
117 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
118 | <td><nobr><b><tt id='l2h-2517' xml:id='l2h-2517' class="method">doRollover</tt></b>(</nobr></td> | |
119 | <td><var></var>)</td></tr></table></dt> | |
120 | <dd> | |
121 | Does a rollover, as described above. | |
122 | </dl> | |
123 | ||
124 | <P> | |
125 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
126 | <td><nobr><b><tt id='l2h-2518' xml:id='l2h-2518' class="method">emit</tt></b>(</nobr></td> | |
127 | <td><var>record</var>)</td></tr></table></dt> | |
128 | <dd> | |
129 | Outputs the record to the file, catering for rollover as described | |
130 | above. | |
131 | </dl> | |
132 | ||
133 | <P> | |
134 | ||
135 | <DIV CLASS="navigation"> | |
136 | <div class='online-navigation'> | |
137 | <p></p><hr /> | |
138 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
139 | <tr> | |
140 | <td class='online-navigation'><a rel="prev" title="6.29.5.3 RotatingFileHandler" | |
141 | href="node348.html"><img src='../icons/previous.png' | |
142 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
143 | <td class='online-navigation'><a rel="parent" title="6.29.5 Handler Objects" | |
144 | href="node345.html"><img src='../icons/up.png' | |
145 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
146 | <td class='online-navigation'><a rel="next" title="6.29.5.5 SocketHandler" | |
147 | href="node350.html"><img src='../icons/next.png' | |
148 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
149 | <td align="center" width="100%">Python Library Reference</td> | |
150 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
151 | href="contents.html"><img src='../icons/contents.png' | |
152 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
153 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
154 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
155 | <td class='online-navigation'><a rel="index" title="Index" | |
156 | href="genindex.html"><img src='../icons/index.png' | |
157 | border='0' height='32' alt='Index' width='32' /></A></td> | |
158 | </tr></table> | |
159 | <div class='online-navigation'> | |
160 | <b class="navlabel">Previous:</b> | |
161 | <a class="sectref" rel="prev" href="node348.html">6.29.5.3 RotatingFileHandler</A> | |
162 | <b class="navlabel">Up:</b> | |
163 | <a class="sectref" rel="parent" href="node345.html">6.29.5 Handler Objects</A> | |
164 | <b class="navlabel">Next:</b> | |
165 | <a class="sectref" rel="next" href="node350.html">6.29.5.5 SocketHandler</A> | |
166 | </div> | |
167 | </div> | |
168 | <hr /> | |
169 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
170 | </DIV> | |
171 | <!--End of Navigation Panel--> | |
172 | <ADDRESS> | |
173 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
174 | </ADDRESS> | |
175 | </BODY> | |
176 | </HTML> |