Revision 6f03d6e1 trunk/Pithos.Client.WPF/Configuration/PithosSettings.cs
b/trunk/Pithos.Client.WPF/Configuration/PithosSettings.cs | ||
---|---|---|
41 | 41 |
#endregion |
42 | 42 |
using System.ComponentModel.Composition; |
43 | 43 |
using System.Diagnostics; |
44 |
using System.IO; |
|
45 |
using System.Linq; |
|
44 | 46 |
using Pithos.Client.WPF.Properties; |
45 | 47 |
using Pithos.Interfaces; |
48 |
using log4net.Appender; |
|
49 |
using log4net.Core; |
|
50 |
using log4net.Repository.Hierarchy; |
|
46 | 51 |
|
47 | 52 |
namespace Pithos.Client.WPF.Configuration |
48 | 53 |
{ |
... | ... | |
236 | 241 |
get { return _settings.UpdateForceCheck; } |
237 | 242 |
} |
238 | 243 |
|
244 |
public bool DebugLoggingEnabled |
|
245 |
{ |
|
246 |
get { return _settings.DebugLoggingEnabled; } |
|
247 |
set |
|
248 |
{ |
|
249 |
_settings.DebugLoggingEnabled = value; |
|
250 |
|
|
251 |
SetDebugLevel(); |
|
252 |
} |
|
253 |
} |
|
254 |
|
|
255 |
private static void SetDebugLevel() |
|
256 |
{ |
|
257 |
var loggerRepository = (Hierarchy) log4net.LogManager.GetRepository(); |
|
258 |
|
|
259 |
var appenders = loggerRepository.GetAppenders(); |
|
260 |
|
|
261 |
var debugAppender = appenders.OfType<RollingFileAppender>() |
|
262 |
.FirstOrDefault(a => a.Name == "DebugFileAppender"); |
|
263 |
if (debugAppender != null) |
|
264 |
{ |
|
265 |
var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); |
|
266 |
var pithosDataPath = Path.Combine(appDataPath, "GRNET"); |
|
267 |
debugAppender.File = Path.Combine(pithosDataPath, "debuglog.xml"); |
|
268 |
debugAppender.Threshold = !Settings.Default.DebugLoggingEnabled ? Level.Off : Level.All; |
|
269 |
debugAppender.ActivateOptions(); |
|
270 |
} |
|
271 |
} |
|
272 |
|
|
239 | 273 |
public void Save() |
240 | 274 |
{ |
241 | 275 |
_settings.Save(); |
Also available in: Unified diff