[tomboy] Remove the trailing dot for log files on Windows and catch UnauthorizedAccess exceptions when we cre
- From: Benjamin Podszun <bpodszun src gnome org>
- To: svn-commits-list gnome org
- Subject: [tomboy] Remove the trailing dot for log files on Windows and catch UnauthorizedAccess exceptions when we cre
- Date: Wed, 29 Apr 2009 11:23:15 -0400 (EDT)
commit bf45d29c258482e5f0ea821551b16de0d4109cb0
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 26b1287..b042ba8 100644
--- a/Tomboy/Logger.cs
+++ b/Tomboy/Logger.cs
@@ -34,20 +34,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]