[tomboy/gnome-2-26] Remove the trailing dot for log files on Windows and catch UnauthorizedAccess exceptions when we cre
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Subject: [tomboy/gnome-2-26] Remove the trailing dot for log files on Windows and catch UnauthorizedAccess exceptions when we cre
- Date: Mon, 11 May 2009 10:15:28 -0400 (EDT)
commit 4a1e3a76389471e09a713c5ff4b736a240a8ec17
Author: Benjamin.Podszun <benjamin podszun gmail com>
Date: Wed Apr 29 16:57:52 2009 +0200
Remove the trailing dot for log files on Windows and catch UnauthorizedAccess exceptions when we create the file
---
Tomboy/Logger.cs | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/Tomboy/Logger.cs b/Tomboy/Logger.cs
index e4b8b25..24c5021 100644
--- a/Tomboy/Logger.cs
+++ b/Tomboy/Logger.cs
@@ -33,20 +33,30 @@ namespace Tomboy
public FileLogger ()
{
- try {
- log = File.CreateText (Path.Combine (
+ console = new ConsoleLogger ();
+
#if WIN32
- Services.NativeApplication.ConfDir,
+ string logfile = Path.Combine(
+ Services.NativeApplication.ConfDir,
+ "tomboy.log");
#else
- Environment.GetEnvironmentVariable ("HOME"),
+ string logfile = Path.Combine(
+ Environment.GetEnvironmentVariable ("HOME"),
+ ".tomboy.log");
#endif
- ".tomboy.log"));
+
+ try {
+ log = File.CreateText (logfile);
log.Flush ();
- } catch (IOException) {
- // FIXME: Use temp file
+ } catch (IOException iox) {
+ console.Log(Level.WARN,
+ "Failed to create the logfile at {0}: {1}",
+ logfile, iox.Message);
+ } catch (UnauthorizedAccessException uax) {
+ console.Log(Level.WARN,
+ "Failed to create the logfile at {0}: {1}",
+ logfile, uax.Message);
}
-
- console = new ConsoleLogger ();
}
~FileLogger ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]