You want to set configuration properties in log4net from codebehind. For example: ApplicationName, log file path or name etc.


Easiest way to do it is to use Global Context properties and log4net.Util.PatternString.

On your config file, use %property{ApplicationName} to access the value.

You can also access the logger or appender from code behind and set the properties.

Hope this helped. Happy Coding.

Setting log4net configuration properties from codebehind
Tagged on:

One thought on “Setting log4net configuration properties from codebehind

  • November 18, 2015 at 5:50 am

    Thanks I spent a lot of time to change applicationName from codebehind 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *