Have you got the logging.config set up? Does logging work for you elsewhere
in your code?

On Tue, Oct 7, 2008 at 1:17 AM, <[EMAIL PROTECTED]> wrote:

>
> I am currently using the Trunk and I was trying to turn on logging to
> research Controller.DeliverEmail(Message message) method, and noticed
> that
> logging at the Controller level was not working.
> Historically, the method  InitializeFieldsFromServiceProvider method
> initialized logging.
>
> I was able to get logging to work in my private controllers by adding:
> ILoggerFactory loggerFactory =
> (ILoggerFactory)this.Context.GetService(typeof(ILoggerFactory));
>
>            if (loggerFactory != null)
>            {
>                Logger = loggerFactory.Create(GetType());
>
>            }
>
> Currently however, Logger in Controller.cs is set to
> NullLogger.Instance in the declaration section, and does not get
> initialized.
> I'm not sure if this is a bug or if there is a way to initialize
> Logger in Controller.cs to in order to log exceptions ?
> Note: I do have logging working just not for this class:
> Controller.cs.
>
> Using this MonoRail config section:
>
> <monorail smtpHost="localhost" smtpPort="25">
>    <controllers>
>      <assembly>MyAssembly</assembly>
>      <assembly>Castle.MonoRail.ViewComponents</assembly>
>    </controllers>
>    <viewEngine viewPathRoot="Views"
>
> customEngine="Castle.MonoRail.Framework.Views.NVelocity.NVelocityViewEngine,
> Castle.MonoRail.Framework.Views.NVelocity" />
>    <services>
>      <service id="Custom"
> interface="Castle.Core.Logging.ILoggerFactory, Castle.Core"
> type="Castle.Services.Logging.Log4netIntegration.Log4netFactory,
> Castle.Services.Logging.Log4netIntegration"/>
>    </services>
>  </monorail>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to