My application is separated in layers. I want to use NLog at the lowest level: the data layer. In fact, it works perfectly. The configuration file is loaded and I can see the output in a text file without any problem, WHEN I call my datalayer from a Win32 project. For exemple, when running unit tests, my logs are alright. Also when calling my datalayer from a Win32 project, everything is perfect. The problem is when I call the same functions, from an ASP.Net project. In a WebApplication or a WebService, there's no output. I used a breakpoint before writting to the log files and I see that the configuration is null. Also IsTraceEnabled, IsFatalEnabled, etc are all set to false.
I tried everything I can think of, including giving Full Control to "Everyone" in the security, always without success.
I am using nlog dll for silverlight. The Nlog config file is in web
project, as its gets copied to bin. Please let me know what I m
missing.
Thanks for great support.
On 8/1/12, Jason LaFlair [via NLog Forum]
<[hidden email]> wrote:
Hi Jason,
I have added new configuration in the silverlight application as below. Tried to log the info however could not do so.
Is is mandatory to add the web service to transfer the data from silverlight to web application? Your help will be helpful to me.
SimpleConfigurator.ConfigureForTargetLogging(
new FileTarget
{
FileName = "E:\\MyLog.txt",
Layout = new CsvLayout()
{
Columns =
{
new CsvColumn("Time", "${longdate}"),
new CsvColumn("Level", "${level}"),
new CsvColumn("Lessage", "${message}"),
new CsvColumn("Logger", "${logger}"),
},
}
},
LogLevel.Debug);