I just downloaded the latest version, but I just took another look at what you said. I don't want this newline to be added to every line (I think that is what this configuration will do), I want it to be something that I can apply to log statements as needed. For instance, I want to log statements as usual (one entry per line with timestamps), until I get to something that is important to the reader. At that point, I want to add 1 or 2 newlines before and after it, so that it stands out to the person reading the log. This, I believe, can only be done in code, right? If I put it in the XML config file, it will apply to the entire log.
The (message as Object) parameter of the methods to write to the log is usually a string, right? Can't I just include an escape character in the message to signify the insertion of a newline? -----Original Message----- From: Ron Grabowski [mailto:[EMAIL PROTECTED] Sent: Friday, October 21, 2005 2:16 PM To: Log4NET Dev Subject: RE: Writing newlines and whitespace to logs? 1.2.0.30714 is not the latest version. You should download 1.2.9 beta: http://logging.apache.org/log4net/downloads.html This should work: <layout type="log4net.Layout.SimpleLayout"> <header type="log4net.Util.PatternString" value="%newline" /> </layout> Or you could use supply your own conversion pattern: <layout type="log4net.Layout.PatternLayout"> <header type="log4net.Util.PatternString" value="%newline" /> <conversionPattern value="%5level %date - %message%newline" /> </layout> Here's a list of patterns that can be used with PatternString: http://logging.apache.org/log4net/release/sdk/index.html --- "Secules, Christopher T [AMSRD-AAR-AEF-A]" <[EMAIL PROTECTED]> wrote: > Ron, thanks for the suggestion. Just tried it. Still not working. > It is > interpretting the "escape" characters literally. Any other ideas? > Here are > my tests and results: > > > \r\n > Log statement: > log.Debug("\r\nGun Level: " & Value & "\r\n") > > Result: > 2005-10-21 12:34:33,864 [DEBUG] COMPONENT v2.1 - \r\nGun Level: > 32000\r\n > > > %n%n > Log Statement: > log.Debug("%n%nGun Level: " & Value & "%n%n") > > Result: > 2005-10-21 13:11:27,570 [DEBUG] COMPONENT v2.1 - %n%nGun Level: > 32000%n%n > > > %newline%newline > Log Statement: > log.Debug("%newline%newlineGun Level: " & Value & "%newline%newline") > > Result: > 2005-10-21 13:15:54,482 [DEBUG] COMPONENT v2.1 - %newline%newlineGun > Level: > 32000%newline%newline > > > > -----Original Message----- > From: Ron Grabowski [mailto:[EMAIL PROTECTED] > Sent: Friday, October 21, 2005 1:03 PM > To: Log4NET Dev > Subject: Re: Writing newlines and whitespace to logs? > > > Have you tried %n and/or %newline ? > > --- "Secules, Christopher T [AMSRD-AAR-AEF-A]" > <[EMAIL PROTECTED]> > wrote: > > > I know you can identify newlines in the header and footer of the > > config file by specifying "\r\n". I'm trying to figure out how to > > specify newlines in > > the actual log statements. I can write blank strings, but it still > > has the > > timestamp prefix attached to it. I am using log4net version > > 1.2.0.30714, > > which I think is the latest. I would greatly appreciate any help > > that > > anyone can offer. > > > > Thanks, > > Chris > > > > >
