Jon Sheldon | 28 Aug 22:05

Whatever happened to asp.net pattern converters?

Hello,

 

I’m very interested in using log4net as my companies standard logging utility.  Since our focus is primarily on developing web applications using asp.net, I’m very interested in the AspNet*PatternConverter classes that Ron started to implement back in October 2006.  Is there a new release of log4net that is coming out soon that will include them?

 

Or should I create my own layout class that implements ILayout and similar asp.net httpcontext focused PatternConverter classes?

 

Thanks.

 

Jon

 

jon scott-sheldon

senior internet applications architect

mcp

jons <at> acsysinteractive.com
860.679.9332  x 318
acsysinteractive.com

acsysinteractive

connecticut  |  new york

 

Pascal ROZE | 28 Aug 14:41

Use Pattern name in message

Hi all

At this time, I have a logger with the following configuration:
<layout type="log4net.Layout.PatternLayout,log4net">
      <conversionPattern value="LEVEL: %level %newlineDATE: %date %newlineLOGGER: %logger %newline%newline%message"/>
    </layout>

It works fine.


Now, I would like to use Pattern names in message variable.

For example, I'm trying to do:

string msg = "The time is %date and the logger is %logger";
myLogger.Info(msg);

And of course, it doesn't work.
The output is: The time is %date and the logger is %logger.

Any idea to achieve that?

Thx a lot

Pascal
Walden H. Leverich | 27 Aug 23:02

SmtpAppender - To addresses comma seperated, not semi-colon seperated...

Am I nuts, or must multiple addresses in the To of the SmtpAppender be COMMA separated, not semicolon separated as the documentation says?

 

-Walden

 

--

Walden H Leverich III

Tech Software

(516) 627-3800 x3051

WaldenL <at> TechSoftInc.com

http://www.TechSoftInc.com

 

Quiquid latine dictum sit altum viditur.

(Whatever is said in Latin seems profound.)

 

harry.douglass | 23 Aug 02:04

Out of the office


I will be out of the office starting  08/22/2008 and will not return until
08/27/2008.

I will respond to your message upon my return.

The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to
read it. If you think you received it in error, please notify the sender. Do not forward or copy without
permission of the sender. This message may contain an advertisement of a product or service and thus may
constitute a commercial electronic mail message under US Law. The postal address for PNC is 249 Fifth
Avenue, Pittsburgh, PA 15222. If you do not wish to receive any additional advertising or promotional
messages from PNC at this e-mail address, click here to unsubscribe.
https://pnc.p.delivery.net/m/u/pnc/uni/p.asp By unsubscribing to this message, you will be
unsubscribed from all advertising or promotional messages from PNC. Removing your e-mail address from
this mailing 
 list will not affect your subscription to alerts, e-newsletters or account servicing e-mails.

Loren Keagle | 23 Aug 02:00

Multiple Layouts to the same appender

I have an application that contains a subsystem with its own logging 
infrastructure.  I can hook into this logging system to intercept the 
log messages, but the messages are already formatted.  Rather than parse 
and decompose these messages, I simply used a PatternLayout to match the 
layout of the subsystem.

However, I also need to log from my own code to the same file.  This 
means I need to have an empty layout for the logger that's logging the 
subsystem messages, and a formatted layout for all the other loggers.  
I've tried using a ForwardingAppender, and setting a layout in there, 
but that layout is overridden by the layout in the FileAppender.  If I 
leave the layout off of ForwardingAppender, I get a log4net error.

It seems as though the chain of responsibility is reversed for the 
layouts than what it should be... Shouldn't log4net use the first layout 
it finds as it traces up the hierarchy, rather than the root layout?  
Why is the layout in my ForwardingAppender ignored?

Here is my config block:

 <log4net>
   <appender name="ConsoleAppender" 
type="log4net.Appender.ConsoleAppender" >
     <layout type="log4net.Layout.PatternLayout">
       <ConversionPattern value=" %d{HH:mm:ss.fff} %14c{1} %m%n" />
     </layout>
   </appender>
   <appender name="RollingFileAppender" 
type="log4net.Appender.RollingFileAppender">
     <file value="log.txt" />
     <appendToFile value="true" />
     <rollingStyle value="Size" />
     <maxSizeRollBackups value="5" />
     <maximumFileSize value="10MB" />
     <staticLogFileName value="true" />
     <layout type="log4net.Layout.PatternLayout">
       <ConversionPattern value=" %d{HH:mm:ss.fff} %14c{1} %m%n" />
     </layout>
   </appender>
   <appender name="ForwardingAppender" 
type="log4net.Appender.ForwardingAppender" >
     <appender-ref ref="ConsoleAppender" />
     <appender-ref ref="RollingFileAppender" />
     <layout type="log4net.Layout.PatternLayout">
       <ConversionPattern value="%m" />
     </layout>
   </appender>
   <root>
     <level value="DEBUG" />
     <appender-ref ref="RollingFileAppender" />
     <appender-ref ref="ConsoleAppender" />
   </root>
   <logger name="subsystem" additivity="false" >
     <appender-ref ref="ForwardingAppender" />
   </logger>
 </log4net>

