I checked the values of oPattern object(after setting its ConversionPattern value) in debug mode and this is what it is.

 

?oPatternLayout.DetailConversionPattern

"%timestamp [%thread] %level %logger %ndc - %message%newline"

 

?oPatternLayout.DefaultConversionPattern

"%message%newline"

 

?oPatternLayout.ConversionPattern

"%date{yyyy-mm-dd} %5level- %message%newline"

 

So, looks like its always using the DefaultConversionPattern's value.

 

 

-----Original Message-----
From: Ramaa Davanagere
Sent: Monday, September 19, 2005 9:49 AM
To: 'Log4NET User'
Subject: RE: Including datetime stamp in the log messages.

 

 

 

No matter what I set my conversion pattern to be, the output always looks like this..

 

[Begin]

Void WriteToLog_Info(System.String):hi there, how are you

Void WriteToLog_Info(System.String):today is Monday

Void WriteToLog_Info(System.String):September is the month

Void WriteToLog_Info(System.String):Thought of the day

[End]

 

 

WriteToLog_Info function looks like this

 

public void WriteToLog_Info(string sMessage)

{          

      logger.Info(System.Reflection.MethodBase.GetCurrentMethod() + ":" + sMessage);

}

 

I tried this settings,

 

oPatternLayout.ConversionPattern = "%date{yyyy-mm-dd} %5level- %message%newline";

 

but it doesn't work.

 

Getting the datetime stamp and the Level is the most I'm interested in.

 

-----Original Message-----

From: Ron Grabowski [mailto:[EMAIL PROTECTED]

Sent: Monday, September 19, 2005 9:41 AM

To: Log4NET User

Subject: RE: Including datetime stamp in the log messages.

 

Hmmm. Are you saying that nothing was output? That should have output

the date of the logging event, the level of the logging event, and the

message of the logging event.

 

The example format I gave you does not automatically output the thread

id surrounded with brackets [ ]. You have to do that on your own:

 

 [%thread]

 

--- Ramaa Davanagere <[EMAIL PROTECTED]> wrote:

 

>

> Did you mean this?

>

> oPatternLayout.ConversionPattern = "%date %level %message";

>

> If so, this didn't work.

>

>

> -----Original Message-----

> From: Ron Grabowski [mailto:[EMAIL PROTECTED]

> Sent: Monday, September 19, 2005 9:00 AM

> To: Log4NET User

> Subject: Re: Including datetime stamp in the log messages.

>

> %date %level %message

>

> --- Ramaa Davanagere <[EMAIL PROTECTED]> wrote:

>

> > But I want the output to look like the sample shown below. I want

> to

> > include

> > the datetime stamp for each message that is logged to the text file

> > followed

> > by the message type constants (debug, error, fatal, info, etc) and

> > then my

> > log message.

>

Reply via email to