Hi all. This probably has a glaringly obvious solution, but I'm not
seeing it. I'm using only DLLs that I got from building the trunk this
evening - that includes log4net itself.
Basically, my log statements aren't doing anything. There's no error
but it just fails to output. If I check the values of the ILogger's "Is
[LogLevel]Enabled" properties, all are false.
Switching the logger API to "console" causes logging to work as
expected, so it seems to just be a problem with configuring log4net. I
don't see where though, so I'm wondering if I'm doing something wrong
with Windsor.
Do I need to explicitly tell log4net to configure itself using
log4net.config? I would think not, if I'm specifying it in the Castle
configuration, but I'm out of ideas.
Thanks in advance for any help!
App.config:
<configuration>
<configSections>
<section name="castle"
type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,
Castle.Windsor" />
</configSections>
<castle>
<facilities>
<facility id="logging"
type="Castle.Facilities.Logging.LoggingFacility,
Castle.Facilities.Logging"
loggingApi="log4net"
configFile="log4net.config" />
</facilities>
<components>
<component id="test"
type="Obsidian.TestComponent,
Obsidian">
<parameters>
<Name>Test Value</Name>
</parameters>
</component>
</components>
</castle>
</configuration>
log4net.config:
<configuration>
<log4net>
<appender name="console"
type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread]
%-5level %logger
[%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="console" />
</root>
</log4net>
</configuration>
Relevant code:
IWindsorContainer container = new WindsorContainer(new
XmlInterpreter());
// Test Castle initialization of component
TestComponent comp = container.Resolve<TestComponent>();
Console.WriteLine(comp.Name);
// The above prints "Test Value" as expected
// Test logger
ILogger logger = comp.Logger;
Console.WriteLine(logger.GetType().FullName);
// The above prints
"Castle.Services.Logging.Log4netIntegration.Log4netLogger", as
expected
// The following print nothing, unless I set loggingApi to
"console"
logger.Error("Test Error");
logger.Warn("Test Warn");
logger.Debug("Test Debug");
logger.Info("Test Info");
public class TestComponent
{
private ILogger logger = NullLogger.Instance;
public TestComponent() { }
public ILogger Logger
{
get { return logger; }
set { logger = value; }
}
public string Name
{
get;
set;
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---