Log4net configuration from assembly attribute does not load configuration file

I also have trouble with this method of boostrapping log4net. The documentation says you have to make a call very early in your application startup

if you use configuration attributes you must invoke log4net to allow it to read the attributes. A simple call to LogManager.GetLogger will cause the attributes on the calling assembly to be read and processed. Therefore it is imperative to make a logging call as early as possible during the application start-up, and certainly before any external assemblies have been loaded and invoked.

Try placing a logger in the same class that starts your application (program.cs, app.xaml, whatever). For example

private static readonly ILog Log = LogManager.GetLogger(typeof(Program));

And for kicks, make any call to the log (even one that is filtered or evaluated out of the append process, it should force log4net to evaluate your repository/heirarchy).

static Program()
{
    Log.Debug("Application loaded.");
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)