Re: Who broke NSLog on Leopard ?
Re: Who broke NSLog on Leopard ?
- Subject: Re: Who broke NSLog on Leopard ?
- From: Chris Kane <email@hidden>
- Date: Fri, 25 Jan 2008 13:55:30 -0800
That's the behavior of syslog(). From the man page:
Newlines and other non-printable characters embedded in the
message
string are printed in an alternate format. This prevents
someone from
using non-printable characters to construct misleading log
messages in an
output file. Newlines are printed as "\n", tabs are printed as
"\t".
Other control characters are printed using a caret ("^")
representation,
for example "^M" for carriage return.
The ASL subsystem, which NSLog() writes to, does the same (at least in
Leopard). Writing the XML to a file is a reasonable alternative.
Chris Kane
Cocoa Frameworks, Apple
On Jan 25, 2008, at 11:29 AM, David Burnett wrote:
Hi,
while developing on Tiger I was using the following code to debug thee
xml my app was creating.
NSLog(@"%@",
[[NSString alloc] initWithData:xml
encoding:NSUTF8StringEncoding]);
This worked fine, and I left in it as a useful debugging aid, as I
could ask users to copy the XML from the system log and it was nice
formatted. could just copy and paste it, and load it back into my
application.
Now I'm on Leopard I get stuff like.....
<color index="0" rgb="119 41 39"/>\n <color index="1" rgb="129 51
39"/>\n <color index="2" rgb="135 57 39"/>\n <color index="3"
rgb="144 63 39"/>\n
Notice the \n, its not me of showing the line feeds, I'm actually
getting the characters "\" and "n" in the syslog.
Is there anyway to get the old behaviour back ?
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden