Try our conversational search powered by Generative AI!

Log4Net troubles

Vote:
 

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?

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?

#35313
Dec 03, 2009 16:31
Vote:
 

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.

#35323
Dec 04, 2009 11:06
Vote:
 

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

#35335
Dec 07, 2009 9:39
Vote:
 

I  had the same problem with a faulty custom made Page Provider.

#35336
Dec 07, 2009 11:00
Vote:
 

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?

#35385
Dec 08, 2009 17:37
Vote:
 

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.

#35386
Dec 08, 2009 17:48
Vote:
 

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

#35387
Dec 08, 2009 18:03
Vote:
 

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)?

#35388
Dec 08, 2009 18:12
Vote:
 
#35392
Dec 08, 2009 22:27
Vote:
 

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! 

#35480
Edited, Dec 11, 2009 15:55
Vote:
 

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.

#61069
Edited, Sep 06, 2012 8:42
Vote:
 

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.

#64827
Jan 10, 2013 21:24
Vote:
 

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. 

#70442
Apr 19, 2013 14:42
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.