0 votes

When logging in ASP.NET (not using the log4net.dll) everything works great and the logs come out nice. But when doing the same (with the same code )in a console application it throws an exception saying it cant find log4net.dll.

I use:

Limilabs.Mail.Log.Enabled = true; 
LimilabsListener ml = new LimilabsListener(); 
/*extends TextWriterTraceListener */
Trace.Listeners.Add(ml);
Trace.AutoFlush = true;

Do I need the log4net.dll in this case ? If so where can I find it?

by

1 Answer

0 votes

There is no difference in how logging works depending on technology you use.

It seems, that your Visual Studio is configured in such way, that it shows caught exceptions handled internally by Mail.dll (e.g. handled exception that log4net is not found). You should simply continue program execution or configure your IDE correctly.

Do I need the log4net.dll in this case ?

Mail.dll uses "soft" reference to log4net - if it is not found, it is not used nor required. This is a common practice in using logging tools.

If you don't want to use log4net, you can use standard Visual Studio’s trace output window or Trace.Listeners collection as described here:
https://www.limilabs.com/blog/logging-in-mail-dll

If so where can I find it?

log4net can be downloaded through log4net website, or from nuget.

by (297k points)
...