Hallo,
Hat jemand von euch schon einmal einen eigenen Switch zum steuern der TracingLevel in .NET erstellt?
Bei mir will es einfach nicht funktionieren. Er setzt den in der Konfigurationsdatei festgelegten Wert (hier 3, also Error) für meinen Switch nicht und hat damit immer den Standardlevel 0 (hier Off).
Konfigurationsdatei:
<?xml version="1.0" encoding="Windows-1252"?>
Eigener Switch:
enum MySwitchLevel
{
Off=0,
Info=1,
SQL=2,
Error=3,
StackTrace=4,
}
class MySwitch:Switch
{
protected MySwitchLevel m\_Level;
public MySwitch(string displayName, string description):base(displayName, description){}
public MySwitchLevel Level
{
get
{
return(m\_Level);
}
set
{
SwitchSetting((int)value);
}
}
public bool Off
{
get
{
return(m\_Level == 0);
}
}
public bool Info
{
get
{
return((int) m\_Level == (int) (MySwitchLevel.Info));
}
}
public bool SQL
{
get
{
return((int) m\_Level == (int) (MySwitchLevel.SQL));
}
}
public bool Error
{
get
{
return((int) m\_Level == (int) (MySwitchLevel.Error));
}
}
public bool StackTrace {
get {
return((int) m\_Level == (int) (MySwitchLevel.StackTrace));
}
}
protected void SwitchSetting(int value)
{
if (value 4) value = 4;
m\_Level = (MySwitchLevel) value;
}
}