Oh one more thing, I have this line in my Application_Start event handler: log4net.Config.XmlConfigurator.Configure();
On Mon, Jan 4, 2010 at 5:00 PM, Mike Christensen <[email protected]> wrote: > I've decided my time is spent trying to get log4net to work, however > something I'm doing is wrong.. I've added this line to my > configSections in web.config: > > <section name="log4net" > type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> > > Then I've added this section: > > <log4net> > <appender name="trace" type="log4net.Appender.DebugAppender, log4net"> > <layout type="log4net.Layout.PatternLayout,log4net"> > <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] > <%P{user}> - %m%n" /> > </layout> > </appender> > > <appender name="NHibernate.SQL"> > <appender-ref name="trace" /> > </appender> > </log4net> > > > Yet, when I run an ActiveRecord query, I don't see anything in the > output window nor do I get any errors. I do have log4net.dll in my > bin directory of the application. Any ideas? > > Mike > > On Mon, Jan 4, 2010 at 4:13 PM, Mike Christensen <[email protected]> wrote: >> I've gotten the Console thing to work with: >> >> <add key="show_sql" value="true" > >> >> However, this doesn't work within a webapp. I've also seen some >> examples using log4net to log queries to a text file. Last I tried, >> this wouldn't work for me but I guess what I'm asking is how exactly >> does log4net do this? I assume NHibernate must call some delegate >> every time it fires off a SQL query, and log4net attaches to this. >> I'd like to write my own "mini-log4net" that just dumps the SQL to the >> Debug stream. How can I do this? >> >> Mike >> >> On Mon, Jan 4, 2010 at 4:03 PM, Ricardo Lopes <[email protected]> wrote: >>> You can enable NHibernate logging to the console or to a file >>> >>> 2010/1/4 Mike Christensen <[email protected]>: >>>> This should be a simple question, but what's the best and easiest way >>>> to get a view of all SQL queries being run? I was able to turn on a >>>> debug mode that would write queries to Console, but this no longer >>>> works when you're writing a web app. If I could just Debug.WriteLine >>>> each query that would be awesome. Is there like an event I can attach >>>> to or something? Thanks! >>>> >>>> Mike >>>> >>>> -- >>>> >>>> You received this message because you are subscribed to the Google Groups >>>> "Castle Project Users" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/castle-project-users?hl=en. >>>> >>>> >>>> >>> >>> >>> >>> -- >>> >>> Ricardo Lopes >>> >>> -- >>> >>> You received this message because you are subscribed to the Google Groups >>> "Castle Project Users" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/castle-project-users?hl=en. >>> >>> >>> >> > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
