I am using VS2005, a website project, a web deployment project and Log4Net. I can use logging when I am developing locally. I can see the log files and everything is fine. When I build my website, (using the web deployment project), I use the deploy as a single DLL option. When I then check the locations of where my log files should be I cannot see any files.
Is there a way to troubleshoot this. I don't think adding the debug value to the App Settings will help because I don't have a console because it is a website.
EDIT I don't want the 150 rep to go to waste so one last time. I compared the internal trace from my dev environment to the trace from the production. My dev environment trace shows the call the Xml Configurator where the production one does not. I have code in the global.asax on application_start() method. I put debug code in there and it is getting called in dev but not in production.
I think this is where the web deployment project is causing some issues. Does the global.asax get compiled into the single DLL? When I do a build in the deployment directory I see a global.compiled file. Must this go into the bin folder in production? Or is the global.asax code in the single DLL? Having both in the bin folder or the just the DLL didn't change anything.
You can configure the log4net. config file to create log files. The file is located in the webroot\App_data directory of the installation.
RollingFileAppender can roll log files based on size or date or both depending on the setting of the RollingStyle property. When set to Size the log file will be rolled once its size exceeds the MaximumFileSize.
NET Standard (2.0. 7 and beyond). In fact, I can use Log4Net alongside the default logging API for . NET Core: Microsoft.
Fixed. Add the user (which was start the IIS work process) with 'write' rights in 'Properties -> Security -> Edit' for project folder where should be created "Log" file.
Does the worker process have sufficient privileges to write to the log directory? I'm guessing that's not the case. You might want to give the worker process group rights to write to the directory and see if that fixes your problem.
Add this in AssemblyInfo.cs file and check
[assembly: log4net.Config.XmlConfigurator(Watch=true)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With