bugGNUstep - Bugs: bug #30489, NSLog() behavior on Windows

Group
 
 

bug #30489: NSLog() behavior on Windows

Submitter:  Jonathan Gillaspie <jonathanosx>
Submitted:  Mon 19 Jul 2010 06:14:57 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 31 Aug 2010 12:57:14 PM UTC, comment #6: 

One has also the possibility to set an own handler for NSLog() output by setting an own function pointer to _NSLog_printf_handler
(but don't forget to lock the log log before and release it afterwards).

In your own handler you can do whatever you want to do with your log output. I use this also to customize the output for my needs.

Roland Schwingel <rosch>
Tue 31 Aug 2010 10:55:55 AM UTC, comment #5: 

I'll close this as what we are talking about now is not an NSLog() issue, but rather an issue of where stdout and stderr go to on mswindows.

If you search for information about mswindows handling of stdin/stdout on the net you will find that a binary can be marked to use a different I/O subsystem, and the 'editbin' tool can be used to change the setting for a particular binary (so you could probably use this program to get the behavior you want).  If you want to send stdout and stderr to the windows console, you likely need to mark your binary as using the CONSOLE subsystem, or add code to open and use a console directly.

I guess you could make an argument for having gnustep-make link the program the 'right' way (ie explicitly link a 'tool' one way and link an 'app' another way) ... IMO that ought to be done as a change request for gnustep-make (and I expect Nicola would be grateful if you could find out exactly what linker options are needed to control this).

Richard Frith-Macdonald <CaS>
Group Member
Tue 31 Aug 2010 12:06:37 AM UTC, comment #4: 

So, setting this DWRITE I am able to get my app to redirect stderr to a file.  But if I run it from the WINDOWS command prompt (not from the MSYS one) then both STDOUT and STDERR do not come to the console.   (I've tried the typical 2>& when launching, which works for file redirect, but not to the terminal).  I'm not sure how closely that matches Eric's behavior but it's not just him.

If anyone knows how to direct GNUstep/Mingw STDERR when using a typical windows CMD.exe I would be happy for suggestions.

Jonathan Gillaspie <jonathanosx>
Group Member
Mon 30 Aug 2010 07:38:10 PM UTC, comment #3: 

This works fine for everyone else afaik (certainly it does for me).

Your problem doesn't sound like a GNUstep issue ... more likely stderr is just being sent somewhere you aren't expecting.

Richard Frith-Macdonald <CaS>
Group Member
Wed 25 Aug 2010 02:21:05 AM UTC, comment #2: 

The GSLogSyslog setting doesn't seem to work for me.

I've tried:

$ defaults write NSGlobalDomain GSLogSyslog NO
$ defaults write NSGlobalDomain GSLogSyslog YES

and in either case NSLog output only appears if I run the app in gdb.

Eric Wasylishen <ericw>
Group Member
Wed 21 Jul 2010 08:28:40 AM UTC, comment #1: 

Control of NSLog() output is already supported.
See GSLogSyslog in http://www.gnustep.org/resources/documentation/Developer/Base/Reference/index.html

Richard Frith-Macdonald <CaS>
Group Member
Mon 19 Jul 2010 06:14:57 PM UTC, original submission:  

It appears that all NSLogs() on Windows are sent to the Event Viewer system
(when not running debug).

When running GNUstep apps that are started from a terminal session - I would like to be able to control (defaults?) if it's send to Events or to the terminal session (stdout/stderr).


Jonathan Gillaspie <jonathanosx>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rosch (Posted a comment)
  • -email is unavailable- added by ericw (Posted a comment)
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by jonathanosx (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-08-31 CaS StatusWorks For Me Invalid
        Open/ClosedOpen Closed
    2010-08-30 CaS StatusNone Works For Me
    2010-08-25 ericw Item GroupChange Request Bug
        StatusInvalid None
        Open/ClosedClosed Open
    2010-07-21 CaS StatusNone Invalid
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code