Ray,
> When you say "place all the assemblies within the same
> logging repository (AKA domain)" could you show me an example
> config file of that?
Not really. The repositories are one level above the config files. Each
repository must be configured and you can do this with a config file.
The config file does not control, create or in anyway influence the
repositories.
I think I am just confusing you. Lets just say that in 1.2.9 by default
there is only 1 repository and therefore you can safely forget all about
repositories or the possibility that you may have more than 1
repository.
The basic config you need to output everything logged into log4net is:
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="log-file.txt" />
<layout type="log4net.Layout.PatternLayout" value="%date [%thread]
%-5level %logger - %message%newline" />
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
> Also, should I stop using the getType
> method for specifying a logger, or should I switch to
> something like "ReanneCorp.Common.Library.Mail"?
I would recommend naming the logger for a type with the type name. This
is just the simplest way of thinking out loggers and usually the type
namespace is a good functional breakdown which can be used to control
what is logged.
I store the logger as a static member in the class like this:
private static readonly log4net.ILog log =
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMeth
od().DeclaringType);
I use reflection to get the type name so that I don't have to remember
to update the GetLogger line if I copy it into another class or rename
the class.
Cheers,
Nicko
>
> Regards,
>
> Ray Simpson
>
>
>
> >Ray,
>
> >The default behaviour of the DefaultRepoisotrySelector has
> been changed
> >to (unless otherwise specified) place all the assemblies within the
> >same logging repository (AKA domain). If you are still using log4net
> >1.2 beta
> >5 I suggest you upgrade to log4net 1.2.9.
>
> >http://logging.apache.org/log4net/downloads.html
>
> >If you want to enable log4net internal debug then rather than using
> ><log4net debug="true"> it is preferable to add the
> appSettings entry as
> >follows:
>
> ><appSettings>
> > <add key="log4net.Internal.Debug" value="true"/> </appSettings>
> >
> >This method enables internal debug earlier and log4net will
> print out
> >its version number, etc...
>
> >Also the sourceforge lists are currently closed as log4net
> has moved to
> >Apache. The best place to ask questions is on the
> log4net-users list @
> >apache, for details see:
>
> >http://logging.apache.org/log4net/support.html
>
> >Cheers,
>
> >Nicko
>
> >-----Original Message-----
> >From: [EMAIL PROTECTED]
> >[mailto:[EMAIL PROTECTED] On Behalf Of Ray
> >Simpson
> >Sent: 23 June 2005 02:41
> >To: [EMAIL PROTECTED]
> >Subject: [Log4net-users] Domains of other object types not
> showing up..
> >
> >I am using log4net in my web application. It loads the config fine,
> >and generates log entries for the main web application, but my
> >supporting libraries all have log statements in them that are not
> >showing up. I read about setting up loggers for certain
> domains with
> >in your application, but I have a lot of libraries and what I really
> >want is a solution to add into my config file that will put ALL the
> >items into one big log file. This worked in 1.1.1 but I
> started having
> >issues and I moved to the 1.2.5 beta which seemed to fix a lot of
> >problems, but now this is happening. Included is my web
> config and all
> >the error messages I get (running log4net in debug
> >mode):
> >
> > <log4net debug="true">
> >
> > <appender name="RollingLogFileAppender"
> >type="log4net.Appender.RollingFileAppender">
> > <param name="File" value="C:\\Import\\LogFile.txt" />
> > <param name="AppendToFile" value="true" />
> > <param name="RollingStyle" value="Date" />
> > <param name="DatePattern" value="yyyyMMdd" />
> > <param name="StaticLogFileName" value="true" />
> > <layout type="log4net.Layout.PatternLayout">
> > <param name="ConversionPattern"
> value="%d [%t] %-5p %c [%x] - %m%n" />
> > </layout>
> > </appender>
> >
> > <!-- Setup the root category, add the appenders and set
> the default
> >level
> >-->
> >
> > <root>
> > <priority value="DEBUG" />
> > <appender-ref ref="RollingLogFileAppender" />
> > </root>
> ></log4net>
> >log4net: DefaultRepositorySelector: Creating repository for assembly
> >[ReanneCorp.Common.Security.AccessControl, Version=1.0.2000.26723,
> >Culture=neutral, PublicKeyToken=null]
> >log4net: DefaultRepositorySelector: Assembly
> >[ReanneCorp.Common.Security.AccessControl, Version=1.0.2000.26723,
> >Culture=neutral, PublicKeyToken=null] does not have a
> DomainAttribute
> >specified
> >log4net: DefaultRepositorySelector: Assembly
> >[ReanneCorp.Common.Security.AccessControl, Version=1.0.2000.26723,
> >Culture=neutral, PublicKeyToken=null] using domain
> >[ReanneCorp.Common.Security.AccessControl] and repository type
> >[log4net.Repository.Hierarchy.Hierarchy]
> >log4net: DefaultRepositorySelector: Creating repository for domain
> >[ReanneCorp.Common.Security.AccessControl] using type
> >[log4net.Repository.Hierarchy.Hierarchy]
> >log4net:ERROR Logger: No appenders could be found for logger
> >[ReanneCorp.Common.Security.AccessControl.DAO.ACUserDAO]
> >log4net:ERROR Logger: Please initialize the log4net system properly.
> >log4net: DefaultRepositorySelector: Creating repository for assembly
> >[ReanneCorp.Library.IDWeb, Version=1.0.2000.26789, Culture=neutral,
> >PublicKeyToken=null]
> >log4net: DefaultRepositorySelector: Assembly
> [ReanneCorp.Library.IDWeb,
> >Version=1.0.2000.26789, Culture=neutral,
> PublicKeyToken=null] does not
> >have a DomainAttribute specified
> >log4net: DefaultRepositorySelector: Assembly
> [ReanneCorp.Library.IDWeb,
> >Version=1.0.2000.26789, Culture=neutral, PublicKeyToken=null] using
> >domain [ReanneCorp.Library.IDWeb] and repository type
> >[log4net.Repository.Hierarchy.Hierarchy]
> >log4net: DefaultRepositorySelector: Creating repository for domain
> >[ReanneCorp.Library.IDWeb] using type
> >[log4net.Repository.Hierarchy.Hierarchy]
> >log4net:ERROR Logger: No appenders could be found for logger
> >[ReanneCorp.Library.IDWeb.Messages.DAO.PatronMessageDAO]
> >log4net:ERROR Logger: Please initialize the log4net system properly.
> >'/LM/W3SVC/1/Root/IDWeb-15-127640659445312500': Loaded
> >'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
> >files\idweb\1f9eed4a\d5aac827\ftbuswvl.dll', Symbols loaded.
> >'/LM/W3SVC/1/Root/IDWeb-15-127640659445312500': Loaded
> >'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
> >files\idweb\1f9eed4a\d5aac827\xej6d3wy.dll', Symbols loaded.
> >'/LM/W3SVC/1/Root/IDWeb-15-127640659445312500': Loaded
> >'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
> >files\idweb\1f9eed4a\d5aac827\jeiz9m2z.dll', Symbols loaded.
> >'/LM/W3SVC/1/Root/IDWeb-15-127640659445312500': Loaded
> >'c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net
> >files\idweb\1f9eed4a\d5aac827\d0-8yp2i.dll', Symbols loaded.
> >log4net: DefaultRepositorySelector: Creating repository for assembly
> >[ReanneCorp.Library.Demographics, Version=1.0.2000.26251,
> >Culture=neutral, PublicKeyToken=null]
> >log4net: DefaultRepositorySelector: Assembly
> >[ReanneCorp.Library.Demographics, Version=1.0.2000.26251,
> >Culture=neutral, PublicKeyToken=null] does not have a
> DomainAttribute
> >specified
> >log4net: DefaultRepositorySelector: Assembly
> >[ReanneCorp.Library.Demographics, Version=1.0.2000.26251,
> >Culture=neutral, PublicKeyToken=null] using domain
> >[ReanneCorp.Library.Demographics] and repository type
> >[log4net.Repository.Hierarchy.Hierarchy]
> >log4net: DefaultRepositorySelector: Creating repository for domain
> >[ReanneCorp.Library.Demographics] using type
> >[log4net.Repository.Hierarchy.Hierarchy]
> >log4net:ERROR Logger: No appenders could be found for logger
> >[ReanneCorp.Library.Demographics.DAO.PersonDAO]
> >log4net:ERROR Logger: Please initialize the log4net system properly.
> >
> >Any help would be greatly appreciated.
> >
> >Regards,
> >
> >Ray Simpson
> >
> >
>
>
>