<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>142496</bug_id>
          
          <creation_ts>2007-03-04 11:04:14 +0000</creation_ts>
          <short_desc>Ktorrent needs an option to control the log file size</short_desc>
          <delta_ts>2007-05-19 13:06:21 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>ktorrent</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>wishlist</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Donatas Glodenis">dg</reporter>
          <assigned_to name="Joris Guisson">joris.guisson</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>512644</commentid>
    <comment_count>0</comment_count>
    <who name="Donatas Glodenis">dg</who>
    <bug_when>2007-03-04 11:04:14 +0000</bug_when>
    <thetext>Version:           2.1 (using KDE 3.5.5, Kubuntu (edgy) 4:3.5.5-0ubuntu3.1)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.17-11-generic

After some time in use Ktorrent log file got to 90 MB size. I could not find an option to limit the size it can grow to, so I think there must be some option created in the configuration dialogs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>526758</commentid>
    <comment_count>1</comment_count>
    <who name="Joris Guisson">joris.guisson</who>
    <bug_when>2007-05-19 12:47:19 +0000</bug_when>
    <thetext>We will add an automatic log rotate after 10 MB, don&apos;t see much need in actually having this configurable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>526760</commentid>
    <comment_count>2</comment_count>
    <who name="Joris Guisson">joris.guisson</who>
    <bug_when>2007-05-19 13:06:20 +0000</bug_when>
    <thetext>SVN commit 666273 by guisson:

Auto rotate log when it gets larger then 10 MB

BUG: 142496


 M  +17 -2     log.cpp  


--- trunk/extragear/network/ktorrent/libktorrent/util/log.cpp #666272:666273
@@ -38,6 +38,8 @@
 
 namespace bt
 {
+	const Uint32 MAX_LOG_FILE_SIZE = 10 * 1024 * 1024; // 10 MB
+	
 	class Log::Private
 	{
 	public:
@@ -103,8 +105,8 @@
 		{
 			tmp += line;
 		}
-
-		void endline()
+		
+		void finishLine()
 		{
 			*out &lt;&lt; QDateTime::currentDateTime().toString() &lt;&lt; &quot;: &quot; &lt;&lt; tmp &lt;&lt; ::endl;
 			fptr.flush();
@@ -123,6 +125,19 @@
 			}
 			tmp = &quot;&quot;;
 		}
+
+		void endline()
+		{
+			finishLine();
+			if (fptr.size() &gt; MAX_LOG_FILE_SIZE)
+			{
+				// calling setOutputFile will rotate the logs
+				tmp = &quot;Log larger then 10 MB, rotating&quot;;
+				finishLine();
+				QString file = fptr.name();
+				setOutputFile(file);
+			}
+		}
 	};
 	
 	Log::Log() 
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>