Skip navigation.
 
mlRe: Who broke NSLog on Leopard ?
FROM : Chris Kane
DATE : Fri Jan 25 22:55:30 2008

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_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlWho broke NSLog on Leopard ? David Burnett Jan 25, 20:29
mlRe: Who broke NSLog on Leopard ? John Stiles Jan 25, 21:00
mlRe: Who broke NSLog on Leopard ? David Burnett Jan 25, 22:04
mlRe: Who broke NSLog on Leopard ? John Stiles Jan 25, 22:20
mlRe: Who broke NSLog on Leopard ? Chris Kane Jan 25, 22:55