Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 88354 invoked from network); 18 Dec 2006 15:00:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Dec 2006 15:00:38 -0000 Received: (qmail 78392 invoked by uid 500); 18 Dec 2006 15:00:45 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 78007 invoked by uid 500); 18 Dec 2006 15:00:44 -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" List-Id: Delivered-To: mailing list log4net-user@logging.apache.org Received: (qmail 77996 invoked by uid 99); 18 Dec 2006 15:00:44 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Dec 2006 07:00:44 -0800 X-ASF-Spam-Status: No, hits=2.8 required=10.0 tests=HTML_MESSAGE,INFO_TLD X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [70.158.47.212] (HELO email3.econnextions.com) (70.158.47.212) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Dec 2006 07:00:34 -0800 Received: from [10.10.212.12] (HELO exchange2.corporate.connextions.net) by email3.econnextions.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 3480040 for log4net-user@logging.apache.org; Mon, 18 Dec 2006 10:00:10 -0500 Received: by exchange2.corporate.connextions.net with Internet Mail Service (5.5.2658.3) id ; Mon, 18 Dec 2006 09:58:37 -0500 Message-ID: From: "Sanders, Brian" To: Log4NET User Subject: RE: Log4net not working as expected Date: Mon, 18 Dec 2006 09:58:27 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2658.3) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C722B4.F959558F" X-Virus-Checked: Checked by ClamAV on apache.org This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C722B4.F959558F Content-Type: text/plain I think I figured it out. I think there were 2 versions of the log4net DLL. One in the GAC, and one in the same directory as the exe. The exe was using one version while everything else was using another. I removed the dll from the GAC made some changes and so far it seems to be working. Thanks to those who responded. Brian Sanders _____ From: Dean Fiala [mailto:dfiala@celadonlabs.com] Sent: Friday, December 15, 2006 10:18 PM To: log4net-user@logging.apache.org Subject: re: Log4net not working as expected Just a thought, since you are declaring the log member in the dll class as static, it might be getting instantiated before the configuration has run. Why not either make it property protected static log4net.ILog log { return log4net.LogManager.GetLogger("EngineTasksFactory"); } or just declare it locally in the method. I have applications that have multiple assemblies all working as you would expect. _____ Return-Path: Fri Dec 15 14:43:13 2006 Received: from hermes.apache.org [140.211.11.2] by mail.celadonlabs.com with SMTP; Fri, 15 Dec 2006 14:43:13 -0700 Received: (qmail 3993 invoked by uid 500); 15 Dec 2006 21:43:09 -0000 Received: (qmail 3982 invoked by uid 99); 15 Dec 2006 21:43:09 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Dec 2006 13:43:09 -0800 Received: from [70.158.47.212] (HELO email3.econnextions.com) (70.158.47.212) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Dec 2006 13:42:58 -0800 Received: from [10.10.212.12] (HELO exchange2.corporate.connextions.net) by email3.econnextions.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 3362767 for log4net-user@logging.apache.org; Fri, 15 Dec 2006 16:42:34 -0500 Received: by exchange2.corporate.connextions.net with Internet Mail Service (5.5.2658.3) id ; Fri, 15 Dec 2006 16:41:04 -0500 Mailing-List: contact log4net-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET User" List-Id: Delivered-To: mailing list log4net-user@logging.apache.org X-ASF-Spam-Status: No, hits=2.8 required=10.0 tests=HTML_MESSAGE,INFO_TLD X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Message-ID: From: "Sanders, Brian" To: log4net-user@logging.apache.org Subject: Log4net not working as expected Date: Fri, 15 Dec 2006 16:41:04 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2658.3) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C72091.B8865A13" X-Virus-Checked: Checked by ClamAV on apache.org X-SmarterMail-Spam: SPF_Pass X-Rcpt-To: Hello, I have an issue with log4net that I was sure was not an issue before. I have a project which is made up of a few other projects. There's an exe and 4 other dlls. Logging from the exe works while logging from the dlls does not. Like I say, I know this has worked before. I've read thru the documentation and everything looks identical. Does anyone see what I might be doing wrong here or know what the cause may be? Thanks. Log4net: 1.2.10.0 Cnxengine.exe: Runs as either a service, or a stand-alone exe, depending on configuration. Platform: MS.Net Cnxengine.exe.Config: ... ... CNXENgine.cs: public class CNXEngine : System.ServiceProcess.ServiceBase { protected log4net.ILog log = log4net.LogManager.GetLogger("CNXEngine"); ... public CNXEngine() { // This call is required by the Windows.Forms Component Designer. InitializeComponent(); //Initialize the threadlist ThreadList = new ArrayList(); //Get the tasks to run log.Debug("GetTasksToRun"); <- Works TasksToRun = EngineTasksFactory.GetTasksToRun(); log.Debug("Finished GetTasksToRun"); <- Works } public static void Main() { log4net.Config.XmlConfigurator.Configure(); ... if (Convert.ToBoolean(ConfigurationSettings.AppSettings["RunAsService"])) { ... } Else { ... } } EngineTasksFactory.cs: public class EngineTasksFactory { protected static log4net.ILog log = log4net.LogManager.GetLogger("EngineTasksFactory"); ... public static EngineTaskList GetTasksToRun() { log.Info("Creating EngineTaskList"); <- Does not work EngineTaskList tasks = new EngineTaskList(); tasks.Add(new OrderRoutingTask()); log.Debug("Created EngineTaskList"); return tasks; } Brian Sanders ------_=_NextPart_001_01C722B4.F959558F Content-Type: text/html Content-Transfer-Encoding: quoted-printable

I think I figured it out. I think = there were 2 versions of the log4net DLL. One in the GAC, and one in the same directory as the exe. The exe was using one version while everything = else was using another. I removed the dll from the GAC made some changes and so = far it seems to be working. Thanks to those who = responded.

 

=

Brian Sanders


From: Dean = Fiala [mailto:dfiala@celadonlabs.com]
Sent: Friday, December = 15, 2006 10:18 PM
To: = log4net-user@logging.apache.org
Subject: re: Log4net not = working as expected

 

Just a thought, since you = are declaring the log member in the dll class as static, it might be = getting instantiated before the configuration has run.  Why not either = make it property

protecte= d static = log4net.ILog log
{

    return log4net.LogManager.GetLogger("EngineTasksFactory");
}

or just declare it locally in the method.

I have applications that have multiple assemblies all working as you = would expect.


Return-Path: <log4net-user-return-3568-dfiala=3Dceladonlabs.com@logging.apache.org= > Fri Dec 15 14:43:13 2006
Received: from hermes.apache.org [140.211.11.2] by mail.celadonlabs.com = with SMTP;
Fri, 15 Dec 2006 14:43:13 -0700
Received: (qmail 3993 invoked by uid 500); 15 Dec 2006 21:43:09 = -0000
Received: (qmail 3982 invoked by uid 99); 15 Dec 2006 21:43:09 = -0000
Received: from herse.apache.org (HELO herse.apache.org) = (140.211.11.133)
by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Dec 2006 13:43:09 = -0800
Received: from [70.158.47.212] (HELO email3.econnextions.com) = (70.158.47.212)
by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Dec 2006 13:42:58 = -0800
Received: from [10.10.212.12] (HELO = exchange2.corporate.connextions.net)
by email3.econnextions.com (CommuniGate Pro SMTP 4.1.8)
with ESMTP id 3362767 for log4net-user@logging.apache.org; Fri, 15 Dec = 2006 16:42:34 -0500
Received: by exchange2.corporate.connextions.net with Internet Mail = Service (5.5.2658.3)
id <Y2AK6CH1>; Fri, 15 Dec 2006 16:41:04 -0500
Mailing-List: contact log4net-user-help@logging.apache.org; run by = ezmlm
Precedence: bulk
list-help: <mailto:log4net-user-help@logging.apache.org>
list-unsubscribe: = <mailto:log4net-user-unsubscribe@logging.apache.org>
List-Post: <mailto:log4net-user@logging.apache.org>
Reply-To: "Log4NET User" = <log4net-user@logging.apache.org>
List-Id: <log4net-user.logging.apache.org>
Delivered-To: mailing list log4net-user@logging.apache.org
X-ASF-Spam-Status: No, hits=3D2.8 required=3D10.0
tests=3DHTML_MESSAGE,INFO_TLD
X-Spam-Check-By: apache.org
Received-SPF: pass (herse.apache.org: local policy)
Message-ID: <E27E1F31E240804AB308CFFAB6B9289315D56957@exchange2.corporate.connext= ions.net>
From: "Sanders, Brian" <BSanders@connextions.com>
To: log4net-user@logging.apache.org
Subject: Log4net not working as expected
Date: Fri, 15 Dec 2006 16:41:04 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2658.3)
Content-Type: multipart/alternative;
boundary=3D"----_=3D_NextPart_001_01C72091.B8865A13"
X-Virus-Checked: Checked by ClamAV on apache.org
X-SmarterMail-Spam: SPF_Pass
X-Rcpt-To: <dfiala@celadonlabs.com>



Hello,

I have an issue with log4net that I was sure was not = an issue before. I have a project which is made up of a few other = projects. There’s an exe and 4 other dlls. Logging from the exe works while = logging from the dlls does not. Like I say, I know this has worked before. = I’ve read thru the documentation and everything looks identical. Does anyone = see what I might be doing wrong here or know what the cause may be? = Thanks.

 

Log4net: = 1.2.10.0

Cnxengine.exe: Runs as either a service, or a = stand-alone exe, depending on = configuration.

Platform: = MS.Net

Cnxengine.exe.Config:=

<log4net>      &n= bsp;           &n= bsp;  

         = ;   <appender name=3D"RollingFile" type=3D"log4net.Appender.RollingFileAppender">=

         = ;               = <file value=3D"c:\\CNXHeavy\\Logs\\CNXEngine.log" = />

         = ;               <appendToFile value=3D"true" = />

         = ;               <rollingStyle value=3D"Date" = />

         = ;               <datePattern value=3D"yyyyMMdd" />         =

         = ;               <staticLogFileName value=3D"true" = />

         = ;               <maxSizeRollBackups value=3D"14" = />

         = ;               <!--<maximumFileSize value=3D"1GB" = />-->

         = ;               = <layout type=3D"log4net.Layout.PatternLayout"><= /font>

         = ;               =             <conversionPattern value=3D"%date %level  = %logger[%method:%line] - %message%newline" />

         = ;               = </layout>

         = ;   </appender>

         = ;   <root>

         = ;               = <level value=3D"DEBUG" = />

         = ;               <appender-ref ref=3D"RollingFile" = />

         = ;   </root>          = ;   

</log4net>

 

CNXENgine.cs:

public class = CNXEngine : System.ServiceProcess.ServiceBase = {

protected log4net.ILog log = =3D log4net.LogManager.GetLogger("CNXEngine");=

 <= /font>

public CNXEngine() {

      // This call is required by the Windows.Forms = Component Designer.          &nb= sp; 

      InitializeComponent();        &n= bsp;    


      //Initialize the threadlist

      ThreadList = =3D new = ArrayList();

 

      //Get the tasks to = run

      log.Debug("GetTasksToRun"); <- = Works

      TasksToRun = =3D EngineTasksFactory.GetTasksToRun();

      log.Debug("Finished GetTasksToRun"); <- = Works

}

 

public static = void Main() =

{

log4net.Config.XmlConfigurator.Configure();

if (Convert.ToBoolean(ConfigurationSettings.AppSettings["RunAsService&= quot;]))

{

      …

}

Else

{

      …

}

}

 

EngineTasksFactory.cs:

public class = EngineTasksFactory

{

      protected static log4net.ILog log =3D log4net.LogManager.GetLogger("EngineTasksFactory");

         = ;   …

 

public static = EngineTaskList GetTasksToRun()

{

      log.Info("Creating EngineTaskList"); <- Does not = work

      = EngineTaskList tasks =3D new = EngineTaskList();

           =             =             =       

      = tasks.Add(new = OrderRoutingTask());

      log.Debug("Created = EngineTaskList");

      return = tasks;

}

 

Brian = Sanders

 

------_=_NextPart_001_01C722B4.F959558F--