log4net: No layout set for the appender named

I recently created a new ASP.NET web project and set it up to use log4net with a RollingFileAppender as its logging framework. However, at first my log file wasn't showing up at all and then after I got it showing up, my log statements were not being written. Fixing this involved two steps.

First, the DLL reference generated by Visual Studio did not automatically set the log4net assembly to copy local. Setting this property on the reference solved the issue of my log file not appearing.

Second, now that I had my file, I was not seeing any log statements written to it. Debugging the process, I saw the following error output from log4net:

AppenderSkeleton: No layout set for the appender named

Looking at my configuration file, I saw that I was setting an appender layout. However, I noticed that my appender layout was based on a type defined in a different project. Checking the reference to that project, I again found that Visual Studio was not copying a local version of the assembly, i.e. the Private flag was set to false. Switching this flag to true fixed the problem and now my logs are showing up!


Recent posts