I have the following sample code that works fine:
public static void Main()
{
var traceListener = new FlatFileTraceListener("unifylogging.log",
"--------------------",
"-----------------------------");
var config = new LoggingConfiguration();
config.AddLogSource("My Log Source", SourceLevels.All, true).AddTraceListener(traceListener);
var logger = new LogWriter(config);
logger.Write("This is a test");
}
However, if I change the logger.Write
call to one pulled straight from the manual it doesn't write anything:
logger.Write("Log entry with a category, priority, event ID,severity, and title.",
"General",
8,
9003,
TraceEventType.Warning,
"Logging Block Examples");
I have also tried this with the ConsoleTraceListener
, and with some of the other overloads of the Write
methods including:
logger.Write("Hello from unify", "Cat1");
logger.Write("Hello from unify", new[] { "Cat1" });
The only one that works is the Write(string)
.
NB The suggested duplicate is with regards to Workflow Foundation and seems to be about the
System.Diagnostics.Trace
tracing. This is about Unify Logging.