You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by mattyboy <ma...@spdprintsolutions.com> on 2009/09/02 10:24:01 UTC
Log4Net Repository
Hi,
I'm new to Log4Net having stumbled across it by accident. I've managed to
get a single .Net assembly logging to a file using the RollingFileAppender.
This works fine and I'm happy with it but what I REALLY want to do is have
multiple .Net assemblies logging to the same log file. Having looked at the
documentation I think I should be using a Repository to do this but I can't
find any decent examples of how this is done.
Can anyone supply me with any examples/urls etc. that would point me in the
right direction?
Many Thanks
Here's the config. file I'm using at the moment for a single assembly:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="ClaymoreAppender"
type="log4net.Appender.RollingFileAppender">
<file value="C:\Program Files\Claymore\Claymore.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="3" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level - [Claymore]
%message%newline" />
</layout>
</appender>
<logger name="ClaymoreLogger">
<!--<level value="INFO" />-->
<!--<level value="DEBUG" />-->
<level value="INFO" />
<appender-ref ref="ClaymoreAppender" />
</logger>
</log4net>
</configuration>
--
View this message in context: http://www.nabble.com/Log4Net-Repository-tp25253481p25253481.html
Sent from the Log4net - Users mailing list archive at Nabble.com.
RE: Log4Net Repository
Posted by mattyboy <ma...@spdprintsolutions.com>.
Hi Wolfgang,
I've got it to work thanks. I didn't realise it would be that easy!!!
Thanks for pointing me in the right direction.
Matt
Wolfgang Trog wrote:
>
> Hi Mattyboy,
>
> as long as you use the same logger in all your assemblies, everything will
> be logged in the same file:
>
> ILog logger = LogManager.GetLogger("ClaymoreLogger");
> logger.Info(.....)
>
>
> Hope that helps,
> Wolfgang
>
> -----Original Message-----
> From: mattyboy [mailto:mattm@spdprintsolutions.com]
> Sent: Mittwoch, 2. September 2009 10:24
> To: log4net-user@logging.apache.org
> Subject: Log4Net Repository
>
>
> Hi,
>
> I'm new to Log4Net having stumbled across it by accident. I've managed to
> get a single .Net assembly logging to a file using the
> RollingFileAppender.
> This works fine and I'm happy with it but what I REALLY want to do is have
> multiple .Net assemblies logging to the same log file. Having looked at
> the
> documentation I think I should be using a Repository to do this but I
> can't
> find any decent examples of how this is done.
>
> Can anyone supply me with any examples/urls etc. that would point me in
> the
> right direction?
>
> Many Thanks
>
>
> Here's the config. file I'm using at the moment for a single assembly:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <configSections>
> <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
> </configSections>
> <log4net>
>
> <appender name="ClaymoreAppender"
> type="log4net.Appender.RollingFileAppender">
> <file value="C:\Program Files\Claymore\Claymore.log" />
> <appendToFile value="true" />
> <rollingStyle value="Size" />
> <maxSizeRollBackups value="3" />
> <maximumFileSize value="100KB" />
> <staticLogFileName value="true" />
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%date [%thread] %-5level - [Claymore]
> %message%newline" />
> </layout>
> </appender>
> <logger name="ClaymoreLogger">
> <!--<level value="INFO" />-->
> <!--<level value="DEBUG" />-->
> <level value="INFO" />
> <appender-ref ref="ClaymoreAppender" />
> </logger>
> </log4net>
> </configuration>
>
>
> --
> View this message in context:
> http://www.nabble.com/Log4Net-Repository-tp25253481p25253481.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>
>
>
--
View this message in context: http://www.nabble.com/Log4Net-Repository---Use-same-log-file-for-multiple-Assemblies-tp25253481p25254926.html
Sent from the Log4net - Users mailing list archive at Nabble.com.
RE: Log4Net Repository
Posted by Neil Haughton <Ne...@autoscribe.co.uk>.
Hi all,
Which implies that the answer to the other question (how to log
different assemblies to different files) is to use a different logger in
each assembly. Is there a more elegant way?
Regards,
Neil Haughton
**********************************************************DISCLAIMER****
*************************************************
The contents of this email are confidential and are intended solely for
the use of the individual or company to
whom it is addressed. If you have received this email in error then
please accept our apology. If this is the case
we would be obliged if you would contact the sender and then delete this
email. Opinions expressed in this email
are those of the individual and do not necessarily represent the
opinions of Autoscribe Ltd. Although this email
and any attachments are believed to be free of any virus no
responsibility is accepted by Autoscribe Ltd for any
loss or damage arising in any way from the receipt or use of this email
or attachments.
************************************************************************
*********************************************************
-----Original Message-----
From: Wolfgang [mailto:wolfgang@wollinet.com]
Sent: 02 September 2009 09:39
To: 'Log4NET User'
Subject: RE: Log4Net Repository
Hi Mattyboy,
as long as you use the same logger in all your assemblies, everything
will
be logged in the same file:
ILog logger = LogManager.GetLogger("ClaymoreLogger");
logger.Info(.....)
Hope that helps,
Wolfgang
-----Original Message-----
From: mattyboy [mailto:mattm@spdprintsolutions.com]
Sent: Mittwoch, 2. September 2009 10:24
To: log4net-user@logging.apache.org
Subject: Log4Net Repository
Hi,
I'm new to Log4Net having stumbled across it by accident. I've managed
to
get a single .Net assembly logging to a file using the
RollingFileAppender.
This works fine and I'm happy with it but what I REALLY want to do is
have
multiple .Net assemblies logging to the same log file. Having looked at
the
documentation I think I should be using a Repository to do this but I
can't
find any decent examples of how this is done.
Can anyone supply me with any examples/urls etc. that would point me in
the
right direction?
Many Thanks
Here's the config. file I'm using at the moment for a single assembly:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="ClaymoreAppender"
type="log4net.Appender.RollingFileAppender">
<file value="C:\Program Files\Claymore\Claymore.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="3" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level - [Claymore]
%message%newline" />
</layout>
</appender>
<logger name="ClaymoreLogger">
<!--<level value="INFO" />-->
<!--<level value="DEBUG" />-->
<level value="INFO" />
<appender-ref ref="ClaymoreAppender" />
</logger>
</log4net>
</configuration>
--
View this message in context:
http://www.nabble.com/Log4Net-Repository-tp25253481p25253481.html
Sent from the Log4net - Users mailing list archive at Nabble.com.
RE: Log4Net Repository
Posted by Wolfgang <wo...@wollinet.com>.
Hi Mattyboy,
as long as you use the same logger in all your assemblies, everything will
be logged in the same file:
ILog logger = LogManager.GetLogger("ClaymoreLogger");
logger.Info(.....)
Hope that helps,
Wolfgang
-----Original Message-----
From: mattyboy [mailto:mattm@spdprintsolutions.com]
Sent: Mittwoch, 2. September 2009 10:24
To: log4net-user@logging.apache.org
Subject: Log4Net Repository
Hi,
I'm new to Log4Net having stumbled across it by accident. I've managed to
get a single .Net assembly logging to a file using the RollingFileAppender.
This works fine and I'm happy with it but what I REALLY want to do is have
multiple .Net assemblies logging to the same log file. Having looked at the
documentation I think I should be using a Repository to do this but I can't
find any decent examples of how this is done.
Can anyone supply me with any examples/urls etc. that would point me in the
right direction?
Many Thanks
Here's the config. file I'm using at the moment for a single assembly:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="ClaymoreAppender"
type="log4net.Appender.RollingFileAppender">
<file value="C:\Program Files\Claymore\Claymore.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="3" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level - [Claymore]
%message%newline" />
</layout>
</appender>
<logger name="ClaymoreLogger">
<!--<level value="INFO" />-->
<!--<level value="DEBUG" />-->
<level value="INFO" />
<appender-ref ref="ClaymoreAppender" />
</logger>
</log4net>
</configuration>
--
View this message in context:
http://www.nabble.com/Log4Net-Repository-tp25253481p25253481.html
Sent from the Log4net - Users mailing list archive at Nabble.com.