String path1 = (typeof(Class1)).Location S = "C:\\HomeAutomation\\Log4Net_DLL_Testing\\TestDll\\TestDll\\bin\\Debug\\nfig" Explicitly set the path though we should use any of the method shown here Private static readonly log4net.ILog log = (().DeclaringType) Because nfig should be located in the same folder where the DLL is located. If we know the path of the DLL loader application then we can use the path and copy the config there by visual studio build event for example. It is very easy to log data by following the steps:Īdd an nfig file in the DLL project: Īdd the log4net dll as reference to the projectĬonfigure the log4net in the main class of your DLL project, in my case it is Class1 is the main class and I have initialized the log4net here. In this case log file is captured for an application such as windows DLL that is loaded by another application, Īdd the log4net DLL as a reference to the projectĬall the following method during starting the application, a suitable place could be when we call the main method (for example) In this case, we have log file in the temp folder. If we want to create the log file to a particular directory we can change like the following though can’t be used in the config file. It is very easy to log data by following the steps:Īdd an App.config file, here is an example: This is very important to log data during run time. Log4net has used in windows applications to captured log data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |