<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Class Poco::SimpleFileChannel</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="language" content="en"/> <meta name="date" content="2009-11-24"/> <meta name="generator" content="PocoDoc"/> <link rel="stylesheet" href="css/styles.css" type="text/css"/> </head> <body bgcolor="#ffffff" leftmargin="0" topmargin="0"> <div class="header"> <h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1> <h1 class="symbol">class SimpleFileChannel</h1> </div> <div class="body"> <p> <b>Library:</b> Foundation<br /> <b>Package:</b> Logging<br /> <b>Header:</b> Poco/SimpleFileChannel.h</p> <h2>Description</h2> <div class="description"> <p>A <a href="Poco.Channel.html" title="class Poco::Channel">Channel</a> that writes to a file. This class only supports simple log file rotation. </p> <p>For more features, see the <a href="Poco.FileChannel.html" title="class Poco::FileChannel">FileChannel</a> class. </p> <p>Only the message's text is written, followed by a newline. </p> <p>Chain this channel to a <a href="Poco.FormattingChannel.html" title="class Poco::FormattingChannel">FormattingChannel</a> with an appropriate <a href="Poco.Formatter.html" title="class Poco::Formatter">Formatter</a> to control what is in the text. </p> <p>Log file rotation based on log file size is supported. </p> <p>If rotation is enabled, the <a href="Poco.SimpleFileChannel.html" title="class Poco::SimpleFileChannel">SimpleFileChannel</a> will alternate between two log files. If the size of the primary log file exceeds a specified limit, the secondary log file will be used, and vice versa. </p> <p>Log rotation is configured with the "rotation" property, which supports the following values: </p> <ul> <li>never: no log rotation </li> <li><n>: the file is rotated when its size exceeds <n> bytes. </li> <li><n> K: the file is rotated when its size exceeds <n> Kilobytes. </li> <li><n> M: the file is rotated when its size exceeds <n> Megabytes. </li> </ul> <p>The path of the (primary) log file can be specified with the "path" property. Optionally, the path of the secondary log file can be specified with the "secondaryPath" property. </p> <p>If no secondary path is specified, the secondary path will default to <primaryPath>.1. </p> </div> <h2>Inheritance</h2> <p><b>Direct Base Classes: </b><a href="Poco.Channel.html" title="class Poco::Channel">Channel</a></p> <p><b>All Base Classes: </b><a href="Poco.Channel.html" title="class Poco::Channel">Channel</a>, <a href="Poco.Configurable.html" title="class Poco::Configurable">Configurable</a>, <a href="Poco.RefCountedObject.html" title="class Poco::RefCountedObject">RefCountedObject</a></p> <h2>Member Summary</h2> <p><b>Member Functions: </b><a href="Poco.SimpleFileChannel.html#10070" title="Poco::SimpleFileChannel::close()">close</a>, <a href="Poco.SimpleFileChannel.html#10078" title="Poco::SimpleFileChannel::creationDate()">creationDate</a>, <a href="Poco.SimpleFileChannel.html#10076" title="Poco::SimpleFileChannel::getProperty()">getProperty</a>, <a href="Poco.SimpleFileChannel.html#10071" title="Poco::SimpleFileChannel::log()">log</a>, <a href="Poco.SimpleFileChannel.html#10069" title="Poco::SimpleFileChannel::open()">open</a>, <a href="Poco.SimpleFileChannel.html#10080" title="Poco::SimpleFileChannel::path()">path</a>, <a href="Poco.SimpleFileChannel.html#10088" title="Poco::SimpleFileChannel::rotate()">rotate</a>, <a href="Poco.SimpleFileChannel.html#10081" title="Poco::SimpleFileChannel::secondaryPath()">secondaryPath</a>, <a href="Poco.SimpleFileChannel.html#10073" title="Poco::SimpleFileChannel::setProperty()">setProperty</a>, <a href="Poco.SimpleFileChannel.html#10086" title="Poco::SimpleFileChannel::setRotation()">setRotation</a>, <a href="Poco.SimpleFileChannel.html#10079" title="Poco::SimpleFileChannel::size()">size</a></p> <p><b>Inherited Functions: </b><a href="Poco.Channel.html#4145" title="Poco::Channel::close()">close</a>, <a href="Poco.RefCountedObject.html#9659" title="Poco::RefCountedObject::duplicate()">duplicate</a>, <a href="Poco.Channel.html#4151" title="Poco::Channel::getProperty()">getProperty</a>, <a href="Poco.Channel.html#4146" title="Poco::Channel::log()">log</a>, <a href="Poco.Channel.html#4144" title="Poco::Channel::open()">open</a>, <a href="Poco.RefCountedObject.html#9661" title="Poco::RefCountedObject::referenceCount()">referenceCount</a>, <a href="Poco.RefCountedObject.html#9660" title="Poco::RefCountedObject::release()">release</a>, <a href="Poco.Channel.html#4148" title="Poco::Channel::setProperty()">setProperty</a></p> <h2>Constructors</h2> <h3><a name="10066">SimpleFileChannel</a></h3> <p class="decl"><a href="Poco.SimpleFileChannel.html" title="class Poco::SimpleFileChannel">SimpleFileChannel</a>();</p> <div class="description"> <p>Creates the <a href="Poco.FileChannel.html" title="class Poco::FileChannel">FileChannel</a>. </p> </div> <h3><a name="10067">SimpleFileChannel</a></h3> <p class="decl"><a href="Poco.SimpleFileChannel.html" title="class Poco::SimpleFileChannel">SimpleFileChannel</a>(<br /> const std::string & path<br />);</p> <div class="description"> <p>Creates the <a href="Poco.FileChannel.html" title="class Poco::FileChannel">FileChannel</a> for a file with the given path. </p> </div> <h2>Destructor</h2> <h3><a name="10085">~SimpleFileChannel</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">~<a href="Poco.SimpleFileChannel.html" title="class Poco::SimpleFileChannel">SimpleFileChannel</a>();</p> <div class="description"> <p></p> </div> <h2>Member Functions</h2> <h3><a name="10070">close</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void close();</p> <div class="description"> <p>Closes the <a href="Poco.FileChannel.html" title="class Poco::FileChannel">FileChannel</a>. </p> </div> <div class="description"><p><b>See also:</b> <a href="Poco.Channel.html#4145" title="Poco::Channel::close()">Poco::Channel::close()</a></p></div> <h3><a name="10078">creationDate</a></h3> <p class="decl"><a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> creationDate() const;</p> <div class="description"> <p>Returns the log file's creation date. </p> </div> <h3><a name="10076">getProperty</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">std::string getProperty(<br /> const std::string & name<br />) const;</p> <div class="description"> <p>Returns the value of the property with the given name. See <a href="Poco.SimpleFileChannel.html#10073" title="Poco::SimpleFileChannel::setProperty()">setProperty</a>() for a description of the supported properties. </p> </div> <div class="description"><p><b>See also:</b> <a href="Poco.Channel.html#4151" title="Poco::Channel::getProperty()">Poco::Channel::getProperty()</a></p></div> <h3><a name="10071">log</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void log(<br /> const <a href="Poco.Message.html" title="class Poco::Message">Message</a> & msg<br />);</p> <div class="description"> <p>Logs the given message to the file. </p> </div> <div class="description"><p><b>See also:</b> <a href="Poco.Channel.html#4146" title="Poco::Channel::log()">Poco::Channel::log()</a></p></div> <h3><a name="10069">open</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void open();</p> <div class="description"> <p>Opens the <a href="Poco.FileChannel.html" title="class Poco::FileChannel">FileChannel</a> and creates the log file if necessary. </p> </div> <div class="description"><p><b>See also:</b> <a href="Poco.Channel.html#4144" title="Poco::Channel::open()">Poco::Channel::open()</a></p></div> <h3><a name="10080">path</a></h3> <p class="decl">const std::string & path() const;</p> <div class="description"> <p>Returns the log file's primary path. </p> </div> <h3><a name="10081">secondaryPath</a></h3> <p class="decl">const std::string & secondaryPath() const;</p> <div class="description"> <p>Returns the log file's secondary path. </p> </div> <h3><a name="10073">setProperty</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void setProperty(<br /> const std::string & name,<br /> const std::string & value<br />);</p> <div class="description"> <p>Sets the property with the given name. </p> <p>The following properties are supported: </p> <ul> <li>path: The primary log file's path. </li> <li>secondaryPath: The secondary log file's path. </li> <li>rotation: The log file's rotation mode. See the <a href="Poco.SimpleFileChannel.html" title="class Poco::SimpleFileChannel">SimpleFileChannel</a> class for details. </li> </ul> </div> <div class="description"><p><b>See also:</b> <a href="Poco.Channel.html#4148" title="Poco::Channel::setProperty()">Poco::Channel::setProperty()</a></p></div> <h3><a name="10079">size</a></h3> <p class="decl"><a href="Poco.html#11358" title="Poco::UInt64">UInt64</a> size() const;</p> <div class="description"> <p>Returns the log file's current size in bytes. </p> </div> <h3><a name="10088">rotate</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void rotate();</p> <div class="description"> <p></p> </div> <h3><a name="10086">setRotation</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void setRotation(<br /> const std::string & rotation<br />);</p> <div class="description"> <p></p> </div> <h2>Variables</h2> <h3><a name="10082">PROP_PATH</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static const std::string <a href="Poco.SimpleFileChannel.html#10082" title="Poco::SimpleFileChannel::PROP_PATH">PROP_PATH</a>;</p> <div class="description"> <p></p> </div> <h3><a name="10084">PROP_ROTATION</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static const std::string <a href="Poco.SimpleFileChannel.html#10084" title="Poco::SimpleFileChannel::PROP_ROTATION">PROP_ROTATION</a>;</p> <div class="description"> <p></p> </div> <h3><a name="10083">PROP_SECONDARYPATH</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static const std::string <a href="Poco.SimpleFileChannel.html#10083" title="Poco::SimpleFileChannel::PROP_SECONDARYPATH">PROP_SECONDARYPATH</a>;</p> <div class="description"> <p></p> </div> <p class="footer">POCO C++ Libraries 1.3.6-all<br /> Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p> </div> </body> </html>