Programmatically add newline to header & footer

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Programmatically add newline to header & footer

Andre Cassar
Hi guys,

I'm configuring log4net programmatically and not using the xml configuration. I want to be able to add a newline to the header and footer. How can you do that? I tried %newline, \r,\n, 
 but all in vain. 

My code looks like this:

PatternLayout patternLayout = new PatternLayout();
            patternLayout.ConversionPattern = "%date [%thread] %-5level %logger : %message%newline";
            patternLayout.Header = "%newline****** [Logging Started] ******%n[Date] [Thread ID] [Level] [Logger] : [Log Entry]
";
            patternLayout.Footer = "****** [Logging Stoped] ******
";
            
Any ideas please?


Thanks beforehand
Andre Cassar
Reply | Threaded
Open this post in threaded view
|

RE: [External] Programmatically add newline to header & footer

Goyal, Nitin   UTAS
You have to call activateoptions when you change or update header or conversion pattern.

I am doing the same way ansand able to add newline.


________________________________________
From: Andre Cassar [[hidden email]]
Sent: Friday, October 31, 2014 02:31 AM
To: [hidden email]
Subject: [External] Programmatically add newline to header & footer

Hi guys,

I'm configuring log4net programmatically and not using the xml configuration. I want to be able to add a newline to the header and footer. How can you do that? I tried %newline, \r,\n, 
 but all in vain.

My code looks like this:

PatternLayout patternLayout = new PatternLayout();
            patternLayout.ConversionPattern = "%date [%thread] %-5level %logger : %message%newline";
            patternLayout.Header = "%newline****** [Logging Started] ******%n[Date] [Thread ID] [Level] [Logger] : [Log Entry]
";
            patternLayout.Footer = "****** [Logging Stoped] ******
";

Any ideas please?


Thanks beforehand
Andre Cassar
Reply | Threaded
Open this post in threaded view
|

Re: [External] Programmatically add newline to header & footer

Andre Cassar
I am calling the activateoptions onto the pattern. The header and footer are being outputted, and any changes are reflected. The only problem is the newline. It's just being outputted as plain text and not as a carriage return. 

What syntax are you using for the newline in the header and footer? Can you please give me an example? 

Many thanks
Andre. 

On 31 October 2014 01:42, Goyal, Nitin UTAS <[hidden email]> wrote:
You have to call activateoptions when you change or update header or conversion pattern.

I am doing the same way ansand able to add newline.


________________________________________
From: Andre Cassar [[hidden email]]
Sent: Friday, October 31, 2014 02:31 AM
To: [hidden email]
Subject: [External] Programmatically add newline to header & footer

Hi guys,

I'm configuring log4net programmatically and not using the xml configuration. I want to be able to add a newline to the header and footer. How can you do that? I tried %newline, \r,\n, &#13;&#10; but all in vain.

My code looks like this:

PatternLayout patternLayout = new PatternLayout();
            patternLayout.ConversionPattern = "%date [%thread] %-5level %logger : %message%newline";
            patternLayout.Header = "%newline****** [Logging Started] ******%n[Date] [Thread ID] [Level] [Logger] : [Log Entry]&#13;&#10;";
            patternLayout.Footer = "****** [Logging Stoped] ******&#13;&#10;";

Any ideas please?


Thanks beforehand
Andre Cassar

Reply | Threaded
Open this post in threaded view
|

RE: [External] Programmatically add newline to header & footer

Goyal, Nitin   UTAS
I will extract the example for you. I need to dig into my archives.

Can you try with Environment.NewLine?? I think it should work as well.


________________________________________
From: Andre Cassar [[hidden email]]
Sent: Friday, October 31, 2014 05:05 PM
To: Log4NET User
Subject: Re: [External] Programmatically add newline to header & footer

I am calling the activateoptions onto the pattern. The header and footer are being outputted, and any changes are reflected. The only problem is the newline. It's just being outputted as plain text and not as a carriage return.

What syntax are you using for the newline in the header and footer? Can you please give me an example?

Many thanks
Andre.

On 31 October 2014 01:42, Goyal, Nitin UTAS <[hidden email]<mailto:[hidden email]>> wrote:
You have to call activateoptions when you change or update header or conversion pattern.

I am doing the same way ansand able to add newline.


________________________________________
From: Andre Cassar [[hidden email]<mailto:[hidden email]>]
Sent: Friday, October 31, 2014 02:31 AM
To: [hidden email]<mailto:[hidden email]>
Subject: [External] Programmatically add newline to header & footer

Hi guys,

I'm configuring log4net programmatically and not using the xml configuration. I want to be able to add a newline to the header and footer. How can you do that? I tried %newline, \r,\n, &#13;&#10; but all in vain.

My code looks like this:

PatternLayout patternLayout = new PatternLayout();
            patternLayout.ConversionPattern = "%date [%thread] %-5level %logger : %message%newline";
            patternLayout.Header = "%newline****** [Logging Started] ******%n[Date] [Thread ID] [Level] [Logger] : [Log Entry]&#13;&#10;";
            patternLayout.Footer = "****** [Logging Stoped] ******&#13;&#10;";

Any ideas please?


Thanks beforehand
Andre Cassar

Reply | Threaded
Open this post in threaded view
|

Re: [External] Programmatically add newline to header & footer

Andre Cassar
thanks. Environment.NewLine did the trick. 

thanks again. 

On 31 October 2014 16:29, Goyal, Nitin UTAS <[hidden email]> wrote:
I will extract the example for you. I need to dig into my archives.

Can you try with Environment.NewLine?? I think it should work as well.


________________________________________
From: Andre Cassar [[hidden email]]
Sent: Friday, October 31, 2014 05:05 PM
To: Log4NET User
Subject: Re: [External] Programmatically add newline to header & footer

I am calling the activateoptions onto the pattern. The header and footer are being outputted, and any changes are reflected. The only problem is the newline. It's just being outputted as plain text and not as a carriage return.

What syntax are you using for the newline in the header and footer? Can you please give me an example?

Many thanks
Andre.

On 31 October 2014 01:42, Goyal, Nitin UTAS <[hidden email]<mailto:[hidden email]>> wrote:
You have to call activateoptions when you change or update header or conversion pattern.

I am doing the same way ansand able to add newline.


________________________________________
From: Andre Cassar [[hidden email]<mailto:[hidden email]>]
Sent: Friday, October 31, 2014 02:31 AM
To: [hidden email]<mailto:[hidden email]>
Subject: [External] Programmatically add newline to header & footer

Hi guys,

I'm configuring log4net programmatically and not using the xml configuration. I want to be able to add a newline to the header and footer. How can you do that? I tried %newline, \r,\n, &#13;&#10; but all in vain.

My code looks like this:

PatternLayout patternLayout = new PatternLayout();
            patternLayout.ConversionPattern = "%date [%thread] %-5level %logger : %message%newline";
            patternLayout.Header = "%newline****** [Logging Started] ******%n[Date] [Thread ID] [Level] [Logger] : [Log Entry]&#13;&#10;";
            patternLayout.Footer = "****** [Logging Stoped] ******&#13;&#10;";

Any ideas please?


Thanks beforehand
Andre Cassar