logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Hinkel" <Michael.Hin...@datatrak.net>
Subject RE: Log4net with .net 2.0 for com+ servicedcomponent
Date Tue, 07 Mar 2006 09:18:30 GMT
I've successfully set up log4net logging for a serviced component which
is hosted inside the IIS (.NET remoting service) using .NET 1.1.
To do this, the application (e.g. IIS) has to have write access to the
folder where the log file is to be created (this seems to be okay in
your setting).
Next, I've added the following log4net declaration in one class (e.g. a
base class of a class hierarchy) of each project which should use
[assembly: log4net.Config.Repository("Server")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile="Web.config")]

The repository name should be the name of the assembly - but if you use
several projects and therefore have several assemblies you have to use
the same repository name in each project (at least I needed to do this,
because otherwise only one assembly was able to successfully use
log4net, and the other silently failed).
You also have to find out the root folder of your component, which
depends on the application that uses your component.
Hope this information is not completely wrong and might be of any help
to you...

DATATRAK Deutschland GmbH
Michael Hinkel
Software Developer
Rochusstrasse 65
53123 Bonn

Tel +49 (228) 97983-602
Fax +49 (228) 97983-34
http://www.datatrak.net <http://www.datatrak.net/> 



From: Thomas, Cord [mailto:cthomas@rand.org] 
Sent: Monday, March 06, 2006 10:36 PM
To: log4net-user@logging.apache.org
Subject: Log4net with .net 2.0 for com+ servicedcomponent

I have a working c# exchange event sink (serviced component) that will
do things like autoaccept, log message activities in a database and
route messages.  I wanted to use log4net with this but am having
The core problem is that i am not getting any log messages (though i
tried various configurations)
log4net compiled from source in .net using NET_2_0 compile directive
Again, my component is doing work - and i can use a FileStream to write
to the ..\logs\CurrentLog directory - but not log4net - so, the
component has write access...
I am now going to try the log4net internal debugging - but wondered if i
had anything fundamentally wrong.  Below are my config and code
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config",
Watch = true)]
    using log4net
    using log4net.Config
    private static readonly ILog log =
       log.Debug("Some debug message");
       // also tried adding various entries of
XmlConfigurator.Configure with no luck
<?xml version="1.0" encoding="utf-8" ?>
  <appender name="RollingLogFileAppender"
    <file value="..\\logs\\CurrentLog" />
    <appendToFile value="true" />
    <datePattern value="yyyyMMdd" />
    <rollingStyle value="Date" />
    <filter type="log4net.Filter.LevelRangeFilter">
        <acceptOnMatch value="true" />
        <levelMin value="DEBUG" />
        <levelMax value="FATAL" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern  value="%-5p %d %5rms %-22.22c{1} %-18.18M -
%m%n" />
    <level value="DEBUG" />
    <appender-ref ref="RollingLogFileAppender" />
Cord Thomas
Information Services and Technology (IST)
1776 Main Street
Santa Monica CA 90407
Phone: 310.393.0411 x6672
e-mail: cthomas@rand.org


This email message is for the sole use of the intended recipient(s) and
may contain privileged information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message. 


View raw message