Title: Writing newlines and whitespace to logs?
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
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
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 -
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
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
I understand what you want to do now. I didn't look at this line
closley enough:
log.Debug(%newline%newlineGun Level: Value %newline%newline)
That's not how log4net works. Patterns are evaulated once at start up
and cannot be dynmically inserted into a message. What do you expect to
happen