Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 21180 invoked from network); 8 Dec 2004 11:37:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 8 Dec 2004 11:37:54 -0000 Received: (qmail 47554 invoked by uid 500); 8 Dec 2004 11:37:47 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 47534 invoked by uid 500); 8 Dec 2004 11:37:47 -0000 Mailing-List: contact log4net-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: "Log4NET User" Delivered-To: mailing list log4net-user@logging.apache.org Received: (qmail 47518 invoked by uid 99); 8 Dec 2004 11:37:47 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from 83-216-141-166.oliver856.adsl.metronet.co.uk (HELO mail.sturmnet.org) (83.216.141.166) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 08 Dec 2004 03:37:45 -0800 Received: from localhost (localhost [127.0.0.1]) by mail.sturmnet.org (Postfix) with ESMTP id B5F4D1A519CD; Wed, 8 Dec 2004 11:37:40 +0000 (GMT) Received: from mail.sturmnet.org ([127.0.0.1]) by localhost (ost1 [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 32344-02; Wed, 8 Dec 2004 11:37:38 +0000 (GMT) Received: from [192.168.1.200] (ost2 [192.168.1.200]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sturmnet.org (Postfix) with ESMTP id DACBD1A519C7 for ; Wed, 8 Dec 2004 11:37:38 +0000 (GMT) Message-ID: <41B6E77F.2060307@sturmnet.org> Date: Wed, 08 Dec 2004 11:37:35 +0000 From: Oliver Sturm User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: log4net-user@logging.apache.org Subject: Finding out whether a specific appender is attached X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig084B9086835C131CAA75629D" X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at sturmnet.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig084B9086835C131CAA75629D Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hey, I have an application that uses another assembly, written earlier, where a System.Diagnostics was used for debugging output. As the new application is supposed to use log4net for logging, I want to route that old Diagnostics stuff into log4net and I have successfully created my own derived TraceListener that does that for me. Now, on my development system, I like to set up log4net to use a TraceAppender so that I can easily see the log4net output in Visual Studio when debugging. Of course, I can't use my own TraceListener and the log4net TraceAppender at the same time. So I'd like to find out (during initialization of my app) whether a TraceAppender is in the root category of the current log4net configuration and only set up my TraceListener if there's no TraceAppender. I have had close looks around the SDK help file and I tried a lot myself, but I can't figure out where to get access to the appenders that are configured for the root category. In theory, it seems to be possible to query the appenders for a specific logger, but then (1) I don't know which one to use at that early point of the application initialization and (2) using only the interfaces that I can usually get to, this would at least involve a lot of assumptions (and casts). I've also written some code that uses GetCurrentLoggers and iterates over the loggers it gets and in the debugger it looked like the Appenders property deep down in the class that's returned for each logger doesn't even contain any appenders at this point. So, to restate the question very simply: How can I find out programatically which appender types are configured for the root category? Thanks! Oliver Sturm -- omnibus ex nihilo ducendis sufficit unum MSN oliver@sturmnet.org Jabber sturm@amessage.de ICQ 27142619 --------------enig084B9086835C131CAA75629D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Public key at http://www.sturmnet.org/pgpkeys/oliver iD8DBQFBtueCcW0sNgkj3q0RAkGFAJ41jaKvcHyW0xGCZeUn9j3fUoYKUACdFyL6 hHhKdecL22HhuZUe4ZISP/E= =gF75 -----END PGP SIGNATURE----- --------------enig084B9086835C131CAA75629D--