[Box Backup] boxbackup LogFile Deleted log line...

Kenny Millington boxbackup@boxbackup.org
Sat, 28 Mar 2009 23:34:28 +0000


--=-E4OILKNKkeLvZs11kLkc
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,

(Me again ;-))

Got my trunk package built and installed and I noticed this sort of
thing happening in the log:-

22:07:55 [NOTICE]  Deleted
file: /home/kenny/Maildir/.Spam/cur/=C3=8A^@^O^^^Q=C2=A7
<88>g,d=C2=A6=C2=BBl=C3=B2=C3=BCA2=C2=AA=C2=BD@^H<8b><88>ZZ^X=C3=90=C2=B5gE=
U^M=C2=BCm=C3=B6=C3=94=C3=8A=C3=8F=C3=AC<91><8d>=C3=86=C3=B5=C3=8A,=C3=8F'=
=C3=BB=C3=AA (ID
0x1869)

My guess (which is probably wrong) tells me that that's the encrypted
filename on the store?=20

(The server version is quite old, around svn 1828... I should really
look at upgrading this at some point soon.)

Also, can the timestamp in the LogFile include a date?=20

I tried to implement this myself using strftime(), however the %S in the
format string for seconds kept coming out as something like:  "Mar 28
23:15:<A0><BF>" - no idea what's going on there!

I've attached my attempted patch incase you get bored enough to
investigate, I'm afraid my C++ skills aren't up to much!=20

Thanks,
--=20
Kenny Millington
Systems Developer
kenny.millington@3ait.co.uk

3aIT Limited - Official Corporate Sponsor of the British Bobsleigh Team

4-10 Barttelot Rd   Horsham   West Sussex   RH12 1DQ
CoReg: 3866698   VATReg: 771388600
T: +44 (0)870 881 5097   F: +44 (0)870 116 0793

Visit www.3aIT.co.uk for Design, Systems, Support

Disclaimer:
The information contained within this email is confidential and may =20
be legally privileged. It is intended solely for the addressee. If =20
you are not the intended recipient, any disclosure, copying or =20
distribution of this email is prohibited and may be unlawful. The =20
content of this email represents the views of the individual and not =20
necessarily 3aIT Limited.  3aIT Limited reserves the right to monitor =20
the content of all emails in accordance with lawful business =20
practice. Whilst every effort is made to ensure that attachments are =20
free from computer viruses before transmission, 3aIT Limited does not =20
accept any liability in respect of any virus that is not detected.

--=-E4OILKNKkeLvZs11kLkc
Content-Disposition: attachment; filename="strftime-attempt.patch"
Content-Type: text/x-patch; name="strftime-attempt.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

Index: lib/common/Logging.cpp
===================================================================
--- lib/common/Logging.cpp	(revision 2479)
+++ lib/common/Logging.cpp	(working copy)
@@ -449,7 +449,7 @@
 	Logging::Remove(this);
 
 	std::ostringstream buf;
-	buf << FormatTime(GetCurrentBoxTime(), false);
+	buf << FormatDateTime(GetCurrentBoxTime(), false);
 	buf << " ";
 
 	if (Level <= Log::FATAL)
Index: lib/common/BoxTime.h
===================================================================
--- lib/common/BoxTime.h	(revision 2479)
+++ lib/common/BoxTime.h	(working copy)
@@ -41,5 +41,6 @@
 }
 
 std::string FormatTime(box_time_t time, bool showMicros = false);
+std::string FormatDateTime(box_time_t time, bool showMicros = false);
 
 #endif // BOXTIME__H
Index: lib/common/BoxTime.cpp
===================================================================
--- lib/common/BoxTime.cpp	(revision 2479)
+++ lib/common/BoxTime.cpp	(working copy)
@@ -86,3 +86,34 @@
 	return buf.str();
 }
 
+std::string FormatDateTime(box_time_t time, bool showMicros)
+{
+    std::ostringstream buf;
+	
+    time_t seconds = BoxTimeToSeconds(time);
+	int micros = BoxTimeToMicroSeconds(time) % MICRO_SEC_IN_SEC;
+
+	struct tm tm_now, *tm_ptr = &tm_now;
+
+	#ifdef WIN32
+		if ((tm_ptr = localtime(&seconds)) != NULL)
+	#else
+		if (localtime_r(&seconds, &tm_now) != NULL)
+	#endif
+	{
+		char datetime_buf[15];
+        strftime(datetime_buf, 15, "\%b \%d \%H:\%M:\%S", tm_ptr);
+        buf << std::setfill('0') << datetime_buf;
+		
+        if (showMicros)
+		{
+			buf << "." << std::setw(6) << micros;
+		}
+	}
+	else
+	{
+		buf << strerror(errno);
+	}
+
+	return buf.str();
+}

--=-E4OILKNKkeLvZs11kLkc--