Revision 6f03d6e1 trunk/Pithos.Client.WPF/App.xaml.cs

b/trunk/Pithos.Client.WPF/App.xaml.cs
51 51
using Caliburn.Micro;
52 52
using Pithos.Client.WPF.Properties;
53 53
using log4net.Appender;
54
using log4net.Core;
54 55
using log4net.Repository.Hierarchy;
55 56

  
56 57

  
......
100 101
            try
101 102
            {
102 103
                var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
103
                var pithosDataPath= Path.Combine(appDataPath , "GRNET");
104
                var pithosDataPath = Path.Combine(appDataPath, "GRNET");
104 105
                if (!Directory.Exists(pithosDataPath))
105 106
                    Directory.CreateDirectory(pithosDataPath);
106 107

  
107 108
                var loggerRepository = (Hierarchy)log4net.LogManager.GetRepository();
108
                
109

  
109 110
                var appenders = loggerRepository.GetAppenders();
111
                
110 112
                var lossyAppender = appenders.OfType<BufferingForwardingAppender>()
111
                    .First(appender => appender.Name == "LossyFileAppender");
112
                var dumpAppender = lossyAppender.Appenders.OfType<RollingFileAppender>().First();                
113
                dumpAppender.File = Path.Combine(pithosDataPath, "errorlog.txt");
114
                dumpAppender.ActivateOptions();
113
                    .FirstOrDefault(appender => appender.Name == "LossyFileAppender");
114
                if (lossyAppender!=null)
115
                {
116
                    var dumpAppender = lossyAppender.Appenders.OfType<RollingFileAppender>().First();
117
                    dumpAppender.File = Path.Combine(pithosDataPath, "errorlog.xml");
118
                    dumpAppender.ActivateOptions();
119
                }
120
                
121
                var debugAppender =appenders.OfType<RollingFileAppender>()
122
                    .FirstOrDefault(a => a.Name == "DebugFileAppender");
123
                if (debugAppender != null)
124
                {
125
                    debugAppender.File = Path.Combine(pithosDataPath, "debuglog.xml");
126
                    if (!Settings.Default.DebugLoggingEnabled)
127
                        debugAppender.Threshold = Level.Off;
128
                    debugAppender.ActivateOptions();
129
                }
115 130
            }
116 131
            catch (Exception exc)
117 132
            {

Also available in: Unified diff