November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Make sure that you don't have more then one log4net-log running at the same time. I've seen this behavior when I was using Composer and the dropit.extension.config in the bin folder and was trying to get the ordinary episerver log to run.
Use Debug View from System Internals to see what log4net logs during start-up. Also make sure you do not define a class wide logger (typically ILog _log in global.asax.cs).
Also see "How do I enable log4net internal debugging?" on: http://logging.apache.org/log4net/release/faq.html
/Steve
Thanks for your replies. I found a class logger in the global.asax which I removed. but still there seems to be a problem with something hold on to the logfile. Might there also be a problem with class loggers in files deriving from EPiServer.PlugIn.PlugInAttribute?
Do you have classes inheriting from that attribute? Why?
Would not think that having loggers in such a class should give you problems. Did you get any results from the internal debugging? Have you tried System Internals Debug View? Any problems parsing logging config files should show up there.
Does your global class inherit from EPiServer.Global?
Btw. you should not have any log4net configurations in web.config at all. EPiServer hooks up log4net using an attribute in episerver.dll.
We use the class deriving from that attribute to run some code when the site is starting. se this link http://labs.episerver.com/en/Blogs/Allan/Dates/112230/3/When-and-Where-to-attach-DataFactory-Event-Handlers/. From the debug information from log4net we found that there was a problem that something has a lock on the file ...And that something seems to be the application. So now we just need to figure out where :)
Our global inherits EPiServer.Global... and the trick with stuffing the log4net configuration in the web.config file has worked sometimes on other sites where logging stopped working... don't know why tho
Hm,
you have the episerver.dll in you bin folder (in addition to GAC)?
Is this an enterprise site? Are there more than one site pointing to the same place on disk (using the same episerverlog.config)?
Try and log log4net?
http://labs.dropit.se/blogs/post/2009/10/14/How-to-log-log4net.aspx
Thats about the same as Steve suggested above...
Removing the class logger from the classes deriving from PlugInAttribute seemed to get things working again.
Cheers for all help and insight!
I also have issues with log4net, but little bit different. log4net logs everything, but not my custom classes. Tried to explicitly configure logger to log my namescpace:
<logger name="My.Website.Business">
<level value="All" />
</logger>
I am defining logger in my custom class like this:
ILog log = LogManager.GetLogger(typeof(MyClass));
And call it:
log.Error("Some error");
I also enabled log4net logging itself to see what happens on startup, but there are no errors or strange behaviour. It even creates logger defined in config. I also tried to define other appender for my logger, but it just creates empty file and doesn't log anything.
I have other 3d party components in project like NHibernate and those logs fine to same log.
My issue with log4net was related to different log4net versions between my application and EPiServer. EPiServer uses 1.2.10, but I had upgraded log4net to 1.2.11 (2.0) which are not compatible. So EPiServer logs fine, but my application didn't log anything. After downgrading log4net logging started to work fine.
I had same issue and thanks to Maris it is now resolved. We updated to latest log4net midway through a project. This explains why logging suddenly stopped working.
We are currently experiencing some issues with getting error logging to work at a client site. We have both tried the default EPiServerLog.config that comes with the default install and replacing the file with the simpler one listed here http://world.episerver.com/en/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-SP2/Logging-in-EPiServer-CMS-5/#_Toc136766750
Our problem is that nothing is written to the log file. That is…the logfile is created but no log entries end up in the log.
Any tips on how to trouble shoot this?