Vladimir Bodurov | 18 Aug 21:14

Can I limit the level for appender

Hello,
 
Can I limit the level for appender, for example if I want the errors to go to database and the debug calls to Debug Output.
 
Is this possible?
 
Thank you in advance
 
Vlad
Debashish | 13 Aug 21:41

Conigure log4net for .net dll


Hi 
I am developing a ClassLibrary in C#(VS2008). 
I have refernce to log4net.dll. 
This DLL has only one function which will log a 
string using log4net. 
My AssemblyInfo.cs has the following entry: 
[assembly: log4net.Config.XmlConfigurator()] 
I use this above dll in a WINForms application. 

The problem is log4net is not logging any information. 

Appreciate help.

--

-- 
View this message in context: http://www.nabble.com/Conigure-log4net-for-.net-dll-tp18969861p18969861.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Alaks | 7 Aug 13:18

Logging from two dlls interop


Hye.
I wanted to trace my functions by logging some informations. So i developped
two dlls (.net interop) wich use log4net for logging. 
when i execute one of the dlls from asp page, logging is working fine. But
when i wanted to use both in the same page with "createObject("Dll1.object)
and createObject("Dll2.object") i encounter problems.
The problem is a little bitte weard, all functions with the same name in
these two dlls , the logs is automatically logged in the last dll
instantied.
Example(c#)

Dll1 : 

public void foo(){
 log.Info("Hello it's me");
}

Dll2 : 

public void foo(){
 log.info("Hello it's not me!");
}

ASP page : 

<% 
set ob = server.createObject("Dll1.object");
set ob1 = server.createObject("Dll2.object");
ob.foo()
%>
So as result i get the log file of dll2 modified with this content :
"Hello it's not me!"
and the log file of dll1 is not modified.
And to finish, logging is working fine for the function wich has different
name in these two dlls.

I don't know if i explain well, but in all cases i am sorry for my english.

Thank you in advance

--

-- 
View this message in context: http://www.nabble.com/Logging-from-two-dlls-interop-tp18868255p18868255.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

raj.muchhala | 7 Aug 11:01

Raj Muchhala is out of the office.


I will be out of the office starting Thu 08/07/2008 and will not return
until Fri 08/08/2008.

**************************************************************************************
This e-mail message and all attachments transmitted with it may contain legally privileged and/or
confidential information intended solely for the use of the addressee(s). If the reader of this message
is not the intended recipient, you are hereby notified that any reading, dissemination, distribution,
copying, forwarding or other use of this message or its attachments is strictly prohibited. If you have
received this message in error, please notify the sender immediately and delete this message and all
copies and backups thereof.

Thank you.
**************************************************************************************

Jerry Shea | 7 Aug 10:10

ASP.NET, AdoNetAppender and deferred property execution

Hi Everyone,
I am seeing a problem here which I believe is due to deferred property execution. I have a ClientLogger which gets a property value from the HttpSession as below.

    public class ClientLogger {
        public override string ToString() {
            string retval = "-";
            if (HttpContext.Current != null && HttpContext.Current.Session != null && HttpContext.Current.Session["client"] != null)
                retval = (string)HttpContext.Current.Session["client"];
            return retval;
        }
    }

My log4net is configured with an AdoNetAppender which of course is a BufferingAppender.

<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
    <bufferSize value="100" />
    <connectionType value="blah..." />
    <connectionString value="blah..." />
    <commandText value="INSERT INTO blah..." />
    ... ...
    <parameter>
      <parameterName value=" <at> client" />
      <dbType value="String" />
      <size value="100" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%property{client}" />
      </layout>
    </parameter>
    ... ...
  </appender>

The problem is, when I look in my database I and compare the rows there with what I see in my log file (generated from RollingFileAppender) I can see that the property values for "client" do not match. I presume this is because my ClientLogger is not being called until the AdoNetAppender's buffer is flushed.

Can anyone confirm if my diagnosis is correct, and, if so, is there a way to have these properties evaluated when the log statement is executed, rather than at flush time?

Thanks, Jerry




Michael Richman | 6 Aug 21:01

Adding properties to a logging event

I'm trying to add properties to a logging event so that the adoAppender can=pick up these properties and use them in the insert SQL statement.

I've followed the example of creating a loggingEvent, but for the life of me, I can't figure out what the callStackBoundaryDeclaringType would be. Can someone help me figure out what the first parameter is to pass to the LoggingEvent constructor?

Also, is there a simpler way to add event specific context so that the appender can pick up the properties? I know I can use MDC or NDC or thread context or global context, but these are properties that are specific to the event, not those larger contexts.

My code fragment is as follows:

 

log4net.Core.LoggingEvent loggingEvent =3D new log4net.Core.LoggingEvent(ca= llerStackBoundaryDeclaringType,

log.Logger.Repository,

log.Logger.Name,

log4net.Core.Level.Info,

"This is a Message",

new Exception());

loggingEvent.Properties["Additional"] =3D "Additional info";

log.Logger.Log(loggingEvent);


Gmane