Multiple file recording.

SINU BABU <[email protected]> Sat, 6 Jun 2009 08:42:57 -0400
Newsgroups gmane.comp.windows.dotnet.log4net.user
Message-ID <[email protected]>
--===============3863252477861298520==
Content-Type: multipart/alternative; boundary=001636417aef3f3861046bad5954

--001636417aef3f3861046bad5954
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi there,

We are using log4net for logging in our application. All the logging in the
application (from all classes) is done into a single log file. But now I
have a class from which I want to log some INFO messages into a second log
file as well (that would mean logging  into 2 files from the same class).

Now for logging into the second log file, I defined a new logger as --

       <logger name ="NamespaceA.ClassA" additivity="false">
          <level value="Off" />
          <appender-ref ref="RecordingFile" />
      </logger>


for this I defined an new appender (RecordingFile) as well. In the class
code, I access my two loggers by


//first logger - the one the whole application logs into
private static readonly ILog _log = LogManager.GetLogger(typeof(ClassA));

//second logger.
private static readonly ILog _recordingLog =
LogManager.GetLogger("NamespaceA.ClassA");



Now, this arrangement works fine until I switch the second logger "OFF".
When that is done, the logging from ClassA into the
first log file also gets stopped (which I certainly dont want to happen).

Is there a way in which I can decouple the two loggers?


Thanks,
Sinu.

--001636417aef3f3861046bad5954
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi there,<br><br>We are using log4net for logging in our application.
All the logging in the application (from all classes) is done into a
single log file. But now I have a class from which I want to log some
INFO messages into a second log file as well (that would mean logging=A0
into 2 files from the same class). <br>
<br>Now for logging into the second log file, I defined a new logger as --<=
br><br>=A0=A0=A0=A0=A0=A0 &lt;logger name =3D&quot;NamespaceA.ClassA&quot; =
additivity=3D&quot;false&quot;&gt;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0 &lt;level=
 value=3D&quot;Off&quot; /&gt;<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0 &lt;appender-ref ref=3D&quot;RecordingFile&quot=
; /&gt;<br>=A0=A0=A0=A0=A0 &lt;/logger&gt;<br><br><br>for this I defined an=
 new appender (RecordingFile) as well. In the class code, I access my two l=
oggers by<br><br><br>//first logger - the one the whole application logs in=
to<br>

private static readonly ILog _log =3D LogManager.GetLogger(typeof(<div id=
=3D":1a9" class=3D"ii gt">ClassA));<br>=A0=A0=A0=A0=A0 <br>//second logger.=
<br>private static readonly ILog _recordingLog =3D LogManager.GetLogger(&qu=
ot;NamespaceA.ClassA&quot;);<br>
<br><br><br>Now, this arrangement works fine until I switch the second logg=
er &quot;OFF&quot;. When that is done, the logging from ClassA into the <br=
>
first log file also gets stopped (which I certainly dont want to happen).<b=
r><br>Is there a way in which I can decouple the two loggers?<br><br><br>Th=
anks,<br><font color=3D"#888888">Sinu.</font></div>

--001636417aef3f3861046bad5954--


--===============3863252477861298520==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
--===============3863252477861298520==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Log4net-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4net-users

--===============3863252477861298520==--