You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by DaneVinson <da...@gmail.com> on 2012/09/16 06:47:03 UTC
New to log4net. Easy question?
/* Code */
protected static readonly ILog Logger =
log4net.LogManager.GetLogger(typeof(Program));
static void Main(string[] args)
{
Logger.Info("Test line");
Logger.Info("Test line 2");
Logger.Info("Test line 3");
/* Appender */
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{ABSOLUTE} - %-5level - %message%newline
%exception"/>
</layout>
</appender>
/* Output */
21:40:26,429 - INFO - Test line
21:40:26,441 - INFO - Test line 2
21:40:26,441 - INFO - Test line 3
Why the space on every entry after the first?
--
View this message in context: http://old.nabble.com/New-to-log4net.-Easy-question--tp34438289p34438289.html
Sent from the Log4net - Users mailing list archive at Nabble.com.
RE: New to log4net. Easy question?
Posted by DaneVinson <da...@gmail.com>.
Doh!
Thanks much.
SEGERS Steven (CNH) wrote:
>
> Because you have a space in front of %exception.
>
> Best regards
>
> Steven
>
> -----Original Message-----
> From: DaneVinson [mailto:dane.vinson@gmail.com]
> Sent: zondag 16 september 2012 6:48
> To: log4net-user@logging.apache.org
> Subject: New to log4net. Easy question?
>
>
> /* Code */
> protected static readonly ILog Logger =
> log4net.LogManager.GetLogger(typeof(Program));
> static void Main(string[] args)
> {
> Logger.Info("Test line");
> Logger.Info("Test line 2");
> Logger.Info("Test line 3");
>
> /* Appender */
> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%date{ABSOLUTE} - %-5level -
> %message%newline %exception"/>
> </layout>
> </appender>
>
> /* Output */
> 21:40:26,429 - INFO - Test line
> 21:40:26,441 - INFO - Test line 2
> 21:40:26,441 - INFO - Test line 3
>
> Why the leading single space on every entry after the first?
> --
> View this message in context:
> http://old.nabble.com/New-to-log4net.-Easy-question--tp34438289p34438289.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>
>
--
View this message in context: http://old.nabble.com/New-to-log4net.-Easy-question--tp34438289p34438398.html
Sent from the Log4net - Users mailing list archive at Nabble.com.
RE: New to log4net. Easy question?
Posted by Radovan Raszka <ra...@hasam.cz>.
Hello,
It is good idea to add %newline at the end of message pattern, otherwise two messages are mixed on single line
Radovan
-----Původní zpráva-----
Od: SEGERS Steven (CNH) [mailto:steven.segers@cnh.com]
Odesláno: 16. září 2012 8:11
Komu: Log4NET User
Předmět: RE: New to log4net. Easy question?
Because you have a space in front of %exception.
Best regards
Steven
-----Original Message-----
From: DaneVinson [mailto:dane.vinson@gmail.com]
Sent: zondag 16 september 2012 6:48
To: log4net-user@logging.apache.org
Subject: New to log4net. Easy question?
/* Code */
protected static readonly ILog Logger =
log4net.LogManager.GetLogger(typeof(Program));
static void Main(string[] args)
{
Logger.Info("Test line");
Logger.Info("Test line 2");
Logger.Info("Test line 3");
/* Appender */
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{ABSOLUTE} - %-5level - %message%newline %exception"/>
</layout>
</appender>
/* Output */
21:40:26,429 - INFO - Test line
21:40:26,441 - INFO - Test line 2
21:40:26,441 - INFO - Test line 3
Why the leading single space on every entry after the first?
--
View this message in context: http://old.nabble.com/New-to-log4net.-Easy-question--tp34438289p34438289.html
Sent from the Log4net - Users mailing list archive at Nabble.com.
RE: New to log4net. Easy question?
Posted by "SEGERS Steven (CNH)" <st...@cnh.com>.
Because you have a space in front of %exception.
Best regards
Steven
-----Original Message-----
From: DaneVinson [mailto:dane.vinson@gmail.com]
Sent: zondag 16 september 2012 6:48
To: log4net-user@logging.apache.org
Subject: New to log4net. Easy question?
/* Code */
protected static readonly ILog Logger =
log4net.LogManager.GetLogger(typeof(Program));
static void Main(string[] args)
{
Logger.Info("Test line");
Logger.Info("Test line 2");
Logger.Info("Test line 3");
/* Appender */
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{ABSOLUTE} - %-5level - %message%newline %exception"/>
</layout>
</appender>
/* Output */
21:40:26,429 - INFO - Test line
21:40:26,441 - INFO - Test line 2
21:40:26,441 - INFO - Test line 3
Why the leading single space on every entry after the first?
--
View this message in context: http://old.nabble.com/New-to-log4net.-Easy-question--tp34438289p34438289.html
Sent from the Log4net - Users mailing list archive at Nabble.com.