I'm using log4net for logging whenever i tried to print a exception message using the log.Error(). i'm getting a new line in the log file.I want to avoid this. can anyone help me out here.
Asked
Active
Viewed 3,096 times
2
-
2Can you show the pattern used for the log entry and a sample entry? – David Nov 08 '11 at 14:23
1 Answers
0
One way to avoid this is to tell the appender not to log the stack trace:
Log4Net - Logging out the Exception stacktrace only for certain files
If you need the stack trace in your log file you can combine the solution above with an additional pattern converter that is responsible to write the stack trace without creating new lines. A sample converter can be found here:

Community
- 1
- 1

Stefan Egli
- 17,398
- 3
- 54
- 75
-
Thanks for the comment pal. But im not appending the stack trace. im appending the exception message which contains \r\n and the end the log4net provides a additional \n at the end of the stream so a new line is printing. Currently for all the exception message im replacing the \n with a null string to avoid the new line is there anyother way to get around this – Umamaheswaran Nov 09 '11 at 06:43