I'm trying to add log4net logging to a web application. I have found this in the web service method:
log4net.config.xmlConfigurator.Configure (); Log4net.ilog log = log4net.LogManager.GetLogger (typef (method)); Logs. Information ("some information"); And it is in the web.config file:
& lt; ConfigSections & gt; & Lt; Section name = "log4net" type = "log4net.config.loginNetConfigurationSectionHandler, log4net" /> & Lt; / ConfigSections & gt; & Lt; System.web & gt; & Lt; Compilation debug = "true" targetFramework = "4.0" /> & Lt; Authentication mode = "Windows" /> & Lt; Identification impersonation = "true" /> & Lt; /system.web> & Lt; Log4net & gt; & Lt; Appender name = "logfile uploader" type = "log4net.updater.rolfile apder" & gt; & Lt; File value = "log.txt" /> & Lt; AppendToFile value = "true" /> & Lt; Rolling style value = "size" /> & Lt; MaxSizeRollBackups value = "10" /> & Lt; Max file type value = "1MB" /> & Lt; StaticLogFileName value = "true" /> & Lt; Layout type = "log4net.layout.SimpleLayout" /> & Lt; / Appender & gt; & Lt; Root & gt; & Lt; Level value = "ALL" /> & Lt; Appender-Rif ref = "LogfileUpdate" /> & Lt; / Root & gt; & Lt; / Log4net & gt; I was hoping for a log file when I debug it through Visual Studio 2010, but nothing is written there. The method runs successfully without any exception, but I did not get the log file. Any ideas where it should look?
Editing - Some additional information: According to the notification area icon, ASP.NET is running on the development server:
c: \ user \ jpope \ document \ visual studio 2010 / Projects \ WebApplication1 \ WebApplication1 \ To give permission on this directory and \ bin \ subdirectories, full control is given to me and administrator, and no one else Also does not access The log file is not in the above directory or \ bin \ sub-directory.
If you are lowered into some low-level goods, it will be interesting to see if you think that Trying to write the web server process at least it would be more fun than wading through log4net documentation.
Comments
Post a Comment