Hi,
I have configured tracing within my app so that users can define a trace level within a xml config file. When the app starts it reads the config and sets the trace level accordingly.
What I would like to do is have different log files generated depending on the trace that gets initiated.
For example, if an error then log to an errors log or if just info then to a different log.
I played around with this and can get different logs created however they contain the same trace information. E.g. error and info in the same file.
I know I could just create my own logging class but I thought that perhaps this would be cleaner and easier??
Thanks in advance for your advice.
I have configured tracing within my app so that users can define a trace level within a xml config file. When the app starts it reads the config and sets the trace level accordingly.
VB.NET:
Public TraceSwitch As New TraceSwitch("MyTraceSwitch", "Sets the trace level in this application")
Form_Load(.....)
Dim MyListener As TextWriterTraceListener
'Set the initial trace level. Just in case the config load throws an error.
TraceSwitch.Level = TraceLevel.Info
'then later in form_load....
MyListener = New TextWriterTraceListener(My.Settings.LogPath & My.Settings.MessagesFile)
Trace.Listeners.Add(MyListener)
Trace.AutoFlush = True
TraceSwitch.Level = CType(XMLConfig.DebugLevel, Integer)
For example, if an error then log to an errors log or if just info then to a different log.
I played around with this and can get different logs created however they contain the same trace information. E.g. error and info in the same file.
I know I could just create my own logging class but I thought that perhaps this would be cleaner and easier??
Thanks in advance for your advice.